Google play services cannot find its resources

I can’t describe how happy am I now.

It works!!! Thanks inegmar! Take my soul to be your slave!

Now I have other error: 

onSignInFailed()

But I think I can figure it out from now on!!!

Thanks Thanks Thanks Thanks Thanks Thanks Thanks Thanks!!!

Great  :smiley: !

hello guys i am having difficulties implementing admob into my app please help!

Start here:  http://coronalabs.com/blog/2014/07/15/tutorial-implementing-admob-v2/

Rob

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.