Android Question Crash

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Getting a crash like these every so often:

Do not understand why webview is not available and why this is not happening on every device

What I know about the device:
B4X:
OSVersion:5.0.2  API:21

B4X:
--------- beginning of system
--------- beginning of main
~i:*** Service (starter) Create ***
~i:** Service (starter) Start **
~i:** Activity (main) Create, isFirst =rue **
~i:** Activity (main) Resume **
~e:chelp_initialize (java line: 200)
~e:android.util.AndroidRuntimeException: android.content.pm.PackageManager$NameNotFoundException: com.google.android.webview
~e:  at android.webkit.WebViewFactory.getFactoryClass(WebViewFactory.java:161)
~e:  at android.webkit.WebViewFactory.getProvider(WebViewFactory.java:101)
~e:  at android.webkit.WebView.getFactory(WebView.java:2185)
~e:  at android.webkit.WebView.ensureProviderCreated(WebView.java:2180)
~e:  at android.webkit.WebView.setOverScrollMode(WebView.java:2239)
~e:  at android.view.View.<init>(View.java:3589)
~e:  at android.view.View.<init>(View.java:3683)
~e:  at android.view.ViewGroup.<init>(ViewGroup.java:492)
~e:  at android.widget.AbsoluteLayout.<init>(AbsoluteLayout.java:55)
~e:  at android.webkit.WebView.<init>(WebView.java:538)
~e:  at android.webkit.WebView.<init>(WebView.java:483)
~e:  at android.webkit.WebView.<init>(WebView.java:466)
~e:  at android.webkit.WebView.<init>(WebView.java:453)
~e:  at android.webkit.WebView.<init>(WebView.java:443)
~e:  at anywheresoftware.b4a.objects.WebViewWrapper.innerInitialize(WebViewWrapper.java:51)
~e:  at anywheresoftware.b4a.objects.ViewWrapper.Initialize(ViewWrapper.java:65)
~e:  at com.BOBs.BBS.chelp._initialize(chelp.java:200)
~e:  at com.BOBs.BBS.main._vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv6(main.java:631)
~e:  at com.BOBs.BBS.main._activity_resume(main.java:523)
~e:  at java.lang.reflect.Method.invoke(Native Method)
~e:  at java.lang.reflect.Method.invoke(Method.java:372)
~e:  at anywheresoftware.b4a.BA.raiseEvent2(BA.java:186)
~e:  at anywheresoftware.b4a.BA.raiseEvent(BA.java:166)
~e:  at com.BOBs.BBS.main.afterFirstLayout(main.java:108)
~e:  at com.BOBs.BBS.main.access$000(main.java:17)
~e:  at com.BOBs.BBS.main$WaitForLayout.run(main.java:80)
~e:  at android.os.Handler.handleCallback(Handler.java:739)
~e:  at android.os.Handler.dispatchMessage(Handler.java:95)
~e:  at android.os.Looper.loop(Looper.java:135)
~e:  at android.app.ActivityThread.main(ActivityThread.java:5376)
~e:  at java.lang.reflect.Method.invoke(Native Method)
~e:  at java.lang.reflect.Method.invoke(Method.java:372)
~e:  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:908)
~e:  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:703)
~e:Caused by: android.content.pm.PackageManager$NameNotFoundException: com.google.android.webview
~e:  at android.app.ApplicationPackageManager.getPackageInfo(ApplicationPackageManager.java:114)
~e:  at android.webkit.WebViewFactory.getFactoryClass(WebViewFactory.java:133)
~e:  ... 33 more
android.util.AndroidRuntimeException: android.content.pm.PackageManager$NameNotFoundException: com.google.android.webview
  at android.webkit.WebViewFactory.getFactoryClass(WebViewFactory.java:161)
  at android.webkit.WebViewFactory.getProvider(WebViewFactory.java:101)
  at android.webkit.WebView.getFactory(WebView.java:2185)
  at android.webkit.WebView.ensureProviderCreated(WebView.java:2180)
  at android.webkit.WebView.setOverScrollMode(WebView.java:2239)
  at android.view.View.<init>(View.java:3589)
  at android.view.View.<init>(View.java:3683)
  at android.view.ViewGroup.<init>(ViewGroup.java:492)
  at android.widget.AbsoluteLayout.<init>(AbsoluteLayout.java:55)
  at android.webkit.WebView.<init>(WebView.java:538)
  at android.webkit.WebView.<init>(WebView.java:483)
  at android.webkit.WebView.<init>(WebView.java:466)
  at android.webkit.WebView.<init>(WebView.java:453)
  at android.webkit.WebView.<init>(WebView.java:443)
  at anywheresoftware.b4a.objects.WebViewWrapper.innerInitialize(WebViewWrapper.java:51)
  at anywheresoftware.b4a.objects.ViewWrapper.Initialize(ViewWrapper.java:65)
  at com.BOBs.BBS.chelp._initialize(chelp.java:200)
  at com.BOBs.BBS.main._vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv6(main.java:631)
  at com.BOBs.BBS.main._activity_resume(main.java:523)
  at java.lang.reflect.Method.invoke(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:372)
  at anywheresoftware.b4a.BA.raiseEvent2(BA.java:186)
  at anywheresoftware.b4a.BA.raiseEvent(BA.java:166)
  at com.BOBs.BBS.main.afterFirstLayout(main.java:108)
  at com.BOBs.BBS.main.access$000(main.java:17)
  at com.BOBs.BBS.main$WaitForLayout.run(main.java:80)
  at android.os.Handler.handleCallback(Handler.java:739)
  at android.os.Handler.dispatchMessage(Handler.java:95)
  at android.os.Looper.loop(Looper.java:135)
  at android.app.ActivityThread.main(ActivityThread.java:5376)
  at java.lang.reflect.Method.invoke(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:372)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:908)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:703)
