利用AndroidStudio导出ar包导入Unity项目,通常会遇到以下几个问题:
1、资源合并的问题
Error building Player: CommandInvokationFailure: Failed to re-package resources. See the Console for details.
C:\adt-bundle-windows-x86_64-20130729\adt-bundle-windows-x86_64-20130729\sdk\build-tools\android-4.3\aapt.exe package --auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S "res" -I "C:/adt-bundle-windows-x86_64-20130729/adt-bundle-windows-x86_64-20130729/sdk/platforms/android-19\android.jar" -F bin/resources.ap_stderr[
res\values\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
res\values-v11\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
res\values-v14\styles.xml:8: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.
]
stdout[
Configurations:
(default)
v11
v14
hdpi
mdpi
xhdpi
xxhdpi
w820dp
解决办法: (1)可尝试使用minsdk为4.0以上版本(有一部分人通过这种方式解决,但本人亲测并没有解决问题)
(2)直接删除res中style文件,本人工程中style文件中的内容如下:
亲测,方法2解决了这个问题