目录
1.1 想解决:Unity2020.3.7f1支持的安卓插件在Unity2019.3.6f1无法运行
2.1Unity2019/2020打包安卓步骤以及问题处理(全是干货!)
3.1.1 解答:咨询了一下安卓工程师,插件里面可以进行修改gradle版本,
一、目的
1.1 想解决:Unity2020.3.7f1支持的安卓插件在Unity2019.3.6f1无法运行
二.参考
2.1Unity2019/2020打包安卓步骤以及问题处理(全是干货!)
https://blog.csdn.net/qq_33795300/article/details/112787575
- 总结:都是干货
三.操作:1:只有建议:安卓进行修改gradle
3.1 报错
- Unity2019.3.6f1和Unity2020.3.7f1对比: 少了一些选项
- 打包出来时候,安卓运行会报错,
2021-07-09 10:54:45.341 12625-12659/? I/Unity: xzy 查看运行: initBle:failed:UnityEngine.AndroidJavaException: java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/core/content/ContextCompat;
at UnityEngine.AndroidJNISafe.CheckException () [0x00096] in <3c22a197ab60454cb70124c69f2248be>:0
at UnityEngine.AndroidJNISafe.CallVoidMethod (System.IntPtr obj, System.IntPtr methodID, UnityEngine.jvalue[] args) [0x0000f] in <3c22a197ab60454cb70124c69f2248be>:0
at UnityEngine.AndroidJavaObject._Call (System.String methodName, System.Object[] args) [0x00038] in <3c22a197ab60454cb70124c69f2248be>:0
at UnityEngine.AndroidJavaObject.Call (System.String methodName, System.Object[] args) [0x00001] in <3c22a197ab60454cb70124c69f2248be>:0
at UnityAndAndroid.<Start>b__5_0 () [0x00010] in <d7a6d6b0deca45769d07f9d005483baf>:0
(Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
2021-07-09 10:54:45.381 12625-12659/? E/Unity: AndroidJavaException: java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/core/content/ContextCompat;
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/core/content/ContextCompat;
at com.zhhd.unityblelibrary.UnityBleActivity.checkBluetoothPermission(UnityBleActivity.java:185)
at com.zhhd.unityblelibrary.UnityBleActivity.initBle(UnityBleActivity.java:135)
at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
at com.unity3d.player.UnityPlayer.access$600(Unknown Source)
at com.unity3d.player.UnityPlayer$f$1.handleMessage(Unknown Source)
at android.os.Handler.dispatchMessage(Handler.java:101)
at android.os.Looper.loop(Looper.java:156)
at com.unity3d.player.UnityPlayer$f.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.core.content.ContextCompat" on path: DexPathList[[zip file "/data/app/com.zhhd.Unity20190306-2/base.apk"],nativeLibraryDirectories=[/data/app/com.zhhd.Unity20190306-2/lib/arm, /data/app/com.zhhd.Unity20190306-2/ba
3.1.1 答:猜测:应该是使用的gradle版本不同