尝试遵循本教程:
使用AndEngine,当我到达终点时,“values-v11”和“values-v14”文件夹(res parrent文件夹)中的styles.xml文件出现了两个错误。
资源-->值-v11--> style.xml
检索项目的父项时出错:找不到与给定名称“android:Theme.Holo.Light”匹配的资源。
在资源--> 值-v14--> style.xml
检索项目的父项时出错:找不到与给定名称“android:Theme.Holo.Light.DarkActionBar”匹配的资源。
我查看了它们,并被告知用以下内容替换它们:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="CustomWindowTitleBackground">
</style>
</resources>
然后我在 main.xml 文件中收到错误消息:“在包 'android' 中找不到属性 'showAsAction' 的资源标识符”,并被告知删除“android:showAsAction="never" 行,结果如下:
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:title="@string/action_settings"/>
</menu>
这摆脱了错误。但是现在当我在手机上运行它时,手机显示“不幸的是,myTestProject 已停止”
为什么是这样?这是我的 logcat 错误:
05-21 06:52:24.701: W/dalvikvm(8377): threadid=1: thread exiting with uncaught exception (group=0x40ac19d8)
05-21 06:52:24.701: E/AndroidRuntime(8377): FATAL EXCEPTION: main
05-21 06:52:24.701: E/AndroidRuntime(8377): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.mystuff/com.mystuff.MainActivity}: java.lang.ClassNotFoundException: com.mystuff.MainActivity
05-21 06:52:24.701: E/AndroidRuntime(8377): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1880)
05-21 06:52:24.701: E/AndroidRuntime(8377): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
05-21 06:52:24.701: E/AndroidRuntime(8377): at android.app.ActivityThread.access$600(ActivityThread.java:123)
05-21 06:52:24.701: E/AndroidRuntime(8377): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
05-21 06:52:24.701: E/AndroidRuntime(8377): at android.os.Handler.dispatchMessage(Handler.java:99)
05-21 06:52:24.701: E/AndroidRuntime(8377): at android.os.Looper.loop(Looper.java:137)
05-21 06:52:24.701: E/AndroidRuntime(8377): at android.app.ActivityThread.main(ActivityThread.java:4424)
05-21 06:52:24.701: E/AndroidRuntime(8377): at java.lang.reflect.Method.invokeNative(Native Method)
05-21 06:52:24.701: E/AndroidRuntime(8377): at java.lang.reflect.Method.invoke(Method.java:511)
05-21 06:52:24.701: E/AndroidRuntime(8377): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
05-21 06:52:24.701: E/AndroidRuntime(8377): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)
05-21 06:52:24.701: E/AndroidRuntime(8377): at dalvik.system.NativeStart.main(Native Method)
05-21 06:52:24.701: E/AndroidRuntime(8377): Caused by: java.lang.ClassNotFoundException: com.mystuff.MainActivity
05-21 06:52:24.701: E/AndroidRuntime(8377): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
05-21 06:52:24.701: E/AndroidRuntime(8377): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
05-21 06:52:24.701: E/AndroidRuntime(8377): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
05-21 06:52:24.701: E/AndroidRuntime(8377): at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
05-21 06:52:24.701: E/AndroidRuntime(8377): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1871)
05-21 06:52:24.701: E/AndroidRuntime(8377): ... 11 more