gpt4 book ai didi

java - .apk 上传成功,但启动 Intent 导致 ClassNotFoundException com.game.demo.helloworld

转载 作者:行者123 更新时间:2023-12-01 14:23:57 25 4
gpt4 key购买 nike

我使用 Cocos2dx 库设置 Eclipse IDE。我正在尝试在 cocos2dx 库中设置并运行 helloworld 项目,但在 helloworld.apk 成功上传到模拟器后,我在 LogCat 中遇到此错误。

我使用的是 SDK 17Eclipse 版本:v22.0.1-685705

我在 stackoverflow 上浏览了近 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>

最佳答案

您的 list 包声明为 com.game.demo,但您的文件位于 com.game.demo.helloworld 中。

尝试:

<activity android:name="com.game.demo.helloworld.helloworld"

关于java - .apk 上传成功,但启动 Intent 导致 ClassNotFoundException com.game.demo.helloworld,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17313233/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com