android API 29 issue

Google just changed the rule so that since the start of August so that your app must be API 29 or greater. Solar2D just added compatibility with that – that all seems to be great.

However, since updating from build 3600, I cannot get my game to build on my android device.

The first error I got was:

/private/var/folders/2q/6xnd00dn6jb9sqnykyrqk7pc0000gn/T/CLtmpMOEMyC/template/app/src/main/AndroidManifest.xml Error:
                    	uses-sdk:minSdkVersion 15 cannot be smaller than version 16 declared in library [com.google.android.gms:play-services-ads:19.3.0] /Users/briann/.gradle/caches/transforms-2/files-2.1/66469a18cab037909539f040355bc192/jetified-play-services-ads-19.3.0/AndroidManifest.xml as the library might be using APIs not available in 15
                    	Suggestion: use a compatible library with a minSdk of at most 15,
                    		or increase this project's minSdk version to at least 16,
                    		or use tools:overrideLibrary="com.google.android.gms.ads.impl" to force usage (may lead to runtime failures)

I could fix this by editing build.settings:

android {
        minSdkVersion = "16",
}

Now I can build the app, but when I start it on the device, I get a Runtime error:

HTCONE: ERROR: Runtime error
Aug 02 19:43:26.259 HTCONE: java.lang.NoClassDefFoundError: com.google.android.gms.common.GoogleApiAvailability
                    HTCONE: Java Stack Trace:
                    HTCONE: 	shared.google.play.services.base.GooglePlayServicesAvailabilityHandler.handleGooglePlayServicesAvailability(GooglePlayServicesAvailabilityHandler.java:281)
                    HTCONE: 	shared.google.play.services.base.LuaLoader$HandleGooglePlayServicesAvailabilityWrapper.invoke(LuaLoader.java:159)
                    HTCONE: 	com.ansca.corona.JavaToNativeShim.nativeResize(Native Method)
                    HTCONE: 	com.ansca.corona.JavaToNativeShim.resize(JavaToNativeShim.java:403)
                    HTCONE: 	com.ansca.corona.graphics.opengl.CoronaGLSurfaceView$CoronaRenderer.onSurfaceChanged(CoronaGLSurfaceView.java:391)
                    HTCONE: 	com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1614)
                    HTCONE: 	com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1380)
                    H
Aug 02 19:43:26.260 TCONE: stack traceback:
                    HTCONE: 	[C]: in function 'handleGooglePlayServicesAvailability'
                    HTCONE: 	?: in main chunk
                    HTCONE: This application failed to load and execute main.lua

It seems like a brand new issue due to Google Play’s requiring API 29, so I assume other people will hit the same problem soon.

I don’t really know what’s going on here, even if it’s a Solar2D issue, or if my device is too old now, so any advice is appreciated!

1 Like

To fix it in the meantime while Vlad fixes it create a “corona.gradle” in the AndroidResources.

Add the following lines:
dependencies {
implementation ‘com.google.android.gms:play-services-auth:17.0.0’
}

1 Like

Do you mean create that file inside the AndroidResources folder?

1 Like

Oh… Now, are “Android 4.0.3 (API 15)” not available?

Thanks agramonte, I haven’t gotten that to work yet (I haven’t even been using an AndroidResources folder for this older project so I need to work that out) but I understand the problem better now. It sounds like it may get rolled into the next Solar2d release too.

yes. This is what mine looks like and it builds:

2 Likes

I have not built anything for Android 15 in a while, I am fairly sure you can make it work. Just not sure how many plugins would actually work with Android 15. I mostly keep to Android 16 for Amazon and Android 19 for Google.

This solution didn’t work for me :frowning:

Ok, thanks a lot!

thanks agramonte!!

I just released my App to Google and Apple Store with the latest build. (Solar2D 2020.3607)

1 Like

Unfortunately, solutions in this topic don’t help. My version of the problem is quite similar, but Runtime error after building with the 16th minSdkVersion is different:

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/GoogleApiAvailability;

It’s definitely caused by admob plugin, because only it requires editing build.settings for a chance to build the app.

Please try again. Issue should be solved now.

1 Like

I’ve just tried to build with the latest build, didn’t work.

I got a similar error when I enable the OneSignal plugin:

/private/var/folders/4j/m59mm3h17ml6d5mxx92l8wcr0000gn/T/CLtmpMXtccO/template/app/src/main/AndroidManifest.xml Error:
                        	uses-sdk:minSdkVersion 15 cannot be smaller than version 16 declared in library [com.google.firebase:firebase-messaging:20.2.3] /Users/chema/.gradle/caches/transforms-2/files-2.1/25a4ee619d35555f682164da12d8bc69/jetified-firebase-messaging-20.2.3/AndroidManifest.xml as the library might be using APIs not available in 15
                        	Suggestion: use a compatible library with a minSdk of at most 15,
                        		or increase this project's minSdk version to at least 16,
                        		or use tools:overrideLibrary="com.google.firebase.messaging" to force usage (may lead to runtime failures)

If I edit the build.settings with this…

android {
        minSdkVersion = "16",
}

…the app works but not the OneSignal plugin:

I need this plugin working because my clients need it.

I have the same problem with OneSignal. While googling for solution found this: https://github.com/OneSignal/OneSignal-Android-SDK/issues/1018. Maybe it should help to localize problem. Though I was unable to get version of OneSignal SDK used in Solar.

Hopefully Vlad fixes it because I’m very dependent on OneSignal.

You may want to check OneSignal’s Solar2D repository. If those two are related, it may be a good idea to create an issue on that repository.

The new version (3609) no longer has a RuntimeError.
Note, I still needed to add to build.settings:

android {
        minSdkVersion = "16",
}

Thanks!

I am trying to update my game in Play Store and got this warnings: (with Solar2D 2020.3609):

I still get the below error:
> Task :App:checkReleaseDuplicateClasses FAILED

                FAILURE: Build failed with an exception.
                
                * What went wrong:
                Execution failed for task ':App:checkReleaseDuplicateClasses'.
                > 1 exception was raised by workers:
                  java.lang.RuntimeException: Duplicate class com.google.android.gms.internal.measurement.zzbv found in modules jetified-play-services-measurement-16.5.0-runtime.jar (com.google.android.gms:play-services-measurement:16.5.0) and play-services-measurement-base-17.1.0-runtime.jar (com.google.android.gms:play-services-measurement-base:17.1.0)
                  Duplicate class com.google.android.gms.internal.measurement.zzbw found in modules jetified-play-services-measurement-16.5.0-runtime.jar (com.google.android.gms:play-services-measurement:16.5.0) and play-services-measurement-base-17.1.0-runtime.jar (com.google.android.gms:play-services-measurement-base:17.1.0)
                  Duplicate class com.google.android.gms.internal.measurement.zzdf found in modules jetified-play-services-measurement-impl-16.5.0-runtime.jar (com.google.android.gms:play-services-measurement-impl:16.5.0) and play-services-measurement-base-17.1.0-runtime.jar (com.google.android.gms:play-services-measurement-base:17.1.0)
                  Duplicate class com.google.android.gms.internal.measurement.zzdg found in modules jetified-play-services-measurement-impl-16.5.0-runtime.jar (com.google.android.gms:play-services-measurement-impl:16.5.0) and play-services-measurement-base-17.1.0-runtime.jar (com.google.android.gms:play-services-measurement-base:17.1.0)

It seems the conflict is because of Appodeal Admob. When I disabled Appodeal Admob, it was built without errors.

I just released my App to Google and Apple Store with the latest build.