Caused by: android.content.pm.PackageManager$NameNotFoundException: com.google.android.webview
  at android.app.ApplicationPackageManager.getPackageInfo(ApplicationPackageManager.java:114)
  at android.webkit.WebViewFactory.getFactoryClass(WebViewFactory.java:133)
  ... 33 more
 

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Thanks for the post. But there isn't any real solution there.

I believe this is the code that is causing it (my cHelp class)

B4X:
'Class module
Sub Class_Globals
   Public  mTitle             As String =  "Bowling Brackets Sidepots Help"
   Public  mIndexPage           As String = "help.htm"
   
   Private mWebViewPanel         As Panel
   Private  mWebViewTitle      As Label
   Private  mWebViewClose       As ImageView   
   Private    mWebView          As WebView
   
   Private     mWebViewBack       As ImageView   
   Private  mWebViewIndex       As ImageView       
   Private     mWebViewNext       As ImageView
   
   Private mShowing            As Boolean
   Private mStartedURL           As String

  Private mT8TextSize  As cT8TextSize

End Sub

Public  Sub Initialize(Act As Activity, T8TextSize As cT8TextSize)

       mT8TextSize = T8TextSize
       
       mWebViewPanel.Initialize("cHelp_WebView")                
       mWebViewPanel.Color = cColors.Yellow                       
       
       Act.AddView(mWebViewPanel, 0, 0, 100%x, 100%y)     
       
       mWebView.Initialize("")                                                      '<------------------ I Believe this is crashing or at least is Java Line 200
       mWebViewTitle.Initialize("")   
       mWebViewTitle.Gravity  = Gravity.CENTER
       mWebViewTitle.TextColor = Colors.Black
       mWebViewTitle.TextSize  = 24
       
       mWebViewClose.Initialize("cHelp_WebView_Close")
       mWebViewClose.Background = LoadThisBitmapDrawable("red_x.png")
       
       mWebViewBack.Initialize("cHelp_WebView_Back")
       mWebViewBack.Background    = LoadThisBitmapDrawable("red_arrow_back.png")

       mWebViewIndex.Initialize("cHelp_WebView_Index")
       mWebViewIndex.Background = LoadThisBitmapDrawable("index.png")
       
       mWebViewNext.Initialize("cHelp_WebView_Next")
       mWebViewNext.Background    = LoadThisBitmapDrawable("red_arrow_next.png")
       mWebViewNext.Enabled  = False
       mWebViewNext.Visible  = False
       
       mWebViewPanel.AddView(mWebView,      10dip,  50dip, 100%x-20dip, 100%y-100dip)
       mWebViewPanel.AddView(mWebViewTitle, (100%x/4),  5dip, (100%x/2),  40dip)       
       mWebViewPanel.AddView(mWebViewClose, 100%x-40dip, 10dip, 30dip, 30dip)
       
       mWebViewPanel.AddView(mWebViewBack,  (100%x/3)-30dip  , 100%y-40dip, 30dip, 30dip)
       mWebViewPanel.AddView(mWebViewIndex, ((100%x-30dip)/2), 100%y-40dip, 30dip, 30dip)       
       mWebViewPanel.AddView(mWebViewNext,  ((100%x/3)*2)  , 100%y-40dip, 30dip, 30dip)
       
       mWebViewPanel.Visible = False
       mWebViewPanel.Enabled = False       
       
       mShowing           = False
End Sub
 
Upvote 0

Computersmith64

Well-Known Member
Licensed User
Longtime User
Can you run it in debug mode to check for certain that you've identified the correct point of the crash?

- Colin.
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
It doesn't crash on anything I own. And it seems to stop crashing on users machines after the first. From the link provided by EPS it seems that the webview is getting update and once done is fine. Find the whole article a little sketchy.

Was thinking of trying to put a try catch around it and reload the app and try again until it gets loaded.

But have Zero confidence in this idea. Hoping Erl reads this as has some tactic to held it.
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
It seems that this occurs once (or I think once) because the next time the user starts the program I usually don't get the crash report (well on a few I seem to always get it)

Have put a Try Catch around the whole routine and display a message about known problem and help unavailable

At least the software will work normally and the only place I use a WebView is in the Help System

Thanks Guys
 
Upvote 0
Top