Ma tablette Android la version est 7.0 et Chrome version 62.0.3202.84.
Lorsque je lance mon application Webview pour la première fois, la fenêtre de débogage affiche
Je n'ai pas trouvé la classe "Android.webkit.RenderProcessGoneDetail
RenderProcessGoneDetail est Android 8.0 API
Comment puis-je empêcher le message d'erreur?
11-28 13:23:13.133 28584-28584/com.himart.omni.himartomniapp I/cr_BrowserStartup: Initializing chromium process, singleProcess=true
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: Rejecting re-init on previously-failed class Java.lang.Class<com.Android.webview.chromium.eb>: Java.lang.NoClassDefFoundError: Failed resolution of: Landroid/webkit/RenderProcessGoneDetail;
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at com.Android.webview.chromium.Ap com.Android.webview.chromium.WebViewChromiumFactoryProvider.G(Android.webkit.WebView, Android.content.Context) (WebViewChromiumFactoryProvider.Java:323)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at void com.Android.webview.chromium.WebViewChromium.init(Java.util.Map, boolean) (WebViewChromium.Java:42)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at void Android.webkit.WebView.<init>(Android.content.Context, Android.util.AttributeSet, int, int, Java.util.Map, boolean) (WebView.Java:636)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at void Android.webkit.WebView.<init>(Android.content.Context, Android.util.AttributeSet, int, int) (WebView.Java:572)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at void Android.webkit.WebView.<init>(Android.content.Context, Android.util.AttributeSet, int) (WebView.Java:555)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at void Android.webkit.WebView.<init>(Android.content.Context, Android.util.AttributeSet) (WebView.Java:542)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at Java.lang.Object Java.lang.reflect.Constructor.newInstance0!(Java.lang.Object[]) (Constructor.Java:-2)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at Java.lang.Object Java.lang.reflect.Constructor.newInstance(Java.lang.Object[]) (Constructor.Java:430)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at Android.view.View Android.view.LayoutInflater.createView(Java.lang.String, Java.lang.String, Android.util.AttributeSet) (LayoutInflater.Java:652)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at Android.view.View com.Android.internal.policy.PhoneLayoutInflater.onCreateView(Java.lang.String, Android.util.AttributeSet) (PhoneLayoutInflater.Java:58)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at Android.view.View Android.view.LayoutInflater.onCreateView(Android.view.View, Java.lang.String, Android.util.AttributeSet) (LayoutInflater.Java:724)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at Android.view.View Android.view.LayoutInflater.createViewFromTag(Android.view.View, Java.lang.String, Android.content.Context, Android.util.AttributeSet, boolean) (LayoutInflater.Java:792)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at Android.view.View Android.view.LayoutInflater.createViewFromTag(Android.view.View, Java.lang.String, Android.content.Context, Android.util.AttributeSet) (LayoutInflater.Java:734)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at void Android.view.LayoutInflater.rInflate(org.xmlpull.v1.XmlPullParser, Android.view.View, Android.content.Context, Android.util.AttributeSet, boolean) (LayoutInflater.Java:865)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at void Android.view.LayoutInflater.rInflateChildren(org.xmlpull.v1.XmlPullParser, Android.view.View, Android.util.AttributeSet, boolean) (LayoutInflater.Java:828)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at void Android.view.LayoutInflater.rInflate(org.xmlpull.v1.XmlPullParser, Android.view.View, Android.content.Context, Android.util.AttributeSet, boolean) (LayoutInflater.Java:873)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at void Android.view.LayoutInflater.rInflateChildren(org.xmlpull.v1.XmlPullParser, Android.view.View, Android.util.AttributeSet, boolean) (LayoutInflater.Java:828)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at Android.view.View Android.view.LayoutInflater.inflate(org.xmlpull.v1.XmlPullParser, Android.view.ViewGroup, boolean) (LayoutInflater.Java:525)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at Android.view.View Android.view.LayoutInflater.inflate(int, Android.view.ViewGroup, boolean) (LayoutInflater.Java:427)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at Android.view.View Android.view.LayoutInflater.inflate(int, Android.view.ViewGroup) (LayoutInflater.Java:378)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at void com.Android.internal.policy.PhoneWindow.setContentView(int) (PhoneWindow.Java:459)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at void Android.app.Activity.setContentView(int) (Activity.Java:2548)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at void com.himart.omni.himartomniapp.view.activity.WebViewActivity.onCreate(Android.os.Bundle) (WebViewActivity.Java:257)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at void Android.app.Activity.performCreate(Android.os.Bundle) (Activity.Java:6955)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at void Android.app.Instrumentation.callActivityOnCreate(Android.app.Activity, Android.os.Bundle) (Instrumentation.Java:1126)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at Android.app.Activity Android.app.ActivityThread.performLaunchActivity(Android.app.ActivityThread$ActivityClientRecord, Android.content.Intent) (ActivityThread.Java:2927)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at void Android.app.ActivityThread.handleLaunchActivity(Android.app.ActivityThread$ActivityClientRecord, Android.content.Intent, Java.lang.String) (ActivityThread.Java:3045)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at void Android.app.ActivityThread.-wrap14(Android.app.ActivityThread, Android.app.ActivityThread$ActivityClientRecord, Android.content.Intent, Java.lang.String) (ActivityThread.Java:-1)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at void Android.app.ActivityThread$H.handleMessage(Android.os.Message) (ActivityThread.Java:1642)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at void Android.os.Handler.dispatchMessage(Android.os.Message) (Handler.Java:102)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at void Android.os.Looper.loop() (Looper.Java:154)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at void Android.app.ActivityThread.main(Java.lang.String[]) (ActivityThread.Java:6776)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at Java.lang.Object Java.lang.reflect.Method.invoke!(Java.lang.Object, Java.lang.Object[]) (Method.Java:-2)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at void com.Android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.Java:1496)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at void com.Android.internal.os.ZygoteInit.main(Java.lang.String[]) (ZygoteInit.Java:1386)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: Caused by: Java.lang.ClassNotFoundException: Didn't find class "Android.webkit.RenderProcessGoneDetail" on path: DexPathList[[Zip file "/data/app/com.Android.chrome-1/base.apk"],nativeLibraryDirectories=[/data/app/com.Android.chrome-1/lib/arm, /data/app/com.Android.chrome-1/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at Java.lang.Class dalvik.system.BaseDexClassLoader.findClass(Java.lang.String) (BaseDexClassLoader.Java:56)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at Java.lang.Class Java.lang.ClassLoader.loadClass(Java.lang.String, boolean) (ClassLoader.Java:380)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at Java.lang.Class Java.lang.ClassLoader.loadClass(Java.lang.String) (ClassLoader.Java:312)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at com.Android.webview.chromium.Ap com.Android.webview.chromium.WebViewChromiumFactoryProvider.G(Android.webkit.WebView, Android.content.Context) (WebViewChromiumFactoryProvider.Java:323)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at void com.Android.webview.chromium.WebViewChromium.init(Java.util.Map, boolean) (WebViewChromium.Java:42)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at void Android.webkit.WebView.<init>(Android.content.Context, Android.util.AttributeSet, int, int, Java.util.Map, boolean) (WebView.Java:636)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at void Android.webkit.WebView.<init>(Android.content.Context, Android.util.AttributeSet, int, int) (WebView.Java:572)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at void Android.webkit.WebView.<init>(Android.content.Context, Android.util.AttributeSet, int) (WebView.Java:555)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at void Android.webkit.WebView.<init>(Android.content.Context, Android.util.AttributeSet) (WebView.Java:542)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at Java.lang.Object Java.lang.reflect.Constructor.newInstance0!(Java.lang.Object[]) (Constructor.Java:-2)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at Java.lang.Object Java.lang.reflect.Constructor.newInstance(Java.lang.Object[]) (Constructor.Java:430)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at Android.view.View Android.view.LayoutInflater.createView(Java.lang.String, Java.lang.String, Android.util.AttributeSet) (LayoutInflater.Java:652)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at Android.view.View com.Android.internal.policy.PhoneLayoutInflater.onCreateView(Java.lang.String, Android.util.AttributeSet) (PhoneLayoutInflater.Java:58)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at Android.view.View Android.view.LayoutInflater.onCreateView(Android.view.View, Java.lang.String, Android.util.AttributeSet) (LayoutInflater.Java:724)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at Android.view.View Android.view.LayoutInflater.createViewFromTag(Android.view.View, Java.lang.String, Android.content.Context, Android.util.AttributeSet, boolean) (LayoutInflater.Java:792)
11-28 13:23:13.273 28584-28584/com.himart.omni.himartomniapp I/art: at Android.view.View Android.view.LayoutInflater.createViewFromTag(Android.view.View, Java.lang.String, Android.content.Context, Android.util.AttributeSet) (LayoutInflater.Java:734)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art: at void Android.view.LayoutInflater.rInflate(org.xmlpull.v1.XmlPullParser, Android.view.View, Android.content.Context, Android.util.AttributeSet, boolean) (LayoutInflater.Java:865)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art: at void Android.view.LayoutInflater.rInflateChildren(org.xmlpull.v1.XmlPullParser, Android.view.View, Android.util.AttributeSet, boolean) (LayoutInflater.Java:828)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art: at void Android.view.LayoutInflater.rInflate(org.xmlpull.v1.XmlPullParser, Android.view.View, Android.content.Context, Android.util.AttributeSet, boolean) (LayoutInflater.Java:873)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art: at void Android.view.LayoutInflater.rInflateChildren(org.xmlpull.v1.XmlPullParser, Android.view.View, Android.util.AttributeSet, boolean) (LayoutInflater.Java:828)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art: at Android.view.View Android.view.LayoutInflater.inflate(org.xmlpull.v1.XmlPullParser, Android.view.ViewGroup, boolean) (LayoutInflater.Java:525)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art: at Android.view.View Android.view.LayoutInflater.inflate(int, Android.view.ViewGroup, boolean) (LayoutInflater.Java:427)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art: at Android.view.View Android.view.LayoutInflater.inflate(int, Android.view.ViewGroup) (LayoutInflater.Java:378)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art: at void com.Android.internal.policy.PhoneWindow.setContentView(int) (PhoneWindow.Java:459)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art: at void Android.app.Activity.setContentView(int) (Activity.Java:2548)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art: at void com.himart.omni.himartomniapp.view.activity.WebViewActivity.onCreate(Android.os.Bundle) (WebViewActivity.Java:257)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art: at void Android.app.Activity.performCreate(Android.os.Bundle) (Activity.Java:6955)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art: at void Android.app.Instrumentation.callActivityOnCreate(Android.app.Activity, Android.os.Bundle) (Instrumentation.Java:1126)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art: at Android.app.Activity Android.app.ActivityThread.performLaunchActivity(Android.app.ActivityThread$ActivityClientRecord, Android.content.Intent) (ActivityThread.Java:2927)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art: at void Android.app.ActivityThread.handleLaunchActivity(Android.app.ActivityThread$ActivityClientRecord, Android.content.Intent, Java.lang.String) (ActivityThread.Java:3045)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art: at void Android.app.ActivityThread.-wrap14(Android.app.ActivityThread, Android.app.ActivityThread$ActivityClientRecord, Android.content.Intent, Java.lang.String) (ActivityThread.Java:-1)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art: at void Android.app.ActivityThread$H.handleMessage(Android.os.Message) (ActivityThread.Java:1642)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art: at void Android.os.Handler.dispatchMessage(Android.os.Message) (Handler.Java:102)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art: at void Android.os.Looper.loop() (Looper.Java:154)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art: at void Android.app.ActivityThread.main(Java.lang.String[]) (ActivityThread.Java:6776)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art: at Java.lang.Object Java.lang.reflect.Method.invoke!(Java.lang.Object, Java.lang.Object[]) (Method.Java:-2)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art: at void com.Android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.Java:1496)
11-28 13:23:13.274 28584-28584/com.himart.omni.himartomniapp I/art: at void com.Android.internal.os.ZygoteInit.main(Java.lang.String[]) (ZygoteInit.Java:1386)
Il semble s'agir d'un bogue, plus de détails ici: https://groups.google.com/a/chromium.org/forum/#!topic/Android-webview-dev/m0EtO3IXNn
Sur N +, une nouvelle journalisation ART semble avoir été introduite, permettant aux développeurs d'applications de connaître certains problèmes de compatibilité binaire dans leur code. Malheureusement, cela déclenche une partie du code protégé de niveau API dans WebView.
Un exemple est "Échec de la résolution de: Landroid/webkit/RenderProcessGoneDetail;", qui est déclenché chaque fois qu'une version récente de WebView with O features est utilisée sur un périphérique N. Ceci est inoffensif, mais source de confusion et de spam pour les développeurs qui consultent logcat.
Il y a un problème avec Android après 7.0, mais j'ai réussi à trouver une solution. Pour moi, cela a marché ce tutoriel . Dans un résumé, le fragment devrait ressembler à cette:
public class WebFragment1 extends Fragment{
public WebFragment1() {
// Required empty public constructor
}
WebView wvPage1;
String url = "http://apptimist.studio";
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_web_fragment1, container, false);
wvPage1 = (WebView)v.findViewById(R.id.wvPage1);
wvPage1.loadUrl(url);
WebSettings settings = wvPage1.getSettings();
settings.setJavaScriptEnabled(true);
wvPage1.setWebViewClient(new MyWebViewClient());
return v;
}
private class MyWebViewClient extends WebViewClient{
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
// TODO Auto-generated method stub
super.onPageStarted(view, url, favicon);
}
@SuppressWarnings("deprecation")
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
final Uri uri = Uri.parse(url);
return true;
}
@TargetApi(Build.VERSION_CODES.N)
@Override
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
view.loadUrl(request.getUrl().toString());
return true;
}
}
J'ai essayé sans ces deux lignes, mais cela ne fonctionnait pas, alors je les ai incluses et cela a fonctionné. Faites attention à les ajouter
WebSettings settings = wvPage1.getSettings();
settings.setJavaScriptEnabled(true);
Il y a la notification qu'il pourrait y avoir une vulnérabilité aux attaques XSS, vous devriez ouvrir les sites Web de confiance de préférence.
Et voici la mise en page:
<LinearLayout xmlns:Android="http://schemas.Android.com/apk/res/Android"
xmlns:tools="http://schemas.Android.com/tools"
Android:orientation="vertical"
Android:layout_width="match_parent"
Android:layout_height="match_parent"
tools:context="com.kosalgeek.webviewfragment.WebFragment1">
<WebView
Android:id="@+id/wvPage1"
Android:layout_width="match_parent"
Android:layout_height="match_parent"></WebView>
</LinearLayout>
J'espère que cela aidera quelqu'un car j'ai passé beaucoup de temps à chercher la solution
Vous pouvez essayer WebSettings#setSafeBrowsingEnabled(false)
dans le niveau 26 de l'API. Cela fonctionne pour moi