Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handle webview version names on custom ROMs #6863

Conversation

colenso
Copy link
Contributor

@colenso colenso commented Sep 4, 2023

I noticed that some custom ROMs that have the string "Developer Build" in their info.versionName. Hence, adjusted the code to use a regex that finds the first sequence of digits instead.

@colenso
Copy link
Contributor Author

colenso commented Sep 4, 2023

To add some context, I made this fix because of an error that crashes some of our user's apps. This is the stacktrace that firebase crashlytics has provided us:

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.x_b_e.client/com.x_b_e.client.MainActivity}: java.lang.NumberFormatException: For input string: "Developer Build"
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2795)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2873)
       at android.app.ActivityThread.-wrap11()
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1603)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:6536)
       at java.lang.reflect.Method.invokeImpl(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:411)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:468)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:808)
Caused by java.lang.NumberFormatException: For input string: "Developer Build"
       at java.lang.Integer.parseInt(Integer.java:617)
       at java.lang.Integer.parseInt(Integer.java:656)
       at com.getcapacitor.Bridge.isMinimumWebViewInstalled(Bridge.java:299)
       at com.capacitorjs.plugins.splashscreen.SplashScreenPlugin.load(SplashScreenPlugin.java:21)
       at com.getcapacitor.PluginHandle.loadInstance(PluginHandle.java:115)
       at com.getcapacitor.PluginHandle.load(PluginHandle.java:105)
       at com.getcapacitor.PluginHandle.<init>(PluginHandle.java:65)
       at com.getcapacitor.Bridge.registerPlugin(Bridge.java:638)
       at com.getcapacitor.Bridge.registerAllPlugins(Bridge.java:594)
       at com.getcapacitor.Bridge.<init>(Bridge.java:213)
       at com.getcapacitor.Bridge.<init>()
       at com.getcapacitor.Bridge$Builder.create(Bridge.java:1513)
       at com.getcapacitor.BridgeActivity.load(BridgeActivity.java:42)
       at com.getcapacitor.BridgeActivity.onCreate(BridgeActivity.java:36)
       at android.app.Activity.performCreate(Activity.java:7028)
       at android.app.Activity.performCreate(Activity.java:7019)
       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1219)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2748)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2873)
       at android.app.ActivityThread.-wrap11()
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1603)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:6536)
       at java.lang.reflect.Method.invokeImpl(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:411)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:468)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:808)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants