unity 2020打包apk出现Unable to locate player settings. bin/Data/settings.xml

使用unity 2020版本打包出母包apk,运行没有问题,使用apktool二次打包,运行后出现如下报错

2021-11-03 11:21:22.667 4999-4999/ E/Unity: Unable to locate player settings. bin/Data/settings.xml
2021-11-03 11:21:22.826 4999-4999/ E/art: Failed to register native method com.unity3d.player.UnityPlayer.nativeDone()Z in /data/app/com.ddd.cn.s.o-1/base.apk
2021-11-03 11:21:22.827 4999-4999/ E/art: ----- class 'Lcom/unity3d/player/UnityPlayer;' cl=0x12c44550 -----
2021-11-03 11:21:22.827 4999-4999/ E/art:   objectSize=3773 (3640 from super)
2021-11-03 11:21:22.827 4999-4999/ E/art:   access=0x0008.0001
2021-11-03 11:21:22.827 4999-4999/ E/art:   super='java.lang.Class<android.widget.FrameLayout>' (cl=0x0)
2021-11-03 11:21:22.827 4999-4999/ E/art:   interfaces (1):
2021-11-03 11:21:22.827 4999-4999/ E/art:      0: java.lang.Class<com.unity3d.player.d> (cl=0x12c44550)

排查后最终发现母包使用的 Unity 2020内置 classes.jar,而二次打包使用的是另一个版本的classes.jar,替换成Unity 2020内置 classes.jar就可以了,同时classes.jar中已经不包含UnityPlayerActivity.java,需要单独添加UnityPlayerActivity.java才行。

上一篇:[USACO21FEB] Modern Art 3 G 题解


下一篇:android apex art 编译命令