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

<?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.最终如下,重新打包完成

猜你喜欢

转载自blog.csdn.net/qq_28784217/article/details/128863508
今日推荐