Google play services cannot find its resources

I thought I would post about this since this error keeps coming up. I use admob-v2 in my android app and I see this error constantly in the logcat:

E/GooglePlayServicesUtil(10761): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.  

It is worth noting that I also see this error in the logcat whether I build the app with corona enterprise or with the normal corona SDK. 

Does anyone know why this is happening or how to fix it? It doesn’t seem to break anything in the app but who knows?

This is also happening to me with Google IAP V3. Any help?

To get rid of these errors (in Enterprise) you need to link Google Play Services as a library instead of including the jar-archive in the libs directory.
 
Your project.properties file can look something like this:

android.library.reference.1=${CoronaEnterpriseDir}/Corona/android/lib/Corona android.library.reference.2=./google-play-services\_lib

Here I’ve created a new directory in the project directory which includes the library. An important thing to note is that the directory given as a library reference *must* be a relative path (hence the ./ above). Absolute paths will not work.

You’ll need to get your hands on the full library from Google (which includes all the resources). One issue is that you need the exact same version as Corona is using which is google-play-services-4242030. I had difficulty finding it but was able to get my hands on it after Googling around a while.

Once you have that you can also change your AndroidManifest.xml to include

<meta-data android:name=“com.google.android.gms.version” android:value="@integer/google_play_services_version"/>

instead of hardcoding the version number.

Here’s the link  :wink: :

http://dl.google.com/android/repository/google_play_services_4242030_r15.zip

You’ll find the library in the libproject directory. I just put the contents of this zip in a central repository and create a symlink to google-play-services_lib in each project that needs it.

Hi ingemar,

I added 

\<meta-data android:name="com.google.android.gms.version" android:value="@integer/google\_play\_services\_version"/\>

in between my <application> tag in Android.manifest, but during compilation, I got this error:

No resource found that matches the given name (at 'value' with value '@integer/google\_play\_services\_version').

Do we need to declare a R file?

It looks like it’s not finding the library. Make sure your project.properties includes the library reference.

You’ll need to get this to work for things to function properly.

To make things easier:

  1. Uncompress the zip mentioned in the post above to a temporary location

  2. Copy the google-play-services_lib directory from the uncompressed zip to your project Android root directory

  3. Update your project.properties to include the library reference:

    android.library.reference.1=${CoronaEnterpriseDir}/Corona/android/lib/Corona android.library.reference.2=./google-play-services_lib

  4. Add the meta-data tag in your AndroidManifest.xml

    <meta-data android:name=“com.google.android.gms.version” android:value="@integer/google_play_services_version"/>

This is my project directory:

getten -- Corona -- android -- ios -- mac -- shared -- win32
  1. So I had inserted the meta-data tag in Android Manifest between application tags.

 

  1. Added ./google-play-services_lib as references path

 

  1. Where should I place the resource file? If I placed it in 

    /getten

I got this error:

./google-play-services\_lib resolve to a path with no project.properties file for project /Users/facv01/Documents/Fundoma/getten/android

If I placed it in 

/getten/android

I got this error:

Invalid file: /Users/facv01/Documents/Fundoma/getten/android/google-play-services\_lib/build.xml

But I can’t find the build.xml file that mentioned in the error.

Update:
 

According to this post, I cd to 

getten/Android/google-play-services\_lib

then set the getten/Android/google-play-services_lib/project.properties to:

target=android-16 android.library=true

and run:

android update project --path .

It generated build.xml file and proguard-project.txt

So I tried build again. But this time, with different error:

com.android.dex.DexException: Multiple dex files define Lcom/google/ads/AdRequest$ErrorCode;

@coronaent

I think you’re almost there.

(getten/android/google-play-services_lib is the correct place.)

The error you’re getting indicates you have two libraries with google ads code.

Can you post a list with the contents of your android/libs directory?

These are the files in my libs

libs --&nbsp;android-support-v4.jar --&nbsp;CoronaProvider.ads.admob.jar --&nbsp;CoronaProvider.analytics.flurry.jar --&nbsp;CoronaProvider.gameNetwork.google.jar --&nbsp;facebook.jar --&nbsp;FlurryAnalytics-4.1.0.jar --&nbsp;GoogleAdMobAdsSdk-6.3.1.jar

Try removing GoogleAdMobAdsSdk-6.3.1.jar

google-play-services_lib includes the AdMob library, so you should be able to remove the jar mentioned above.

After removed AdMob library, I can compile successfully. However, during runtime, it crashed with this error:

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/ads/InterstitialAd;

That’s a bit weird. I basically have the same setup and it works for me.

However, I’m not using Corona’s AdMob plugin. I’ve developed my own but it’s based on the same GooglePlayServices library.

I’ll have a look and see if I can find the issue with Corona’s plugin.

I had a look, but it’s not possible for me to find anything as I don’t use Corona’s plugins (I’d have to completely re-write my code to do the testing which I’m not prepared to do).

Maybe the only solution is to roll back all the steps above and only use Corona’s supplied jar files and skip the whole “linked library” solution.

That would mean:

  1. Remove the ./google-play-services_lib line from project.properties

  2. Copy Corona’s google-play-services.jar to your libs directory

  3. Add the GoogleAdMobAdsSdk-6.3.1.jar to your libs directory

