Skip to main content

The following code in your Android SDK (located in Footer.kt) crashes on some devices:

 

                uriHandler.openUriOrElse(it.toString()) {
val msg = context.getString(R.string.no_browser_cannot_open_link)
Toast.makeText(context, msg, Toast.LENGTH_SHORT).show()
Logger.w(msg)
}

 

 

Here is the stacktrace

Fatal Exception: java.lang.IllegalArgumentException

Can't open https://mywebsite.com/terms_of_use.html.

androidx.compose.ui.platform.AndroidUriHandler.openUri (AndroidUriHandler.android.kt:36)

com.revenuecat.purchases.ui.revenuecatui.extensions.UriHandlerExtensionsKt.openUriOrElse (UriHandlerExtensions.kt:12)

com.revenuecat.purchases.ui.revenuecatui.composables.FooterKt$Footer$3$2$1.invoke (Footer.kt:147)

com.revenuecat.purchases.ui.revenuecatui.composables.FooterKt$Footer$3$2$1.invoke (Footer.kt:141)

com.revenuecat.purchases.ui.revenuecatui.composables.FooterKt$Button$1$1$1.invoke (Footer.kt:213)

com.revenuecat.purchases.ui.revenuecatui.composables.FooterKt$Button$1$1$1.invoke (Footer.kt:213)

___________________________________

Caused by android.content.ActivityNotFoundException

No Activity found to handle Intent { act=android.intent.action.VIEW dat=https://mywebsite.com/... }

android.app.Instrumentation.checkStartActivityResult (Instrumentation.java:2080)

androidx.compose.ui.platform.AndroidUriHandler.openUri (AndroidUriHandler.android.kt:34)

com.revenuecat.purchases.ui.revenuecatui.extensions.UriHandlerExtensionsKt.openUriOrElse (UriHandlerExtensions.kt:12)

 

dependency versions:

implementation("com.revenuecat.purchases:purchases:8.7.2")implementation("com.revenuecat.purchases:purchases-ui:8.7.1")

 

Crashed device version

OS version: android11

Model: Galaxy A20

 

Is there any way to add some fallback mechanism without waiting for the fix from your side? Your current code catches “ActivityNotFoundException” but the openUri throws IllegalArgumentException

Hey @simplesoft ,

 

Thanks for reaching out, and thank you for the information. Can you please create a support ticket with us so we can look further into this? Currently we are not seeing this as a widespread issue amongst other users so creating a support ticket will help us be able to get more detail in order to figure out what might be going wrong here and help find a solution.

 

Let me know if that helps!