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

Unable to use it with Proguard : Failed to create webview #145

Closed
tgensol opened this issue Aug 10, 2018 · 1 comment
Closed

Unable to use it with Proguard : Failed to create webview #145

tgensol opened this issue Aug 10, 2018 · 1 comment

Comments

@tgensol
Copy link

tgensol commented Aug 10, 2018

Hi,

I am unable to use the new version of the plugin with proguard (https://github.com/greybax/cordova-plugin-proguard), I am getting these errors :

Essentially :

Failed to create webview.

Caused by: java.lang.ClassNotFoundException: com.ionicframework.cordova.webview.IonicWebViewEngine

Caused by: java.lang.ClassNotFoundException: Didn't find class "com.ionicframework.cordova.webview.IonicWebViewEngine" on path: DexPathList

The full error :

FATAL EXCEPTION: main Process: com.appchoose.choose.android, PID: 29940 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.appchoose.choose.android/com.appchoose.choose.android.MainActivity}: java.lang.RuntimeException: Failed to create webview. at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2911) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2989) at android.app.ActivityThread.-wrap11(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1688) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6753) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:482) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) Caused by: java.lang.RuntimeException: Failed to create webview. at org.apache.cordova.CordovaWebViewImpl.createEngine(SourceFile:82) at org.apache.cordova.CordovaActivity.makeWebViewEngine(SourceFile:206) at org.apache.cordova.CordovaActivity.makeWebView(SourceFile:202) at org.apache.cordova.CordovaActivity.init(SourceFile:146) at org.apache.cordova.CordovaActivity.loadUrl(SourceFile:224) at com.appchoose.choose.android.MainActivity.onCreate(SourceFile:39) at android.app.Activity.performCreate(Activity.java:7041) at android.app.Activity.performCreate(Activity.java:7032) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1231) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2864) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2989)  at android.app.ActivityThread.-wrap11(Unknown Source:0)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1688)  at android.os.Handler.dispatchMessage(Handler.java:106)  at android.os.Looper.loop(Looper.java:164)  at android.app.ActivityThread.main(ActivityThread.java:6753)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:482)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)  Caused by: java.lang.ClassNotFoundException: com.ionicframework.cordova.webview.IonicWebViewEngine at java.lang.Class.classForName(Native Method) at java.lang.Class.forName(Class.java:453) at java.lang.Class.forName(Class.java:378) at org.apache.cordova.CordovaWebViewImpl.createEngine(SourceFile:78) at org.apache.cordova.CordovaActivity.makeWebViewEngine(SourceFile:206)  at org.apache.cordova.CordovaActivity.makeWebView(SourceFile:202)  at org.apache.cordova.CordovaActivity.init(SourceFile:146)  at org.apache.cordova.CordovaActivity.loadUrl(SourceFile:224)  at com.appchoose.choose.android.MainActivity.onCreate(SourceFile:39)  at android.app.Activity.performCreate(Activity.java:7041)  at android.app.Activity.performCreate(Activity.java:7032)  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1231)  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2864)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2989)  at android.app.ActivityThread.-wrap11(Unknown Source:0)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1688)  at android.os.Handler.dispatchMessage(Handler.java:106)  at android.os.Looper.loop(Looper.java:164)  at android.app.ActivityThread.main(ActivityThread.java:6753)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:482)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)  Caused by: java.lang.ClassNotFoundException: Didn't find class "com.ionicframework.cordova.webview.IonicWebViewEngine" on path: DexPathList[[zip file "/data/app/com.appchoose.choose.android-7glRNVCGqqGYr_EEwzarBA==/base.apk"],nativeLibraryDirectories=[/data/app/com.appchoose.choose.android-7glRNVCGqqGYr_EEwzarBA==/lib/arm64, /data/app/com.appchoose.choose.android-7glRNVCGqqGYr_EEwzarBA==/base.apk!/lib/arm64-v8a, /system/lib64, /system/vendor/lib64]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at java.lang.Class.classForName(Native Method)  at java.lang.Class.forName(Class.java:453)  at java.lang.Class.forName(Class.java:378)  at org.apache.cordova.CordovaWebViewImpl.createEngine(SourceFile:78)  at org.apache.cordova.CordovaActivity.makeWebViewEngine(SourceFile:206)  at org.apache.cordova.CordovaActivity.makeWebView(SourceFile:202)  at org.apache.cordova.CordovaActivity.init(SourceFile:146)  at org.apache.cordova.CordovaActivity.loadUrl(SourceFile:224)  at com.appchoose.choose.android.MainActivity.onCreate(SourceFile:39)  at android.app.Activity.performCreate(Activity.java:7041)  at android.app.Activity.performCreate(Activity.java:7032)  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1231)  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2864)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2989)  at android.app.ActivityThread.-wrap11(Unknown Source:0)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1688)  at android.os.Handler.dispatchMessage(Handler.java:106)  at android.os.Looper.loop(Looper.java:164)  at android.app.ActivityThread.main(ActivityThread.java:6753)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:482)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)  E/UncaughtException: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.appchoose.choose.android/com.appchoose.choose.android.MainActivity}: java.lang.RuntimeException: Failed to create webview. at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2911) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2989) at android.app.ActivityThread.-wrap11(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1688) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6753) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:482) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) Caused by: java.lang.RuntimeException: Failed to create webview. at org.apache.cordova.CordovaWebViewImpl.createEngine(SourceFile:82) at org.apache.cordova.CordovaActivity.makeWebViewEngine(SourceFile:206) at org.apache.cordova.CordovaActivity.makeWebView(SourceFile:202) at org.apache.cordova.CordovaActivity.init(SourceFile:146) at org.apache.cordova.CordovaActivity.loadUrl(SourceFile:224) at com.appchoose.choose.android.MainActivity.onCreate(SourceFile:39) at android.app.Activity.performCreate(Activity.java:7041) at android.app.Activity.performCreate(Activity.java:7032) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1231) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2864) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2989)  at android.app.ActivityThread.-wrap11(Unknown Source:0)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1688)  at android.os.Handler.dispatchMessage(Handler.java:106)  at android.os.Looper.loop(Looper.java:164)  at android.app.ActivityThread.main(ActivityThread.java:6753)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:482)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)  Caused by: java.lang.ClassNotFoundException: com.ionicframework.cordova.webview.IonicWebViewEngine at java.lang.Class.classForName(Native Method) at java.lang.Class.forName(Class.java:453) at java.lang.Class.forName(Class.java:378) at org.apache.cordova.CordovaWebViewImpl.createEngine(SourceFile:78) at org.apache.cordova.CordovaActivity.makeWebViewEngine(SourceFile:206)  at org.apache.cordova.CordovaActivity.makeWebView(SourceFile:202)  at org.apache.cordova.CordovaActivity.init(SourceFile:146)  at org.apache.cordova.CordovaActivity.loadUrl(SourceFile:224)  at com.appchoose.choose.android.MainActivity.onCreate(SourceFile:39)  at android.app.Activity.performCreate(Activity.java:7041)  at android.app.Activity.performCreate(Activity.java:7032)  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1231)  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2864)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2989)  at android.app.ActivityThread.-wrap11(Unknown Source:0)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1688)  at android.os.Handler.dispatchMessage(Handler.java:106)  at android.os.Looper.loop(Looper.java:164)  at android.app.ActivityThread.main(ActivityThread.java:6753)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:482)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)  Caused by: java.lang.ClassNotFoundException: Didn't find class "com.ionicframework.cordova.webview.IonicWebViewEngine" on path: DexPathList[[zip file "/data/app/com.appchoose.choose.android-7glRNVCGqqGYr_EEwzarBA==/base.apk"],nativeLibraryDirectories=[/data/app/com.appchoose.choose.android-7glRNVCGqqGYr_EEwzarBA==/lib/arm64, /data/app/com.appchoose.choose.android-7glRNVCGqqGYr_EEwzarBA==/base.apk!/lib/arm64-v8a, /system/lib64, /system/vendor/lib64]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312)

Without the proguard plugin it is working just fine. Maybe I have to add something to my proguard configuration file, or something needs to be changed in the new version of the plugin ?

Thanking you in advance,
Best

@tgensol tgensol changed the title Proguard Unable to use it with Proguard : Failed to create webview Aug 10, 2018
@AadityaDev
Copy link

You need to add these lines in proguard rules

-keep class com.ionicframework.cordova.webview.** { ; }
-keep class com.ionicframework.cordova.webview.
*

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants