Unity2021打包报错: Exception: OBSOLETE - Providing Android resources in Assets/Plugins/Android/
Posted Huil
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Unity2021打包报错: Exception: OBSOLETE - Providing Android resources in Assets/Plugins/Android/相关的知识,希望对你有一定的参考价值。
项目升级2021后打包出现报错:
Exception: OBSOLETE - Providing android resources in Assets/Plugins/Android/res was removed, please move your resources to an AAR or an Android Library. See "AAR plug-ins and Android Libraries" section of the Manual for more details.
百度了一下是Unity2021不再支持在安卓Build的时候直接存在Android/res文件夹
解决方案最佳是去自己创建aar插件丢进去, 可惜对于我来说过于麻烦.
找到另一种相对简单的解决方案如下:
在Plugins/Android文件夹下创建CustomAndroidResource.androidlib文件夹
把原来Plugins/Android文件夹下的res文件夹移到CustomAndroidResource.androidlib文件夹下
在CustomAndroidResource.androidlib文件夹下创建两个文件,文件名和内容分别如下
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="custom.android.res"
android:versionCode="1"
android:versionName="1.0">
</manifest>
project.properties
target=android-9
android.library=true
4.最终如下,重新打包完成
Unity 报错之 打包安卓闪退 Could not allocate memory: System out of memory
Unity 报错之 打包安卓闪退 Could not allocate memory: System out of memory
问题背景
更换机器打包,打包机器上没有开发使用的Unity版本,所以更换了Unity2019.4.8f1版本进行导出安卓工程,在安卓工程中打包出现闪退问题。
闪退报错
Unity: Could not allocate memory: System out of memory!
Trying to allocate: 4227858432B with 16 alignment. MemoryLabel: DynamicArray
Allocation happened at: Line:78 in
Memory overview
[ ALLOC_TEMP_THREAD ] used: 32768B | peak: 0B | reserved: 3538944B
[ ALLOC_TEMP_JOB_1_FRAME ] used: 0B | peak: 0B | reserved: 1048576B
[ ALLOC_TEMP_JOB_2_FRAMES ] used: 0B | peak: 0B | reserved: 1048576B
[ ALLOC_TEMP_JOB_4_FRAMES ] used: 0B | peak: 0B | reserved: 1048576B
[ ALLOC_TEMP_JOB_ASYNC ] used: 0B | peak: 0B | reserved: 1048576B
[ ALLOC_DEFAULT ] used: 3638090B | peak: 3638090B | reserved: 3858110B
[ ALLOC_GAMEOBJECT ] used: 809064B | peak: 809064B | reserved: 809216B
[ ALLOC_GFX ] used: 256B | peak: 256B | reserved: 313B
解决问题
更换了Unity版本。
经过不断地尝试,我将Unity版本修改到打包机上有的Unity2019.4.13f1,再次进行同样的操作就解决问题了。
推测是Unity2019.4.8f1的版本和之前开发版本相差略大导致的问题。
以上是关于Unity2021打包报错: Exception: OBSOLETE - Providing Android resources in Assets/Plugins/Android/的主要内容,如果未能解决你的问题,请参考以下文章
FastLane自动化打包报错: An exception has occurred: issuerId is required
FastLane自动化打包报错: An exception has occurred: issuerId is required
Unity 报错之 打包安卓闪退 Could not allocate memory: System out of memory
Unity 报错之 打包安卓闪退 Could not allocate memory: System out of memory
Unity打包报错 com.android.buil.gradle.internal.tasks.workers$ActionFacade