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插件丢进去, 可惜对于我来说过于麻烦.

找到另一种相对简单的解决方案如下:

  1. 在Plugins/Android文件夹下创建CustomAndroidResource.androidlib文件夹

  1. 把原来Plugins/Android文件夹下的res文件夹移到CustomAndroidResource.androidlib文件夹下

  1. 在CustomAndroidResource.androidlib文件夹下创建两个文件,文件名和内容分别如下

AndroidManifest.xml



project.properties

target=android-9
android.library=true

4.最终如下,重新打包完成

你可能感兴趣的:(unity,踩坑日记,android)