Unable to start activity ComponentInfo java.lang.RuntimeException: Failed to create webview

1.7k views Asked by At

I am working on ionic v1 project.My problem is - after updating the android platform version to latest - 8.0.0, the app crashes on launch.

Getting this error on logcat-

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.tv.gpd/com.tv.gpd.MainActivity}: java.lang.RuntimeException: Failed to create webview.

I am using this command to add latest android platform-

ionic cordova platform add android@latest

I did some digging and found some solutions and I tried it-

1)Add below line of code in proguard-custom.txt

# These clases contain references to cordova webView
-keep class com.ionicframework.cordova.webview.** {*; }
-keep class com.ionicframework.cordova.webview.*

2)Also checked it by downgrading the "cordova-plugin-ionic-webview" plugin to - 1.2.1 previously webview version is - 2.3.2

I am working with -

Ionic 3.19.0
Cordova CLI 7.0.0
Cordova-Android 8.0.0

Any help will be appreciated as I need to make app to support Android latest - Oreo and Pie version.

Thanks

1

There are 1 answers

4
Chanaka Weerasinghe On

You have to do this also If your project uses WebView with JS, uncomment the following and specify the fully qualified class name to the JavaScript interface

-keepclassmembers class android.webkit.WebView {
   public *;
}