Closed Hanzofm closed 4 years ago
@SujitSingh did you faced with this issue while worked on https://github.com/greybax/cordova-plugin-proguard/pull/5?
I didn't face any issue with Cordova 7 and above. I am still using forked repo in my project. Let me check with latest version of this plugin.
@SujitSingh did you faced with this issue while worked on #5?
If this PR is included on version 2.0 of the plugin, my problem persist with latest version, my problem is with version 2.0.
@Hanzofm is v1 works fine with latest version of Cordova? If yes I can revert @SujitSingh PR ?
Actually, I face the same issue when I use this.
Cordova version - 8.1.2 Android - 6.4.0 Exception -
E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{...}: java.lang.RuntimeException: Failed to create webview.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2841)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2919)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1637)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:6656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
Caused by: java.lang.RuntimeException: Failed to create webview.
at org.apache.cordova.CordovaWebViewImpl.createEngine(CordovaWebViewImpl.java:83)
at org.apache.cordova.CordovaActivity.makeWebViewEngine(CordovaActivity.java:206)
at org.apache.cordova.CordovaActivity.makeWebView(CordovaActivity.java:202)
at org.apache.cordova.CordovaActivity.init(CordovaActivity.java:146)
at org.apache.cordova.CordovaActivity.loadUrl(CordovaActivity.java:224)
at uat.bitnudge.rakbank.MainActivity.onCreate(MainActivity.java:39)
at android.app.Activity.performCreate(Activity.java:7074)
at android.app.Activity.performCreate(Activity.java:7065)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2794)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2919)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1637)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:6656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
Caused by: java.lang.NoSuchMethodException:
@adhityan did you try v1 of this plugin?
I'm facing the same issue
adb logcat | grep -i webview
05-18 01:17:54.009 1705 1705 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.hello/com.example.hello.MainActivity}: java.lang.RuntimeException: Failed to create webview.
05-18 01:17:54.009 1705 1705 E AndroidRuntime: Caused by: java.lang.RuntimeException: Failed to create webview.
The doesnt seem to be this plugin problem.... At least in my case I only need to add minifyEnabled true
to my release configs in build.gradle
and my app no longer works.
It seems that's the case with any Cordova app. If I add minifyEnabled true
it starts using ProGuard and the app no longer works. We should create an issue in the cordova-android repos.....
@rodrigograca31 Did you try to set minifyEnabled true
without this plugin? Would it work in this case?
@greybax Yes, thats what I was saying, just setting minifyEnabled true
makes any cordova app stop working.... its not even related to this plugin............
Finally adding this to proguard-custom.txt solves my problem:
# These clases contain references to cordova webView
-keep class com.ionicframework.cordova.webview.** {*; }
-keep class com.ionicframework.cordova.webview.*
If uses this plugin with relative modern version of Ionic and WebView the above rules are necessary
Works with -Ionic 3.9.6 -Cordova CLI 8.0.0 -Cordova-Android 8.0.0 -Cordova webview plugin 2.2.5
@Hanzofm looks good for me. Could you send PR for this fix?
Done
@Hanzofm thanks for comming back with a solution!
I'm also using ionic and "modern version of everything" and simply enabling minifyEnabled true
was making my app crash.
whenever I got some time I will try your solution and see if it solves the problem! I bet it does! Thanks!
@Hanzofm thanks for comming back with a solution! I'm also using ionic and "modern version of everything" and simply enabling
minifyEnabled true
was making my app crash.whenever I got some time I will try your solution and see if it solves the problem! I bet it does! Thanks!
Where are you using the minifyEnabled true?
@Hanzofm I tested it by manually adding it to my app build.gradle
in platforms/android/
...
I also tried the same with a brand new cordova only app and as soon as I added minifyEnabled true
to build.gradle
the app stopped working......... I will give it a try another day.....
bumped npm package to v2.0.1 with latest @Hanzofm changes
hmm I still get java.lang.RuntimeException: Unable to start activity ComponentInfo{com.bridebook.mobileapp/com.bridebook.mobileapp.MainActivity}: java.lang.RuntimeException: Failed to create webview.
... Caused by: java.lang.ClassNotFoundException: com.ionicframework.cordova.webview.IonicWebViewEngine
even with 2.0.1, I can see
# These clases contain references to cordova webView
-keep class com.ionicframework.cordova.webview.** {*; }
-keep class com.ionicframework.cordova.webview.*
In my proguard-custom.txt
did you clean up your package before? I've faced with this issue before, because I saw plugin v2.0.0 in my package
I am also getting the same error-
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.tv.gpd/com.tv.gpd.MainActivity}: java.lang.RuntimeException: Failed to create webview.
by using -
# These clases contain references to cordova webView
-keep class com.ionicframework.cordova.webview.** {*; }
-keep class com.ionicframework.cordova.webview.*
In my proguard-custom.txt
I am using webview plugin version - 2.3.2 Even I tested the same with webview version - 2.2.5
I am working with - -Ionic 3.19.0 -Cordova CLI 7.0.0 -Cordova-Android 8.0.0
Any help will be appreciated.
I am facing same issue once added proguard to the app is now crashing.
Made a fix as it describes on SO https://stackoverflow.com/questions/37994892/cordova-android-5-1-1-apk-obfuscation-with-proguard-confusion/57273266#57273266:
added
-dontwarn com.google.android.gms.**
:thinking: I need to give this plugin another try one of these days....
@greybax seems you have a Patreon, that's great! Maybe you should try to get approved for GitHub Sponsors and set it up for this project!?
@rodrigograca31 I have approved Github Sponsors, but not sure why its better than Patreon.
Good question I just think its easier to stay inside github than go outside... but now that I think about it its Microsoft money..... :sob:
also: during the first year they match the donations that means double the money (free money from Microsoft :joy:)
Hi, when I install this plugin on my app with last version of cordova Android (7.1.4) it crashes on start.
Previously with version 1.0 of the plugin and cordova android 6.4.4 it works correctly. Now with version 2.0 of the plugin and cordova Android 7.1.4 crashes at startup with this logcat:
This is my Cordova Plugin List:
This is my Ionic Info:
What would be happening?