我使用Cocos2dx庫設置Eclipse IDE。我試圖在cocos2dx庫中設置並運行helloworld項目,但是在helloworld.apk成功上傳到模擬器後,我在LogCat中遇到此錯誤。.apk上傳成功,但在ClassNotFoundException中啓動意圖結果com.game.demo.helloworld
我在SDK 17 Eclipse構建:v22.0.1-685705
我已經通過計算器上幾乎4-5類似的帖子看了,但已經嘗試一切,不知道如何解決這個問題。
這裏的logcat的條目:
06-26 06:30:27.411: E/AndroidRuntime(781): FATAL EXCEPTION: main
06-26 06:30:27.411: E/AndroidRuntime(781): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.game.demo/com.game.demo.helloworld}: java.lang.ClassNotFoundException: Didn't find class "com.game.demo.helloworld" on path: /data/app/com.game.demo-2.apk
06-26 06:30:27.411: E/AndroidRuntime(781): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
06-26 06:30:27.411: E/AndroidRuntime(781): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
06-26 06:30:27.411: E/AndroidRuntime(781): at android.app.ActivityThread.access$600(ActivityThread.java:141)
06-26 06:30:27.411: E/AndroidRuntime(781): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
06-26 06:30:27.411: E/AndroidRuntime(781): at android.os.Handler.dispatchMessage(Handler.java:99)
06-26 06:30:27.411: E/AndroidRuntime(781): at android.os.Looper.loop(Looper.java:137)
06-26 06:30:27.411: E/AndroidRuntime(781): at android.app.ActivityThread.main(ActivityThread.java:5041)
06-26 06:30:27.411: E/AndroidRuntime(781): at java.lang.reflect.Method.invokeNative(Native Method)
06-26 06:30:27.411: E/AndroidRuntime(781): at java.lang.reflect.Method.invoke(Method.java:511)
06-26 06:30:27.411: E/AndroidRuntime(781): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
06-26 06:30:27.411: E/AndroidRuntime(781): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
06-26 06:30:27.411: E/AndroidRuntime(781): at dalvik.system.NativeStart.main(Native Method)
06-26 06:30:27.411: E/AndroidRuntime(781): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.game.demo.helloworld" on path: /data/app/com.game.demo-2.apk
06-26 06:30:27.411: E/AndroidRuntime(781): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
06-26 06:30:27.411: E/AndroidRuntime(781): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
06-26 06:30:27.411: E/AndroidRuntime(781): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
06-26 06:30:27.411: E/AndroidRuntime(781): at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
06-26 06:30:27.411: E/AndroidRuntime(781): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
06-26 06:30:27.411: E/AndroidRuntime(781): ... 11 more
06-26 06:30:27.411: E/AndroidRuntime(781): FATAL EXCEPTION: main
06-26 06:30:27.411: E/AndroidRuntime(781): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.game.demo/com.game.demo.helloworld}: java.lang.ClassNotFoundException: Didn't find class "com.game.demo.helloworld" on path: /data/app/com.game.demo-2.apk
06-26 06:30:27.411: E/AndroidRuntime(781): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
06-26 06:30:27.411: E/AndroidRuntime(781): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
06-26 06:30:27.411: E/AndroidRuntime(781): at android.app.ActivityThread.access$600(ActivityThread.java:141)
06-26 06:30:27.411: E/AndroidRuntime(781): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
06-26 06:30:27.411: E/AndroidRuntime(781): at android.os.Handler.dispatchMessage(Handler.java:99)
06-26 06:30:27.411: E/AndroidRuntime(781): at android.os.Looper.loop(Looper.java:137)
06-26 06:30:27.411: E/AndroidRuntime(781): at android.app.ActivityThread.main(ActivityThread.java:5041)
06-26 06:30:27.411: E/AndroidRuntime(781): at java.lang.reflect.Method.invokeNative(Native Method)
06-26 06:30:27.411: E/AndroidRuntime(781): at java.lang.reflect.Method.invoke(Method.java:511)
06-26 06:30:27.411: E/AndroidRuntime(781): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
06-26 06:30:27.411: E/AndroidRuntime(781): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
06-26 06:30:27.411: E/AndroidRuntime(781): at dalvik.system.NativeStart.main(Native Method)
06-26 06:30:27.411: E/AndroidRuntime(781): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.game.demo.helloworld" on path: /data/app/com.game.demo-2.apk
06-26 06:30:27.411: E/AndroidRuntime(781): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
06-26 06:30:27.411: E/AndroidRuntime(781): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
06-26 06:30:27.411: E/AndroidRuntime(781): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
06-26 06:30:27.411: E/AndroidRuntime(781): at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
06-26 06:30:27.411: E/AndroidRuntime(781): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
06-26 06:30:27.411: E/AndroidRuntime(781): ... 11 more
這裏是我的AndroidManifest.xml文件:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.game.demo"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8"/>
<uses-feature android:glEsVersion="0x00020000" />
<application android:label="@string/app_name"
android:icon="@drawable/icon">
<activity android:name=".helloworld"
android:label="@string/app_name"
android:screenOrientation="landscape"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:configChanges="orientation">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<supports-screens android:largeScreens="true"
android:smallScreens="true"
android:anyDensity="true"
android:normalScreens="true"/>
</manifest>
郵政helloworld.java(一個開始'package')在helloworld.java –
第一行是第一行:包com.game.demo.helloworld;這與AndroidManifest.xml中的android:name標籤值相匹配。但我認爲我只是錯誤地引用了軟件包?讓我更新該項目的屏幕截圖...也許這將有助於... – user2518312
我沒有足夠的分數來添加屏幕截圖。 – user2518312