Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't use google play services on unity java plugin

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?

like image 205
Dima Avatar asked Dec 22 '13 11:12

Dima


2 Answers

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.

like image 118
jab Avatar answered Sep 23 '22 02:09

jab


Don't copy all project into your Plugins/Android.

  1. 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"
     />
    
  2. Copy Google play services jar -> to Plugins/Android

  3. Copy all res folder -> to Plugins/Android/res

like image 37
Frank Nguyen Avatar answered Sep 24 '22 02:09

Frank Nguyen