OneSignal Issue for Android

It was fine 12 hours ago.  Only saw this error now.

05-17 09:17:11.336: E/GooglePlayServicesUtil(13503): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.

05-17 09:17:11.344: E/OneSignal(13503): Could not register with GCM due to an error with the AndroidManifest.xml file or with ‘Google Play services’.

05-17 09:17:11.344: E/OneSignal(13503): java.lang.IllegalStateException: The meta-data tag in your app’s AndroidManifest.xml does not have the right value.  Expected 4242000 but found 8487000.  You must have the following declaration within the <application> element:     <meta-data android:name=“com.google.android.gms.version” android:value="@integer/google_play_services_version" />

05-17 09:17:11.344: E/OneSignal(13503): at com.google.android.gms.common.GooglePlayServicesUtil.n(Unknown Source)

05-17 09:17:11.344: E/OneSignal(13503): at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)

05-17 09:17:11.344: E/OneSignal(13503): at com.onesignal.PushRegistratorGPS.checkPlayServices(PushRegistratorGPS.java:83)

05-17 09:17:11.344: E/OneSignal(13503): at com.onesignal.PushRegistratorGPS.registerForPush(PushRegistratorGPS.java:59)

05-17 09:17:11.344: E/OneSignal(13503): at com.onesignal.OneSignal.startRegistrationOrOnSession(OneSignal.java:334)

05-17 09:17:11.344: E/OneSignal(13503): at com.onesignal.OneSignal.init(OneSignal.java:311)

05-17 09:17:11.344: E/OneSignal(13503): at OneSignal.LuaLoader$InitFunction.invoke(LuaLoader.java:110)

05-17 09:17:11.344: E/OneSignal(13503): at com.ansca.corona.JavaToNativeShim.nativeResize(Native Method)

05-17 09:17:11.344: E/OneSignal(13503): at com.ansca.corona.JavaToNativeShim.resize(JavaToNativeShim.java:381)

05-17 09:17:11.344: E/OneSignal(13503): at com.ansca.corona.graphics.opengl.CoronaGLSurfaceView$CoronaRenderer.onSurfaceChanged(CoronaGLSurfaceView.java:378)

05-17 09:17:11.344: E/OneSignal(13503): at com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1612)

05-17 09:17:11.344: E/OneSignal(13503): at com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1378)

We haven’t changed anything with our OneSignal plugin recently. Did you change your plugins or your Corona build version?

Can you let us know the exact Corona build version you’re using and list all lines in your plugins = {...} in your build.settings?

Corona Version: 2016.2879 (2016.5.13)

 plugins = { ["plugin.OneSignal"] = { publisherId = "com.onesignal", }, ["plugin.google.play.services"] = { publisherId = "com.coronalabs", }, ["CoronaProvider.native.popup.activity"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=true, ["iphone-sim"]=true }, }, ["CoronaProvider.native.popup.social"] = { publisherId = "com.coronalabs" }, ["plugin.googleAnalytics"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=true, android=true, ["iphone-sim"]=true} }, ["plugin.fbAudienceNetwork"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=true, android=true, ["iphone-sim"]=true}, }, }

I am not able to reproduce the issue with the exact same plugins and Corona Build number. Can you try your build again? Something could’ve changed on Corona’s server since then.

It still crashed.

