Android API level 30 is here in 3651

UPDATE: Please use 3651

since 3650 had issues with Google License Checking

Android API level 30

Android introduced breaking change in Android 11 (api 30) which we are now targeting). Major change affecting system.canOpenURL() call. It now requires to list all schemes you’ll use in the build.setting (AndroidManifest.xml).
Hovewer, due to quicks with Android implementation, even listing scheme sometimes gives the wrong result (for example, if user chose to always use the App to open links, the query for this URL would return false if no special <query> element is added. Confusing, indeed.
Current recommendation is use openURL instead o canOpenURL. It will always return reliable result, if URL was handled.
For example, consider following code:

	local mapURL = ",+Solar2D!@" .. currentLatitude .. "," .. currentLongitude
	if system.canOpenURL( mapURL ) then
		-- Show location on map
		system.openURL( mapURL )
		native.showAlert( "Alert", "No browser found to show location on map!", { "OK" } )

Is better written as

	local mapURL = ",+Solar2D!@" .. currentLatitude .. "," .. currentLongitude
	if not system.openURL( mapURL ) then
		native.showAlert( "Alert", "No browser found to show location on map!", { "OK" } )

Latter code would work realiably without need to add any manifest entries via build.settings.

Example entries

If you do want to query if some app can handle URL, here are some code examples for your build.settings:

settings =
    android =
        manifestChildElements = 
                <package android:name="com.facebook.katana" />
                <package android:name="" />
                    <action android:name="android.intent.action.VIEW" />
                    <data android:scheme="http" />

Read more about following change at the android developers blog.

Download first release:


@vlads, although new builds require api 30 now, UPDATES don’t require it until November. Does this build still support api 29, or must I use 3649 until November?

@vlads S2D version 3651 (and 3650) have now broken my app for Android builds. Here is all the log shows:

^[[A08-19 11:22:19.886 22272 23300 V Corona : > Class.forName: network.LuaLoader
08-19 11:22:19.886 22272 23300 V Corona : < Class.forName: network.LuaLoader
08-19 11:22:19.887 22272 23300 V Corona : Loading via reflection: network.LuaLoader
08-19 11:22:19.897 22272 23300 I Corona : Platform: SM-A115M / ARM Neon / 11 / Adreno ™ 506 / OpenGL ES 3.2 V@0502.0 (GIT@8fc5070, I2b41315a24, 1611346138) (Date:01/22/21) / 2021.3651 / English | US | en_US | en
08-19 11:22:19.925 22272 23300 V Corona : > Class.forName:
08-19 11:22:19.926 22272 23300 V Corona : < Class.forName:
08-19 11:22:19.926 22272 23300 V Corona : Loading via reflection:
08-19 11:22:19.957 22272 23300 V Corona : > Class.forName: licensing.LuaLoader
08-19 11:22:19.962 22272 23300 V Corona : > Class.forName:
08-19 11:22:19.963 22272 23300 V Corona : < Class.forName:
08-19 11:22:19.967 22272 23300 V Corona : Loading via reflection:
08-19 11:22:20.496 22272 23300 I Corona : [Lua::RuntimeDispatchEvent()] WARNING: This function is deprecated. Use Lua::DispatchRuntimeEvent() instead.

Version 3649 works fine. Any suggestions about how to fix this?

there has to be more to the logs than this. So far so good. What else do you see?

What do you see on screen when this is happening?

Thank you for reporting this. New build is building. It would come online and this issue should be fixed in next build.
Sorry for inconvenience.

1 Like

Looks like notifications.v2 broke with this update, and later versions too, on Android devices. When trying to get the device token the following error occurs and show when debugging in Android Studio:

I/Corona: ERROR: Runtime error
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/firebase/iid/FirebaseInstanceId;
Java Stack Trace:
com.naef.jnlua.LuaState.lua_pcall(Native Method)
at getDeviceToken (External Function)
at ? (?:0)
at ? (?:0)
at (Unknown Function) (?:0)
at ? (?:0)
at (Unknown Function) (?:0)
create error file

Android 10+ api 30 also broke native webview especially with removal of cleartext allowance. Local html files in temp or document directory no longer loading in app via native webview, get ERR_ACCESS_DENIED. @vlads can you take a look at that as well please. I don’t think can revert back as clear text is no longer allowed by google.

This link has some guide on what change has to be made to that api in 30 for it to work:

1 Like

Thanks for letting me know. I’ll fix it later today

As a workaround, try calling

webview:setNativeProperty("setAllowFileAccess", true)

right after creating a webview (before any load occurred).


EDIT: changed . to :

Thanks Vlad cheers

Edit: Worked perfectly on device, thanks

Another issue I noticed which wasn’t there on earlier builds is that on windows simulator, any network.request to an api made on windows 7 is returning an error. Not sure if this is due to my installation but thought I’d mention it here. On android devices the call goes through fine.

error -1 Certificate required

Additionally, I have a sizable app build around 1.2gb which I used to upload via expansion files, 15mb apk and 1.2gb app obb file. With the new solar2d build, the output app bundle on upload is giving the following error on google play store:
“Your Android App Bundle has an invalid signature. Upload again with a valid signature.”
The apk is uploading just fine.

Thank you for reporting this.

Nice, but I download a pdf file from web into a local directory beacuse the url need authentication : url, “GET”, downloadpdf_networkListener,params, “worksheet.pdf”, system.DocumentsDirectory, 0, 0 )

after in the “downloadpdf_networkListener” I would like to open it :

local wasOpened = system.openURL(system.pathForFile(“worksheet.pdf”,system.DocumentsDirectory))

It not works, beacuse Android 11 occurs permision error for this local directory. How can I solve this ?