Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Didn't find class "com.unity3d.player.UnityPlayerNativeActivity" 问题 #1

Open
bagaking opened this issue Nov 13, 2019 · 1 comment

Comments

@bagaking
Copy link

官网下载的SDK包中, AndoridManifest 配置错误

问题描述

按文档完成资源导入和封装层修改, 导出Android包并安装成功, 设备上运行时崩溃
崩溃时相关报错

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.tonarts.itg, PID: 12645
    java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.tonarts.itg/com.unity3d.player.UnityPlayerNativeActivity}: java.lang.ClassNotFoundException: Didn't find class "com.unity3d.player.UnityPlayerNativeActivity" on path: DexPathList[[zip file "/data/app/com.tonarts.itg-1/base.apk"],nativeLibraryDirectories=[/data/app/com.tonarts.itg-1/lib/arm, /vendor/lib, /system/lib]]
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2486)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2656)
        at android.app.ActivityThread.access$800(ActivityThread.java:178)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1512)
        at android.os.Handler.dispatchMessage(Handler.java:111)
        at android.os.Looper.loop(Looper.java:194)
        at android.app.ActivityThread.main(ActivityThread.java:5691)
        at java.lang.reflect.Method.invoke(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:372)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)

解决方案

把 Manifest <activity android:name="com.unity3d.player.UnityPlayerNativeActivity" ... > 中的 UnityPlayerNativeActivity 修改为 UnityPlayerActivity:
<activity android:name="com.unity3d.player.UnityPlayerActivity" ... >
问题解决, 重新导出的包可以正常安装启动

希望Update自动生成的SDK文件

@bagaking
Copy link
Author

补充: 这应该是跟Unity新版本的兼容问题, 可能需要在SDK选择时指定版本

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant