【发布时间】:2015-05-28 08:26:02
【问题描述】:
所以,我遇到了这个错误,现在我什至无法编译代码!我不得不重命名包,因为它无法上传 APK,因为它是默认的 com.example[...] 规范。因此,我根据本教程重命名了包https://www.youtube.com/watch?v=_7-bvkRthWM,一切都搞砸了。
这是我的 AndroidManifest.xml,你可以看到定义了 MainMenu 活动:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.done.samuelh.josethepig" >
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Theme.AppCompat.Light.NoActionBar">
<!--android:theme="@android:style/Theme.Black.NoTitleBar">
android:theme="@style/Theme.AppCompat" - dark original background-->
<activity
android:name="com.done.samuelh.josethepig.MainMenu"
android:label="@string/app_name"
android:configChanges="orientation"
android:screenOrientation="sensorLandscape">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.done.samuelh.josethepig.Game"
android:label="@string/title_activity_game"
android:configChanges="orientation"
android:screenOrientation="sensorLandscape">
</activity>
</application>
</manifest>
这是我的 build.gradle...
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.done.samuelh.josethepig"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
}
一切,但发布 APK 在那个教程之前工作得很好,现在我真的被一个完整的游戏困住了......
如何解决这个令人讨厌的错误?
【问题讨论】:
-
您是否更改了任何包裹?
-
是的,你的项目结构是什么样的
-
尝试把这个 android:name="com.done.samuelh.josethepig.MainMenu" 改成这个 android:name=".MainMenu"
-
谢谢@dave,但看起来即使我同步、清理和重建。一旦我开始为每个提到的活动输入新代码,错误就消失了。似乎 AS 中有一个错误,它没有注册重构。
-
谢谢@BidhanA,但没有编辑任何其他包。 [见上面的 cmt]
标签: android xml android-activity apk android-manifest