Note:

Without linking the library as described in the previous posts above, you’ll most likely see “The Google Play services resources were not found.” messages pop up, but they don’t affect the use of the app. The app will not crash.

It may also be possible that the libraries in step 2 and 3 will cause a “multiple dex” error. (Hopefully not)

If that happens it’s a deadlock situation with no easy solution as I see it. It would mean the GameNetwork requires google-play-services.jar and AdMob requires the GoogleAdMobAds jar, but they can’t exist together because of duplicate symbols.

(this is one of the reasons I decided to build my own plugins, as I have full control over everything)

Hi,

Thanks for your suggestion. And you are right, I thought things can be easy by just putting in GoogleAdMobAds.jar & google-play-services.jar, but it got the multiple dex error… which end up me posting so much scream over here.

Corona, if you are seeing this, please take a look, and maybe separate them.

I wonder how Corona Pro handle that. Since both Google Play Game Services and Admob can coexists.

I think that they might have a custom google-play-services.jar with the AdMob code stripped out. 

If I remember correctly that’s what they used to have for Enterprise as well.

Try downloading the Enterprise plugins for build 2398. I believe the google-play-services.jar in the gameNetwork-google directory is the stripped down version which may work together with GoogleAdMobAdsSdk-6.3.1.jar.

Thanks for your help. I removed the resource files, and put in google-play-services.jar and GoogleAdMobSDK6.3.1.jar, it compiled successfully.

However, during runtime, it crash with this error:

Using Google Play games services requires a metadata tag with the name "com.google.android.gms.games.APP\_ID" in the application tag of the manifest for net.example.my

Followed by:

I/Ads &nbsp; &nbsp; (29303): adRequestUrlHtml: \<html\>\<head\>\<script src="http://media.admob.com/sdk-core-v40.js"\>\</script\>\<script\>AFMA\_getSdkConstants();AFMA\_buildAdURL({"hl":"en","oar":0,"carrier":"50212","u\_h":592,"gnt":13,"net":"wi","mv":"80300038.com.android.vending","u\_w":360,"app\_name":"1.android.net.example.my","format":"interstitial\_mb","js":"afma-sdk-a-v6.3.1","pt":1,"seq\_num":"1","u\_audio":3,"msid":"net.example.my","bas\_off":0,"preqs":0,"session\_id":"3290296689401168779","u\_sd":3,"ms":"eO9U21R780XNFL81QoZlShUY2ukZmjDo94bwFAlX3ZYU8iBUvNzVRFI072cu\_2IkkwSVW0ROhRbfs2MvLXIXPlNyybTGMFuGnbzPsOWDYr77SmsHCnHbDNDwFZ0MSpRRQ6mmAQ0nlHAJHo3zBRlLmK7QhKAwOFBb2EolnGWer-CvAMDa5aIq6QwuZv\_gywmUBenpldVRC3J\_n1glufN\_k4Cc6VLoJc38e97EtIZhMNDt3lnXimvqwLtcL16wiHavm2BANNB-gHj36zix4s4bLK9vnBfybZdmlv2HtchNImRZdXJDqq1toU33Ebe2P6Vj3ku5qyDw5iAIVy41-XQJng","isu":"D096414B30E270041E3AC931E3F468E6","slotname":"ca-app-pub-9053410537698440\/1004495815","ptime":0,"bas\_on":0});\</script\>\</head\>\<body\>\</body\>\</html\>

However, the real error that caused the crash is this:

D/AndroidRuntime(29303): Shutting down VM E/AndroidRuntime(29303): FATAL EXCEPTION: main E/AndroidRuntime(29303): Process: net.facv.number10, PID: 29303 E/AndroidRuntime(29303): java.lang.IllegalStateException: A fatal developer error has occurred. Check the logs for further information. E/AndroidRuntime(29303): at com.google.android.gms.internal.u$f.a(Unknown Source) E/AndroidRuntime(29303): at com.google.android.gms.internal.u$f.a(Unknown Source) E/AndroidRuntime(29303): at com.google.android.gms.internal.u$b.A(Unknown Source) E/AndroidRuntime(29303): at com.google.android.gms.internal.u$a.handleMessage(Unknown Source) E/AndroidRuntime(29303): at android.os.Handler.dispatchMessage(Handler.java:102) E/AndroidRuntime(29303): at android.os.Looper.loop(Looper.java:135) E/AndroidRuntime(29303): at android.app.ActivityThread.main(ActivityThread.java:5221) E/AndroidRuntime(29303): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime(29303): at java.lang.reflect.Method.invoke(Method.java:372) E/AndroidRuntime(29303): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899) E/AndroidRuntime(29303): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)

Have you set up the meta-data tag in your AndroidManifest.xml ?

\<meta-data android:name="com.google.android.gms.games.APP\_ID" android:value="@string/app\_id" /\>

You’ll also need the appropriate configuration in your ids.xml located in the android/res/values directory.

BTW.

You can get the contents of your ids.xml from the Google Developer Console.

After you’ve configured all your leaderboards and achievements you can go to the “Leaderboards” or “Achievements” section of your Game Services setup for your app. You’ll see a “Get resources” link at the bottom of each list that will open a popup with the contents necessary for your ids.xml.