简体   繁体   中英

android webview crash 4.3

i got a problem with my payement webview in android since the 4.3 release.

I guess is due to the SSL certificate redirection but i can't change it.

I tried the url on samsung or sony < 4.2 with success but on two different 4.3 nexus i got this dump.

08-08 17:22:38.619: E/AndroidRuntime(7568): FATAL EXCEPTION: WebViewCoreThread
08-08 17:22:38.619: E/AndroidRuntime(7568): java.lang.StringIndexOutOfBoundsException: length=0; index=-1
08-08 17:22:38.619: E/AndroidRuntime(7568):     at java.lang.AbstractStringBuilder.indexAndLength(AbstractStringBuilder.java:212)
08-08 17:22:38.619: E/AndroidRuntime(7568):     at java.lang.AbstractStringBuilder.charAt(AbstractStringBuilder.java:206)
08-08 17:22:38.619: E/AndroidRuntime(7568):     at java.lang.StringBuffer.charAt(StringBuffer.java:346)
08-08 17:22:38.619: E/AndroidRuntime(7568):     at com.android.org.bouncycastle.asn1.x509.X509NameTokenizer.nextToken(X509NameTokenizer.java:78)
08-08 17:22:38.619: E/AndroidRuntime(7568):     at com.android.org.bouncycastle.asn1.x509.X509Name.<init>(X509Name.java:719)
08-08 17:22:38.619: E/AndroidRuntime(7568):     at com.android.org.bouncycastle.asn1.x509.X509Name.<init>(X509Name.java:655)
08-08 17:22:38.619: E/AndroidRuntime(7568):     at com.android.org.bouncycastle.asn1.x509.X509Name.<init>(X509Name.java:593)
08-08 17:22:38.619: E/AndroidRuntime(7568):     at android.net.http.SslCertificate$DName.<init>(SslCertificate.java:379)
08-08 17:22:38.619: E/AndroidRuntime(7568):     at android.net.http.SslCertificate.<init>(SslCertificate.java:189)
08-08 17:22:38.619: E/AndroidRuntime(7568):     at android.net.http.SslCertificate.<init>(SslCertificate.java:178)
08-08 17:22:38.619: E/AndroidRuntime(7568):     at android.webkit.BrowserFrame.setCertificate(BrowserFrame.java:1206)
08-08 17:22:38.619: E/AndroidRuntime(7568):     at android.webkit.JWebCoreJavaBridge.nativeServiceFuncPtrQueue(Native Method)
08-08 17:22:38.619: E/AndroidRuntime(7568):     at android.webkit.JWebCoreJavaBridge.handleMessage(JWebCoreJavaBridge.java:113)
08-08 17:22:38.619: E/AndroidRuntime(7568):     at android.os.Handler.dispatchMessage(Handler.java:99)
08-08 17:22:38.619: E/AndroidRuntime(7568):     at android.os.Looper.loop(Looper.java:137)
08-08 17:22:38.619: E/AndroidRuntime(7568):     at android.webkit.WebViewCore$WebCoreThread.run(WebViewCore.java:814)
08-08 17:22:38.619: E/AndroidRuntime(7568):     at java.lang.Thread.run(Thread.java:841)

my web view is simply

webview=(WebView)findViewById(R.id.my_web_view);
WebSettings webSettings = webview.getSettings();
webSettings.setJavaScriptEnabled(true);

thx a lot

This is an issue with android v4.3, it happens only on a webview when you are trying to open a https page. To know more about the issue, please read the issue link provided.

In Short, android has fixed this issue at their end and it should be available with the next release of 4.3.

Though rahul.garg is right, you can solve this issue by adding the following permissions to your app's manigest file.
android:name="android.permission.INTERNET" android:name="android.permission.ACCESS_NETWORK_STATE"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM