如何修复android中的“活动类不存在”错误?
根据本的建议,我试图将我的第一个android项目重命名为其他项目。但是,即使按照建议进行清理,当在我的手机上启动应用程序时,我还是会遇到一个错误,并且运行正常:如何修复android中的“活动类不存在”错误?,android,Android,根据本的建议,我试图将我的第一个android项目重命名为其他项目。但是,即使按照建议进行清理,当在我的手机上启动应用程序时,我还是会遇到一个错误,并且运行正常: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.impyiablue.stoxx/com.example.alexander.myapplication.MainActivity }
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.impyiablue.stoxx/com.example.alexander.myapplication.MainActivity }
Error type 3
Error: Activity class
my gradle.build文件的内容如下:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.impyiablue.stoxx"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
preDexLibraries = false
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.+'
compile 'com.android.support:design:23.1.0'
compile 'com.mcxiaoke.volley:library:1.0.19'
}
我的舱单:
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.impyiablue.stoxx" >
<uses-permission android:name="android.permission.INTERNET" />
<application>
android:allowBackup="true"
android:icon="@mipmap/stoxx"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/Theme.AppCompat.Light" />
<activity
android:name="com.impyiablue.stoxx.MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.impyiablue.stoxx.NewEntryActivity"
android:label="@string/menu_add"
android:theme="@style/AppTheme.NoActionBar"
/>
</application>
</manifest>
我还需要修改什么才能让AndroidStudio“看到”新名称?还是有什么问题?编辑应用程序标记,如下所示:
<application
android:allowBackup="true"
android:icon="@mipmap/stoxx"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/Theme.AppCompat.Light" >
活动标记位于应用程序标记之外,因为您关闭了应用程序标记
<application> " The '>' over here should not be there"
android:allowBackup="true"
android:icon="@mipmap/stoxx"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/Theme.AppCompat.Light" /> " The '/' over here closes the application tag."
您的活动标记需要包含在应用程序标记中
<application> " The '>' over here should not be there"
android:allowBackup="true"
android:icon="@mipmap/stoxx"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/Theme.AppCompat.Light" /> " The '/' over here closes the application tag."
您的应用程序标记应如下所示:
<application
android:allowBackup="true"
android:icon="@mipmap/stoxx"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/Theme.AppCompat.Light" >
<activity
android:name="com.impyiablue.stoxx.MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.impyiablue.stoxx.NewEntryActivity"
android:label="@string/menu_add"
android:theme="@style/AppTheme.NoActionBar"
/>
</application>
您的manifest.xml在哪里?已添加;-我手动更改了一些内容,有些项目显示为红色,如MainActivity。请尝试清除并生成项目。同样的错误。活动类{com.impyiablue.stoxx/com.example.alexander.myapplication.MainActivity}不存在。我找到了另一个答案:现在我不再得到错误!但是,该应用程序也不能在手机上运行!!!!!!