我试图按照Ben in this post的建议将我的第一个Android项目重命名为其他项目。但是,即使按照建议here进行清理,我在手机上启动应用程序时出现错误(构建正常):
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
我的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&#39;看到&#39;新名字?或者出了什么问题?
答案 0 :(得分:0)
修改application
标记,如下所示:
<application
android:allowBackup="true"
android:icon="@mipmap/stoxx"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/Theme.AppCompat.Light" >
答案 1 :(得分:0)
活动代码位于应用程序代码之外,因为您关闭了应用程序代码。
<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>