验证Android XML文件中的资源引用

412*_*157 3 xml android android-layout

我刚刚创建了一个没有任何活动的应用程序,当我添加布局和java类时,我开始编辑AndroidManifest.xml来制作intent-filter并添加标签和活动内容.但后来它告诉我这个: 错误

这是我的AndroidManifest.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.arvisapps.practiceapp">

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme">
    <activity
        android:name=".MainActivity"
        android:label="@string/label">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

</application>
Run Code Online (Sandbox Code Playgroud)

这是MainActivity.java:

    package com.arvisapps.practiceapp;


public class MainActivity {
}
Run Code Online (Sandbox Code Playgroud)

我的activity_main.xml(我认为不需要,但无论如何):

    <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

小智 8

转到“文件”,然后选择“使缓存无效/重新启动”

菜单


mem*_*izr 5

MainActivity需要扩展Activity

public class MainActivity extends Activity { }