05-18 06:16:44.448: E/GooglePlayServicesUtil(10309): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included. 05-18 06:16:44.452: E/OneSignal(10309): Could not register with GCM due to an error with the AndroidManifest.xml file or with 'Google Play services'. 05-18 06:16:44.452: E/OneSignal(10309): java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 4242000 but found 8487000. You must have the following declaration within the \<application\> element: \<meta-data android:name="com.google.android.gms.version" android:value="@integer/google\_play\_services\_version" /\> 05-18 06:16:44.452: E/OneSignal(10309): at com.google.android.gms.common.GooglePlayServicesUtil.n(Unknown Source) 05-18 06:16:44.452: E/OneSignal(10309): at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source) 05-18 06:16:44.452: E/OneSignal(10309): at com.onesignal.PushRegistratorGPS.checkPlayServices(PushRegistratorGPS.java:83) 05-18 06:16:44.452: E/OneSignal(10309): at com.onesignal.PushRegistratorGPS.registerForPush(PushRegistratorGPS.java:59) 05-18 06:16:44.452: E/OneSignal(10309): at com.onesignal.OneSignal.startRegistrationOrOnSession(OneSignal.java:334) 05-18 06:16:44.452: E/OneSignal(10309): at com.onesignal.OneSignal.init(OneSignal.java:311) 05-18 06:16:44.452: E/OneSignal(10309): at OneSignal.LuaLoader$InitFunction.invoke(LuaLoader.java:110) 05-18 06:16:44.452: E/OneSignal(10309): at com.ansca.corona.JavaToNativeShim.nativeResize(Native Method) 05-18 06:16:44.452: E/OneSignal(10309): at com.ansca.corona.JavaToNativeShim.resize(JavaToNativeShim.java:381) 05-18 06:16:44.452: E/OneSignal(10309): at com.ansca.corona.graphics.opengl.CoronaGLSurfaceView$CoronaRenderer.onSurfaceChanged(CoronaGLSurfaceView.java:378) 05-18 06:16:44.452: E/OneSignal(10309): at com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1612) 05-18 06:16:44.452: E/OneSignal(10309): at com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1378) 05-18 06:16:44.466: E/GooglePlayServicesUtil(10309): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included. 05-18 06:16:44.602: E/GooglePlayServicesUtil(10309): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included. 05-18 06:16:48.610: E/AndroidRuntime(10309): FATAL EXCEPTION: main 05-18 06:16:48.610: E/AndroidRuntime(10309): Process: com.hosay.traffic, PID: 10309 05-18 06:16:48.610: E/AndroidRuntime(10309): java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 4242000 but found 8487000. You must have the following declaration within the \<application\> element: \<meta-data android:name="com.google.android.gms.version" android:value="@integer/google\_play\_services\_version" /\> 05-18 06:16:48.610: E/AndroidRuntime(10309): at com.google.android.gms.common.GooglePlayServicesUtil.n(Unknown Source) 05-18 06:16:48.610: E/AndroidRuntime(10309): at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source) 05-18 06:16:48.610: E/AndroidRuntime(10309): at com.google.android.gms.internal.u.a(Unknown Source) 05-18 06:16:48.610: E/AndroidRuntime(10309): at com.google.android.gms.internal.ag.U(Unknown Source) 05-18 06:16:48.610: E/AndroidRuntime(10309): at com.google.android.gms.internal.ag.a(Unknown Source) 05-18 06:16:48.610: E/AndroidRuntime(10309): at com.google.android.gms.ads.AdView.loadAd(Unknown Source) 05-18 06:16:48.610: E/AndroidRuntime(10309): at CoronaProvider.ads.admob.AdMobAd$1.run(AdMobAd.java:138) 05-18 06:16:48.610: E/AndroidRuntime(10309): at android.os.Handler.handleCallback(Handler.java:739) 05-18 06:16:48.610: E/AndroidRuntime(10309): at android.os.Handler.dispatchMessage(Handler.java:95) 05-18 06:16:48.610: E/AndroidRuntime(10309): at android.os.Looper.loop(Looper.java:135) 05-18 06:16:48.610: E/AndroidRuntime(10309): at android.app.ActivityThread.main(ActivityThread.java:5343) 05-18 06:16:48.610: E/AndroidRuntime(10309): at java.lang.reflect.Method.invoke(Native Method) 05-18 06:16:48.610: E/AndroidRuntime(10309): at java.lang.reflect.Method.invoke(Method.java:372) 05-18 06:16:48.610: E/AndroidRuntime(10309): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905) 05-18 06:16:48.610: E/AndroidRuntime(10309): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)

Do you have any other settings in your project that could change the AndroidManifest.xml? Could you send the full build.settings file to OneSignal support?

I have emailed you my build.settings file.

Any updates on this?  Thanks.  

i think there is a conflict with the Admob plugin and OneSignal plugin.  Already emailed you a test project for you to check.

Sorry about the delay, I was not initially able to reproduce the issue as I had Amazon set as the “Target App Store” from a previous test.

The conflict is between plugin.googleAnalytics and plugin.google.play.services. It seems plugin.googleAnalytics includes its own different copy of the Google Play services library so you don’t need plugin.google.play.services.

I just tried that and now my admob cannot work due to an error that says CoronaProvider.ads.admob not found.

I see, ‘plugin.google.play.services’ also contains Admob. OneSignal just depends on Google Play services (it does not include it) so it isn’t part of the conflicts you’re seeing.

Do you have issues with just ‘plugin.googleAnalytics’ and ‘plugin.google.play.services’ in the same project and using Admod in your code? There is a discussion about this issue below.

https://forums.coronalabs.com/topic/62369-google-analytics-error/

No issue with just admob and google analytics.

Your right! I was able to reproduce the issue. However the root of the issue is due to how Corona’s server handles merging of AndroidManifest.xml entries between plugins.

The order of the following 2 tags changes based on the plugins used which produces very inconsistent results.

\<meta-data android:name="com.google.android.gms.version" android:value="8487000"/\> \<meta-data android:name="com.google.android.gms.version" android:value="4242000"/\>

plugin.googleAnalytics contains Google Play services 8.4 and plugin.google.play.services contains a 4.2 version. It seems the 8.4 version overrides the 4.2 versions Java classes but not it’s version meta-data entries.

@Brent Sorrentino and @Rob Miracle Is there a change you can make on your end to change how manifest entries are merged?

Engineering is working on a solution to this. So for the moment, AdMob and Google Analytics won’t work together. No ETA on fixing it. It’s a really complex issue.

Rob

Thanks Rob, let me know if you want me to look into anything.

Strangely for my case, Admob and Google Analytics can work together but not with OneSignal plugin.

This issue seems to be around for more than a month but I am encountering it just a few days ago.  Kind of weird.

This kind of weird.  If I were to set false for Android in the Google Analytics plugin as follow, the app will still crash.

 ["plugin.googleAnalytics"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=true, android=false, ["iphone-sim"] = true, }, },

It works only if i remove the entire portion.

Did you remove the Google Analytics plugin from the plugin list in build.setting? Changing the plugin list is the only thing that will affect the following error.

java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value.

The root of the issue is how Coron’s server handles merging of AndroidManifest.xml entries between plugins. The “Google Play services” (com.google.android.gms) library is required by many Android plugins.

In this specific case plugin.googleAnalytics and plugin.google.play.services both include diferrent versions of “Google Play services”. Due to the complexity of the issue adding more even unrelated plugins effects Coron’s ordering logic of manifest entries. The order of the meta-data tags noted above is important as Android is only using the last entry.