CommandInvokationFailure for android build

I am getting this error in unity 5.1.2f1 while creating android build. Code is working perfectly for unity 4.6.3

CommandInvokationFailure: Failed to re-package resources. See the Console for details.
/Users/compimac3/Documents/android-sdk-macosx 2/build-tools/21.1.1/aapt package --auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S “res” -I “/Users/compimac3/Documents/android-sdk-macosx 2/platforms/android-21/android.jar” -F bin/resources.ap_ --extra-packages com.chartboost.sdk.unity:com.prime31.NAME:com.facebook.android:com.google.android.gms:com.nurdymuny.paperchasex -S “/Users/compimac3/Documents/unity/PC2/paperchase/unity/Temp/StagingArea/android-libraries/facebook/res” -S “/Users/compimac3/Documents/unity/PC2/paperchase/unity/Temp/StagingArea/android-libraries/google-play-services_lib/res” -S “/Users/compimac3/Documents/unity/PC2/paperchase/unity/Temp/StagingArea/android-libraries/unity-android-resources/res”

stderr[
/Users/compimac3/Documents/unity/PC2/paperchase/unity/Temp/StagingArea/android-libraries/facebook/res/drawable/com_facebook_close.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
/Users/compimac3/Documents/unity/PC2/paperchase/unity/Temp/StagingArea/android-libraries/facebook/res/drawable-ldpi/com_facebook_close.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
/Users/compimac3/Documents/unity/PC2/paperchase/unity/Temp/StagingArea/android-libraries/facebook/res/drawable-hdpi/com_facebook_close.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
/Users/compimac3/Documents/unity/PC2/paperchase/unity/Temp/StagingArea/android-libraries/facebook/res/drawable-xhdpi/com_facebook_close.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
res/drawable-xhdpi-v4/ic_plusone_medium_off_client 1.png: Invalid file name: must contain only [a-z0-9_.]
res/drawable-xhdpi-v4/ic_plusone_small_off_client 1.png: Invalid file name: must contain only [a-z0-9_.]
res/drawable-xhdpi-v4/ic_plusone_standard_off_client 1.png: Invalid file name: must contain only [a-z0-9_.]
res/drawable-xhdpi-v4/ic_plusone_tall_off_client 1.png: Invalid file name: must contain only [a-z0-9_.]
res/drawable-xhdpi-v4/powered_by_google_dark 1.png: Invalid file name: must contain only [a-z0-9_.]
res/drawable-xhdpi-v4/powered_by_google_light 1.png: Invalid file name: must contain only [a-z0-9_.]
res/color/common_signin_btn_text_dark 1.xml: Invalid file name: must contain only [a-z0-9_.]
warning: string ‘auth_client_needs_enabling_title’ has no default translation.
/Users/compimac3/Documents/unity/PC2/paperchase/unity/Temp/StagingArea/android-libraries/google-play-services_lib/res/values-af/auth_strings.xml:5: note: locale af found
/Users/compimac3/Documents/unity/PC2/paperchase/unity/Temp/StagingArea/android-libraries/google-play-services_lib/res/values-am/auth_strings.xml:5: note: locale am found
/Users/compimac3/Documents/unity/PC2/paperchase/unity/Temp/StagingArea/android-libraries/google-play-services_lib/res/values-ar/auth_strings.xml:5: note: locale ar found
/Users/compimac3/Documents/unity/PC2/paperchase/unity/Temp/StagingArea/android-libraries/google-play-services_lib/res/values-be/auth_strings.xml:5: note: locale be found
/Users/compimac3/Documents/unity/PC2/paperchase/unity/Temp/StagingArea/android-libraries/google-play-services_lib/res/values-bg/auth_strings.xml:5: note: locale bg found
/Users/compimac3/Documents/unity/PC2/paperchase/unity/Temp/StagingArea/android-libraries/google-play-services_lib/res/values-ca/auth_strings.xml:5: note: locale ca found
/Users/compimac3/Documents/unity/PC2/paperchase/unity/Temp/StagingArea/android-libraries/google-play-services_lib/res/values-cs/auth_strings.xml:5: note: locale cs found
/Users/compimac3/Documents/unity/PC2/paperchase/unity/Temp/StagingArea/android-libraries/google-play-services_lib/res/values-da/auth_strings.xml:5: note: locale da found
/Users/compimac3/Documents/unity/PC2/paperchase/unity/Temp/StagingArea/android-libraries/google-play-services_lib/res/values-de/auth_strings.xml:5: note: locale de found
/Users/compimac3/Documents/unity/PC2/paperchase/unity/Temp/StagingArea/android-libraries/google-play-services_lib/res/values-el/auth_strings.xml:5: note: locale el found
/Users/compimac3/Documents/unity/PC2/paperchase/unity/Temp/StagingArea/android-libraries/google-play-services_lib/res/values-en-rGB/auth_strings.xml:5: note:
warning: string ‘auth_client_needs_enabling_title’ has no default translation.
/Users/compimac3/Documents/unity/PC2/paperchase/unity/Temp/StagingArea/android-libraries/google-play-services_lib/res/values-af/auth_strings.xml:5: note: locale af found
/Users/compimac3/Documents/unity/PC2/paperchase/unity/Temp/StagingArea/android-libraries/google-play-services_lib/res/values-am/auth_strings.xml:5: note: locale am found
/Users/compimac3/Documents/unity/PC2/paperchase/unity/Temp/StagingArea/android-libraries/google-play-services_lib/res/values-ar/auth_strings.xml:5: note: locale ar found
/Users/compimac3/Documents/unity/PC2/paperchase/unity/Temp/StagingArea/android-libraries/google-play-services_lib/res/values-be/auth_strings.xml:5: note: locale be found
/Users/compimac3/Documents/unity/PC2/paperchase/unity/Temp/StagingArea/android-libraries/google-play-services_lib/res/values-bg/auth_strings.xml:5: note: locale bg found
/Users/compimac3/Documents/unity/PC2/paperchase/unity/Temp/StagingArea/android-libraries/google-play-services_lib/res/values-ca/auth_strings.xml:5: note: locale ca found
/Users/compimac3/Documents/unity/PC2/paperchase/unity/Temp/StagingArea/android-libraries/google-play-services_lib/res/values-cs/auth_strings.xml:5: note: locale cs found
/Users/compimac3/Documents/unity/PC2/paperchase/unity/Temp/StagingArea/android-libraries/google-play-services_lib/res/values-da/auth_strings.xml:5: note: locale da found
/Users/compimac3/Documents/unity/PC2/paperchase/unity/Temp/StagingArea/android-libraries/google-play-services_lib/res/values-de/auth_strings.xml:5: note: locale de found
/Users/compimac3/Documents/unity/PC2/paperchase/unity/Temp/StagingArea/android-libraries/google-play-services_lib/res/values-el/auth_strings.xml:5: note: locale el found
/Users/compimac3/Documents/unity/PC2/paperchase/unity/Temp/StagingArea/android-libraries/google-play-services_lib/res/values-en-rGB/auth_strings.xml:5: note:

Any idea?

Thanks

Sounds odd that a Unity upgrade would cause this, but from reading the log I would say the problem is you have spaces in some of your resource filenames:

res/drawable-xhdpi-v4/ic_plusone_medium_off_client 1.png: Invalid file name: must contain only [a-z0-9_.]
res/drawable-xhdpi-v4/ic_plusone_small_off_client 1.png: Invalid file name: must contain only [a-z0-9_.]
res/drawable-xhdpi-v4/ic_plusone_standard_off_client 1.png: Invalid file name: must contain only [a-z0-9_.]
res/drawable-xhdpi-v4/ic_plusone_tall_off_client 1.png: Invalid file name: must contain only [a-z0-9_.]
res/drawable-xhdpi-v4/powered_by_google_dark 1.png: Invalid file name: must contain only [a-z0-9_.]
res/drawable-xhdpi-v4/powered_by_google_light 1.png: Invalid file name: must contain only [a-z0-9_.]
res/color/common_signin_btn_text_dark 1.xml: Invalid file name: must contain only [a-z0-9_.]

According to the error, those files under res should have a filename made of particular letters:
Invalid file name: must contain only [a-z0-9_.]

e.g: only lowercase letters, digits or underscores. No spaces / upper case letters are allowed.

I really have no idea why that has changed, maybe 5.1.2 uses a newer version of the android build tools that enforces this restriction.

I managed to solve this by replacing whole folder from old code of unity4.