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

bug: Capacitor crashing when Webview Version is "Developer Build" #6144

Closed
malua opened this issue Dec 5, 2022 · 16 comments · Fixed by #6907
Closed

bug: Capacitor crashing when Webview Version is "Developer Build" #6144

malua opened this issue Dec 5, 2022 · 16 comments · Fixed by #6907
Labels
platform: android type: bug A confirmed bug report

Comments

@malua
Copy link

malua commented Dec 5, 2022

Bug Report

Capacitor Version

  @capacitor/cli: 4.5.0
  @capacitor/core: 4.5.0
  @capacitor/android: 4.5.0
  @capacitor/ios: 4.5.0

Platform(s)

Android

Current Behavior

Recently I noticed some crashes in our error tracking tool. It seems like that some Webviews return "Developer Build" for their Build Version, which causes a crash when it's converted to an Integer in Bridge.java

java.lang.NumberFormatException: For input string: "Developer Build"
  android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2795)
  android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2873)
  android.app.ActivityThread.-wrap11 (Unknown source)
  android.app.ActivityThread$H.handleMessage (ActivityThread.java:1603)
  android.os.Handler.dispatchMessage (Handler.java:106)
  android.os.Looper.loop (Looper.java:164)
  android.app.ActivityThread.main (ActivityThread.java:6536)
  java.lang.reflect.Method.invokeImpl (Unknown source)
  java.lang.reflect.Method.invoke (Method.java:411)
  com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:468)
  com.android.internal.os.ZygoteInit.main (ZygoteInit.java:808)
java.lang.NumberFormatException: For input string: "Developer Build"
  java.lang.Integer.parseInt (Integer.java:617)
  java.lang.Integer.parseInt (Integer.java:656)
  com.getcapacitor.Bridge.isMinimumWebViewInstalled (Bridge.java:323)
  com.getcapacitor.Bridge.loadWebView (Bridge.java:292)
  com.getcapacitor.Bridge.<init> (Bridge.java:208)
  com.getcapacitor.Bridge.<init> (Unknown source)
  com.getcapacitor.Bridge$Builder.create (Bridge.java:1449)
  com.getcapacitor.BridgeActivity.load (BridgeActivity.java:43)
  com.getcapacitor.BridgeActivity.onCreate (BridgeActivity.java:37)
  com.classiccard.app.MainActivity.onCreate (MainActivity.java:12)
  android.app.Activity.performCreate (Activity.java:7028)
  android.app.Activity.performCreate (Activity.java:7019)
  android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1219)
  android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2748)
  android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2873)
  android.app.ActivityThread.-wrap11 (Unknown source)
  android.app.ActivityThread$H.handleMessage (ActivityThread.java:1603)
  android.os.Handler.dispatchMessage (Handler.java:106)
  android.os.Looper.loop (Looper.java:164)
  android.app.ActivityThread.main (ActivityThread.java:6536)
  java.lang.reflect.Method.invokeImpl (Unknown source)
  java.lang.reflect.Method.invoke (Method.java:411)
  com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:468)
  com.android.internal.os.ZygoteInit.main (ZygoteInit.java:808)

Expected Behavior

This error should be catched.

@jcesarmobile
Copy link
Member

Do you get any other information about the devices where the app crashed?
Like Android version, device vendor, etc.

@jcesarmobile jcesarmobile added the needs reply needs reply from the user label Dec 5, 2022
@malua
Copy link
Author

malua commented Dec 5, 2022

Yes i do have some more information. It seems to only happen on a specific device right now:

Android: 8.1.0
Device: Huawei Enjoy 9s

@Ionitron Ionitron removed the needs reply needs reply from the user label Dec 5, 2022
@jcesarmobile jcesarmobile added the type: bug A confirmed bug report label Dec 5, 2022
@Nikhil1920
Copy link

I saw the same error

Device
Brand:MStar
Model:SIRAGON
Orientation: Landscape
RAM free: 316.2 MB
Disk free: 1.02 GB

Operating system
Version:Android 8.0.0
Orientation: Landscape
Rooted:Yes

@RRGT19
Copy link

RRGT19 commented Jan 20, 2023

I have the same error:

Bridge.java line 327
com.getcapacitor.Bridge.isMinimumWebViewInstalled

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{......MainActivity}: java.lang.NumberFormatException: For input string: "Developer Build"
Caused by java.lang.NumberFormatException: For input string: "Developer Build"

Device: vivo S1
Android: 8.1.0

@Ezyger
Copy link

Ezyger commented May 1, 2023

I had the same error as @RRGT19 and on the same device.

image

image

Capacitor CLI : 4.6.1
@capacitor/android : 4.6.1
@capacitor/core : 4.6.1

