Android - Error building Player: CommandInvokationFailure: Failed to re-package resources

匿名 (未验证) 提交于 2019-12-03 02:50:02

问题:

I am getting this error when i try to build my game for android. But it successfully built to webplayer. i checked everything is right,
and one think recently i upgrade my unity to 4.5.1

Error details are:

Error building Player: CommandInvokationFailure: Failed to re-package resources. See the Console for details. D:\adt-bundle-windows-x86_64-20131030\adt-bundle-windows-x86_64-20131030\sdk\build-tools\android-4.4\aapt.exe package --auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S "res" -I "D:/adt-bundle-windows-x86_64-20131030/adt-bundle-windows-x86_64-20131030/sdk/platforms/android-18\android.jar" -F bin/resources.ap_  stderr[ AndroidManifest.xml:9: error: Error: No resource found that matches the given name (at 'value' with value '@integer/google_play_services_version'). ] stdout[ Configurations:  (default)  hdpi  ldpi  xhdpi  xxhdpi  Files:   drawable\app_icon.png     Src: () res\drawable\app_icon.png     Src: (hdpi) res\drawable-hdpi\app_icon.png     Src: (ldpi) res\drawable-ldpi\app_icon.png     Src: (xhdpi) res\drawable-xhdpi\app_icon.png     Src: (xxhdpi) res\drawable-xxhdpi\app_icon.png   values\strings.xml     Src: () res\values\strings.xml   AndroidManifest.xml     Src: () AndroidManifest.xml  Resource Dirs:   Type drawable     drawable\app_icon.png       Src: () res\drawable\app_icon.png       Src: (hdpi) res\drawable-hdpi\app_icon.png       Src: (ldpi) res\drawable-ldpi\app_icon.png       Src: (xhdpi) res\drawable-xhdpi\app_icon.png       Src: (xxhdpi) res\drawable-xxhdpi\app_icon.png   Type values     values\strings.xml       Src: () res\values\strings.xml Including resources from package: D:\adt-bundle-windows-x86_64-20131030\adt-bundle-windows-x86_64-20131030\sdk\platforms\android-18\android.jar applyFileOverlay for drawable applyFileOverlay for layout applyFileOverlay for anim applyFileOverlay for animator applyFileOverlay for interpolator applyFileOverlay for transition applyFileOverlay for xml applyFileOverlay for raw applyFileOverlay for color applyFileOverlay for menu applyFileOverlay for mipmap Processing image: res\drawable-hdpi\app_icon.png Processing image: res\drawable\app_icon.png     (processed image res\drawable\app_icon.png: 97% size of source) Processing image: res\drawable-ldpi\app_icon.png     (processed image res\drawable-ldpi\app_icon.png: 98% size of source) Processing image: res\drawable-xhdpi\app_icon.png     (processed image res\drawable-hdpi\app_icon.png: 98% size of source) Processing image: res\drawable-xxhdpi\app_icon.png     (processed image res\drawable-xhdpi\app_icon.png: 98% size of source)     (processed image res\drawable-xxhdpi\app_icon.png: 98% size of source)     (new resource id app_icon from drawable\app_icon.png #generated)     (new resource id app_icon from hdpi\drawable\app_icon.png #generated)     (new resource id app_icon from ldpi\drawable\app_icon.png #generated)     (new resource id app_icon from xhdpi\drawable\app_icon.png #generated)     (new resource id app_icon from xxhdpi\drawable\app_icon.png #generated) ] 

回答1:

I deleted the 24.0.0 build tools folder from Android\sdk\build-tools and it's working !



回答2:

You need to put the google_play_service_lib folder from the androidsdk\extra\google folder in plugins\android in order to make it work properly.

You can find it in android-sdk-windows\extras\google\google_play_services\libproject. There you will find google_play_service_lib. You copy it in plugins/android in unity

Credit to Ouss.

note: if it's already in there, then chances are you've updated the android sdk, so you need the new lib folder. Close out of unity > delete the google play services lib folder > go to you sdk folder listed above > copy the lib folder in the address above > go back to your android plugins folder in your unity app > paste it in there > reopen unity and allow the scripts to compile > build.



回答3:

There is a new problem out there. In case you installed the Android preview SDK 24.0.0 (if you have such a folder inside the build tools folder) then unity does not build / repackage properly.

I see this issue:

CommandInvokationFailure: Failed to re-package resources. See the Console for details. C:\android-sdk\build-tools\24.0.0-preview\aapt.exe package --auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S "res" -I "C:/android-sdk\platforms\android-23\android.jar" -F bin/resources.ap_ --extra-packages android.support.v7.appcompat:com.everyplay.Everyplay:com.google.example.games.mainlibproj:com.google.android.gms.base:com.google.android.gms:com.google.android.gms.drive:com.google.android.gms.games:com.google.android.gms.nearby:com.google.android.gms.plus:android.support.v4 -S "C:\Workspace\Spacegame\Temp\StagingArea\android-libraries\appcompat-v7-23.1.1\res" -S "C:\Workspace\Spacegame\Temp\StagingArea\android-libraries\everyplay\res" -S "C:\Workspace\Spacegame\Temp\StagingArea\android-libraries\play-services-base-8.4.0\res" -S "C:\Workspace\Spacegame\Temp\StagingArea\android-libraries\play-services-basement-8.4.0\res" -S "C:\Workspace\Spacegame\Temp\StagingArea\android-libraries\play-services-drive-8.4.0\res" -S "C:\Workspace\Spacegame\Temp\StagingArea\android-libraries\play-services-games-8.4.0\res" -S "C:\Workspace\Spacegame\Temp\StagingArea\android-libraries\play-services-nearby-8.4.0\res" -S "C:\Workspace\Spacegame\Temp\StagingArea\android-libraries\play-services-plus-8.4.0\res" -S "C:\Workspace\Spacegame\Temp\StagingArea\android-libraries\support-v4-23.1.1\res"  stderr[  ] stdout[ Configurations:  (default)  Files:   AndroidManifest.xml     Src: () AndroidManifest.xml  Resource Dirs: Including resources from package: C:\android-sdk\platforms\android-23\android.jar applyFileOverlay for drawable trying overlaySet Key=ic_plusone_medium_off_client.png trying overlaySet Key=ic_plusone_small_off_client.png trying overlaySet Key=ic_plusone_standard_off_client.png trying overlaySet Key=ic_plusone_tall_off_client.png trying overlaySet Key=common_full_open_on_phone.png trying overlaySet Key=common_google_signin_btn_icon_dark.xml trying overlaySet Key=common_google_signin_btn_icon_dark_disabled.9.png 

The only working solution I found is to uninstall the 24.0.0 build tools folder - means simply delete it and restart Unity. Seems that Unity has issues with the new Android 24 build tools.

Edit: you'll find the build tools folder inside your Android SDK Folder



回答4:

What i did and it worked.

i had only jre not jdk. First i download jdk from oracle site.
set up environments path:

JAVA_HOME
C:\Program Files (x86)\Java\jdk1.8.0_11\bin

but error exist again.

========================================

Then i got this guide: try this and tell if it works.

copy zipalign.exe file from > D:\adt-bundle-windows-x86_64-20131030\adt-bundle-windows-x86_64-20140702\adt-bundle-windows-x86_64-20140702\sdk\build-tools\android-4.4W

or where ever you have it and then Past to > D:\adt-bundle-windows-x86_64-20131030\adt-bundle-windows-x86_64-20140702\adt-bundle-windows-x86_64-20140702\sdk\tools

Unity3diy forums

And everything works perfect :)



易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!