I have a plugin for Unity that is written in Java. In this plugin I need to get the new Google Advertisement ID to do it, I have to add to the Manifest file:
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
When I compile, Unity is throwing error:
Error building Player: CommandInvokationFailure: Failed to re-package resources. See the Console for details.
/Applications/adt/sdk/build-tools/android-4.2.2/aapt package --auto-add-overlay -v -f -m - J gen -M AndroidManifest.xml -S "res" -I "/Applications/adt/sdk/platforms/android- 19/android.jar" -F bin/resources.ap_
stderr[
AndroidManifest.xml:21: error: Error: No resource found that matches the given name (at 'value' with value '@integer/google_play_services_version').
]
I also tried to add the Google play services jar to the [lugins/Androif folder but that didn't help. What is the correct way to make it work?
To fix this error, you have to copy the version.xml
file from android-sdk/extras/google/google_play_services/libproject/google-play-services_lib/res/values/
into Assets/Plugins/Android/res/values/
your Unity project's folder.
Don't copy all project into your Plugins/Android.
Config file Manifest.xml to right information. Copy to Plugins/Android.
<meta-data android:name="com.google.android.gms.games.APP_ID" android:value="\ android app id " /> <meta-data android:name="com.google.android.gms.appstate.APP_ID" android:value="\ android app id " /> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> <activity android:name="com.google.example.games.pluginsupport.SignInHelperActivity" />
Copy Google play services jar -> to Plugins/Android
Copy all res folder -> to Plugins/Android/res
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With