@davidkroeg
Copy link

davidkroeg commented May 12, 2023

We had the same issue:

  • Device: Huawei Enjoy 9s
  • OS: Android 8.1.0
  • @capacitor/android: ^4.0.0
  • @capacitor/app: ^4.0.0

Bildschirm­foto 2023-05-12 um 09 49 13

@minajacob
Copy link

I had the same issue on two devices right now

  1. Vivo S1 (Android 8.1.0)
  2. Xiaomi Mi 9X (Android 8.1.0)

I'm using:
@capacitor/cli: 5.0.3
@capacitor/android: 5.0.3
@capacitor/core: 5.0.3

image
image

@ucoachuBunty

This comment was marked as abuse.

@nachoalcazar
Copy link

Same issue in Android 8.1.0 systems

@daniel-zero

This comment was marked as abuse.

@AntonioJABV
Copy link

Same here:

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$Builder.create(Bridge.java:1513)
       at com.getcapacitor.BridgeActivity.load(BridgeActivity.java:42)
       at com.getcapacitor.BridgeActivity.onCreate(BridgeActivity.java:36)
       at net.zamnesia.shroomcalculator.MainActivity.onCreate(MainActivity.java:69)
       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)

@mariusbolik
Copy link

I am still facing this error with @capacitor/android@5.4.1
Phone: Umidigi One with Android 8.1.0

FATAL EXCEPTION: main
Process: com.myapp.app, PID: 21013
java.lang.RuntimeException: Unable to stop activity {com.myapp.app/com.myapp.app.MainActivity}: java.lang.NullPointerException
	at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:4062)
	at android.app.ActivityThread.handleStopActivity(ActivityThread.java:4111)
	at android.app.ActivityThread.-wrap24(Unknown Source:0)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1646)
	at android.os.Handler.dispatchMessage(Handler.java:106)
	at android.os.Looper.loop(Looper.java:164)
	at android.app.ActivityThread.main(ActivityThread.java:6523)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:865)
Caused by: java.lang.NullPointerException
	at com.onesignal.session.internal.session.impl.SessionService.getScheduleBackgroundRunIn(SessionService.kt:44)
	at com.onesignal.core.internal.background.impl.BackgroundManager.scheduleBackground(BackgroundManager.kt:96)
	at com.onesignal.core.internal.background.impl.BackgroundManager.onUnfocused(BackgroundManager.kt:88)
	at com.onesignal.core.internal.application.impl.ApplicationService$handleLostFocus$1.invoke(ApplicationService.kt:325)
	at com.onesignal.core.internal.application.impl.ApplicationService$handleLostFocus$1.invoke(ApplicationService.kt:325)
	at com.onesignal.common.events.EventProducer.fire(EventProducer.kt:43)
	at com.onesignal.core.internal.application.impl.ApplicationService.handleLostFocus(ApplicationService.kt:325)
	at com.onesignal.core.internal.application.impl.ApplicationService.onActivityStopped(ApplicationService.kt:184)
	at android.app.Application.dispatchActivityStopped(Application.java:234)
	at android.app.Activity.onStop(Activity.java:1862)
	at androidx.fragment.app.FragmentActivity.onStop(FragmentActivity.java:369)
	at androidx.appcompat.app.AppCompatActivity.onStop(AppCompatActivity.java:257)
	at com.getcapacitor.BridgeActivity.onStop(BridgeActivity.java:98)
	at android.app.Instrumentation.callActivityOnStop(Instrumentation.java:1375)
	at android.app.Activity.performStop(Activity.java:7205)
	at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:4059)
	at android.app.ActivityThread.handleStopActivity(ActivityThread.java:4111) 
	at android.app.ActivityThread.-wrap24(Unknown Source:0) 
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1646) 
	at android.os.Handler.dispatchMessage(Handler.java:106) 
	at android.os.Looper.loop(Looper.java:164) 
	at android.app.ActivityThread.main(ActivityThread.java:6523) 
	at java.lang.reflect.Method.invoke(Native Method) 
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) 
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:865) 

@jcesarmobile
Copy link
Member

That's a totally different issue, the problem on this issue was a NumberFormatException, while you are facing a NullPointerException inside some onesignal class

@Ezyger
Copy link

Ezyger commented Oct 5, 2023

image

Now the problem happens on Samsung.

@capacitor/android: 5.4.0
@capacitor/app: 5.0.6
@capacitor/core": 5.4.0

@jcesarmobile
Copy link
Member

the fix was added in 5.4.1, you are in 5.4.0

Copy link

ionitron-bot bot commented Nov 5, 2023

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Nov 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
platform: android type: bug A confirmed bug report
Projects
None yet
Development

Successfully merging a pull request may close this issue.