Google Play services resources not found

OSX 10.9.2

Corona SDK: 2014.2234 (Enterprise)

I’ve implemented Google Play services in my app to get Leaderboard functionality and everything seems OK.

The app can log in to Google Play, I can post high-scores to the leaderboards and everything looks OK to the user. 

HOWEVER! Every time I start my app I get the following warnings in logcat:

W/dalvikvm(29042): VFY: unable to resolve static field 2477 (common_google_play_services_install_title) in Lcom/google/android/gms/R$string;

D/dalvikvm(29042): VFY: replacing opcode 0x60 at 0x0041

W/dalvikvm(29042): VFY: unable to resolve static field 2473 (common_google_play_services_enable_title) in Lcom/google/android/gms/R$string;

D/dalvikvm(29042): VFY: replacing opcode 0x60 at 0x004c

W/dalvikvm(29042): VFY: unable to resolve static field 2483 (common_google_play_services_update_title) in Lcom/google/android/gms/R$string;

D/dalvikvm(29042): VFY: replacing opcode 0x60 at 0x0057

W/dalvikvm(29042): VFY: unable to resolve static field 2480 (common_google_play_services_unsupported_title) in Lcom/google/android/gms/R$string;

D/dalvikvm(29042): VFY: replacing opcode 0x60 at 0x0069

W/dalvikvm(29042): VFY: unable to resolve static field 2474 (common_google_play_services_install_button) in Lcom/google/android/gms/R$string;

D/dalvikvm(29042): VFY: replacing opcode 0x60 at 0x0009

W/dalvikvm(29042): VFY: unable to resolve static field 2471 (common_google_play_services_enable_button) in Lcom/google/android/gms/R$string;

D/dalvikvm(29042): VFY: replacing opcode 0x60 at 0x0010

W/dalvikvm(29042): VFY: unable to resolve static field 2481 (common_google_play_services_update_button) in Lcom/google/android/gms/R$string;

D/dalvikvm(29042): VFY: replacing opcode 0x60 at 0x0017

W/dalvikvm(29042): VFY: unable to resolve static field 2478 (common_google_play_services_unknown_issue) in Lcom/google/android/gms/R$string;

D/dalvikvm(29042): VFY: replacing opcode 0x60 at 0x0004

W/dalvikvm(29042): VFY: unable to resolve static field 2478 (common_google_play_services_unknown_issue) in Lcom/google/android/gms/R$string;

D/dalvikvm(29042): VFY: replacing opcode 0x60 at 0x000c

I/dalvikvm(29042): DexOpt: unable to optimize static field ref 0x09ac at 0x18 in Lcom/google/android/gms/common/GooglePlayServicesUtil;.b

I/dalvikvm(29042): DexOpt: unable to optimize static field ref 0x09ab at 0x38 in Lcom/google/android/gms/common/GooglePlayServicesUtil;.b

I/dalvikvm(29042): DexOpt: unable to optimize static field ref 0x09a8 at 0x3f in Lcom/google/android/gms/common/GooglePlayServicesUtil;.b

I/dalvikvm(29042): DexOpt: unable to optimize static field ref 0x09b2 at 0x46 in Lcom/google/android/gms/common/GooglePlayServicesUtil;.b

I/dalvikvm(29042): DexOpt: unable to optimize static field ref 0x09af at 0x66 in Lcom/google/android/gms/common/GooglePlayServicesUtil;.b

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

I’ve tried copying the resource strings from the Google Play Services lib project to the /res folder of my app, but it doesn’t help.

Any help to shed light on this would be greatly appreciated.

You have to reference it as a library.  If you look at the Enterprise/Samples/IncludeAllFeatures/android/project.properties file, you can see where we are doing this for Facebook.  You just need to point it to your GPGS library.

Thanks, I got one step further.

However now I’m getting the following error when compiling:

[dx] UNEXPECTED TOP-LEVEL EXCEPTION:

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

After googling around it seems like the latest Google Play services library includes the Admob SDK.

Since I’m using Admob, I had the GoogleAdMobAdsSdk-6.3.1.jar file in my /libs (from the Enterprise plugins folder).

After removing the Admob jar file the compiling was successful, however I’m not sure if Admob still works.

I’ll do some testing and report back.

OK, That didn’t work. Neither Google Play Services nor Admob were working.

What I ended up doing was to make my own google-play-services_lib.

Not sure if this is what’s necessary, but it looks like it works… and the error messages I previously got are gone.

  1. I copied over the official google-play-services_lib to my project in its own top-level directory

  2. Removed the /assets /bin /gen directories (from my own project and the copied lib)

  3. Replaced the google-play-services.jar file in the copied lib with the version from Enterprise plugins

  4. Put back GoogleAdMobAdsSdk-6.3.1.jar from Enterprise plugins in my project’s /libs directory

  5. Copied google-play-services.jar (Enterprise plugin version) to my project’s /libs folder (it didn’t sign-in to Google without this step)

  6. Verified my project.properties:

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

  7. Verified the google-play-services_lib project.properties:

    target=android-16 android.library=true

Now, Admob and the Google Play Leaderboards are working as expected, and I don’t get any of the warnings that I saw before.

I’ll be doing further testing, but at the moment all is well.

You have to reference it as a library.  If you look at the Enterprise/Samples/IncludeAllFeatures/android/project.properties file, you can see where we are doing this for Facebook.  You just need to point it to your GPGS library.

Thanks, I got one step further.

However now I’m getting the following error when compiling:

[dx] UNEXPECTED TOP-LEVEL EXCEPTION:

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

After googling around it seems like the latest Google Play services library includes the Admob SDK.

Since I’m using Admob, I had the GoogleAdMobAdsSdk-6.3.1.jar file in my /libs (from the Enterprise plugins folder).

After removing the Admob jar file the compiling was successful, however I’m not sure if Admob still works.

I’ll do some testing and report back.

OK, That didn’t work. Neither Google Play Services nor Admob were working.

What I ended up doing was to make my own google-play-services_lib.

Not sure if this is what’s necessary, but it looks like it works… and the error messages I previously got are gone.

  1. I copied over the official google-play-services_lib to my project in its own top-level directory

  2. Removed the /assets /bin /gen directories (from my own project and the copied lib)

  3. Replaced the google-play-services.jar file in the copied lib with the version from Enterprise plugins

  4. Put back GoogleAdMobAdsSdk-6.3.1.jar from Enterprise plugins in my project’s /libs directory

  5. Copied google-play-services.jar (Enterprise plugin version) to my project’s /libs folder (it didn’t sign-in to Google without this step)

  6. Verified my project.properties:

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

  7. Verified the google-play-services_lib project.properties:

    target=android-16 android.library=true

Now, Admob and the Google Play Leaderboards are working as expected, and I don’t get any of the warnings that I saw before.

I’ll be doing further testing, but at the moment all is well.

Hi ingemar, sorry for bringing this up. This is a few months old, however, I am facing the exact same problem as you.

I implemented Google Admob v2, work like a charm.

Now I wanted to implement Google Play Game Services. Naively thought that I can just copy CoronaProvider.gameNetwork.google.jar and google-play-services.jar into project>android>lib to make it work. 

However, i got the same issue as you:

[dx] UNEXPECTED TOP-LEVEL EXCEPTION: [dx] com.android.dex.DexException: Multiple dex files define Lcom/google/ads/AdRequest$ErrorCode;

So I followed your 7 steps instruction in your last post, copied the lib from your another thread into project>android. During building, I got this error:

/users/facv01/documents/coding/android/sdk/tools/ant/build.xml:601: Invalid file: /Users/facv01/Documents/Fundoma/getten/android/google-play-services\_lib/build.xml

Looking into project/android/google-play-services_lib, I am not able to see build.xml, even after showing hidden file.

Any steps not documented?

Thanks.

Update:

For testing, I removed GoogleAdMobAdsSdk-6.3.1.jar from android/lib folder, and added these to Android manifest:

\<meta-data android:name="com.google.android.gms.version" android:value="4242000"/\> \<meta-data android:name="com.google.android.gms.games.APP\_ID" android:value="\ 4087XXXXXXXX" /\>

Now the Google Play Services seems working, where it can pop up an email selection list for me.

The problem now, is AdMob. If I call ad.show(), it will crash, with this error message:

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

Help still needed. Million thanks.

First (from the other thread) you’ll need to get the build process to properly find google-play-services_lib.

You should also remove any google-play-services.jar from your libs directory.

I’ve written my own plugins for Admob, so I don’t use Corona’s plugins anymore, however once the build process can find your google-play-services_lib you should most likely remove GoogleAdMobAdsSdk-6.3.1.jar as the AdMob code is included in the other library. Just make sure you have the CoronaProvider.ads.admob.jar in your libs directory.

Hi ingemar, sorry for bringing this up. This is a few months old, however, I am facing the exact same problem as you.

I implemented Google Admob v2, work like a charm.

Now I wanted to implement Google Play Game Services. Naively thought that I can just copy CoronaProvider.gameNetwork.google.jar and google-play-services.jar into project>android>lib to make it work. 

However, i got the same issue as you:

[dx] UNEXPECTED TOP-LEVEL EXCEPTION: [dx] com.android.dex.DexException: Multiple dex files define Lcom/google/ads/AdRequest$ErrorCode;

So I followed your 7 steps instruction in your last post, copied the lib from your another thread into project>android. During building, I got this error:

/users/facv01/documents/coding/android/sdk/tools/ant/build.xml:601: Invalid file: /Users/facv01/Documents/Fundoma/getten/android/google-play-services\_lib/build.xml

Looking into project/android/google-play-services_lib, I am not able to see build.xml, even after showing hidden file.

Any steps not documented?

Thanks.

Update:

For testing, I removed GoogleAdMobAdsSdk-6.3.1.jar from android/lib folder, and added these to Android manifest:

\<meta-data android:name="com.google.android.gms.version" android:value="4242000"/\> \<meta-data android:name="com.google.android.gms.games.APP\_ID" android:value="\ 4087XXXXXXXX" /\>

Now the Google Play Services seems working, where it can pop up an email selection list for me.

The problem now, is AdMob. If I call ad.show(), it will crash, with this error message:

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

Help still needed. Million thanks.

First (from the other thread) you’ll need to get the build process to properly find google-play-services_lib.

You should also remove any google-play-services.jar from your libs directory.

I’ve written my own plugins for Admob, so I don’t use Corona’s plugins anymore, however once the build process can find your google-play-services_lib you should most likely remove GoogleAdMobAdsSdk-6.3.1.jar as the AdMob code is included in the other library. Just make sure you have the CoronaProvider.ads.admob.jar in your libs directory.