apache / cordova-android

Apache Cordova Android
https://cordova.apache.org/
Apache License 2.0
3.59k stars 1.52k forks source link

Can not open app built by v7.1.3 #570

Closed CS-Tao closed 5 years ago

CS-Tao commented 5 years ago

My app was built successfully by Travis-ci, but it flash back unexpectedly when launch. It works yesterday when built with v7.1.2. Does anybody know what caused this?

I have tried to upgrade build-tools version from 26.0.2 to 28.0.3, but it still can not work.

Files:

janpio commented 5 years ago

Hi @CS-Tao, help me reproduce this please: Can I just check out the develop branch of your app at https://github.com/CS-Tao/whu-library-seat-mobile/tree/develop and then install with cordova-android 7.1.2 to get a working app and then change to 7.1.3 to see that it does not work any more?

CS-Tao commented 5 years ago

@janpio Yes, please. Many thanks!

janpio commented 5 years ago

I have tried to upgrade build-tools version from 26.0.2 to 28.0.3, but it still can not work.

Why do you think this could be related and help?

oliversalzburg commented 5 years ago

@CS-Tao What exactly do you mean by "flash back unexpectedly"?

CS-Tao commented 5 years ago

@janpio I'm not sure. And just have a try, because I found that build-tools version has been changed in ".travis.yml" of this repo in v7.1.3.

CS-Tao commented 5 years ago

@CS-Tao What exactly do you mean by "flash back unexpectedly"?

Just I can't open my app, it exited when I try to open it.

janpio commented 5 years ago

Ok, I could reproduce your problem:

How can I build the actual web app in www so I can confirm that 7.1.2 really works?

Update: node build/build.js seems to do the trick. Waiting for it to finish now.

janpio commented 5 years ago

Ok, I can confirm that your app built with 7.1.2 works and intended, but crashes on startup with "Unfortunately, whu-library-seat-mobile has stopped." when built with 7.1.3. This looks like a bug to me - we will investigate.

CS-Tao commented 5 years ago

Ok, I could reproduce your problem:

  • 7.1.3: "Unfortunately, whu-library-seat-mobile has stopped."
  • 7.1.2: starts, but then crashes because no index.html in www.

How can I build the actual web app in www so I can confirm that 7.1.2 really works?

run yarn build before yarn release:android like scripts in .travis.yml

janpio commented 5 years ago

I am using npm locally, but executing node build/build.js built a www that could be shown on the device.

janpio commented 5 years ago

Just to make sure this is not a general problem: A new project created with cordova create and then cordova platform add android@7.1.3 can be built and started just fine - so this is not a general problem of cordova-android 7.1.3 but something with your app (setup, plugins, ...). We will continue to investigate.

CS-Tao commented 5 years ago

Okay. Thank you~

janpio commented 5 years ago

I used adb logcat (h/t @oliversalzburg) to monitor the log output of the device, got this on app start:

11-22 11:52:17.703 11103 11103 E AndroidRuntime: java.lang.RuntimeException: Unable to get provider de.appplant.cordova.plugin.notification.util.AssetProvider: java.lang.ClassNotFoundException: Didn't find class "de.appplant.cordova.plugin.notification.util.AssetProvider" on path: DexPathList[[zip file "/data/app/cc.cs_tao.whu_library_seat_mobile-1/base.apk"],nativeLibraryDirectories=[/data/app/cc.cs_tao.whu_library_seat_mobile-1/lib/arm, /vendor/lib, /system/lib]]
11-22 11:52:17.703 11103 11103 E AndroidRuntime:        at android.app.ActivityThread.installProvider(ActivityThread.java:5156)
11-22 11:52:17.703 11103 11103 E AndroidRuntime:        at android.app.ActivityThread.installContentProviders(ActivityThread.java:4748)
11-22 11:52:17.703 11103 11103 E AndroidRuntime:        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4688)
11-22 11:52:17.703 11103 11103 E AndroidRuntime:        at android.app.ActivityThread.-wrap1(ActivityThread.java)
11-22 11:52:17.703 11103 11103 E AndroidRuntime:        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
11-22 11:52:17.703 11103 11103 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:102)
11-22 11:52:17.703 11103 11103 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:148)
11-22 11:52:17.703 11103 11103 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:5417)
11-22 11:52:17.703 11103 11103 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
11-22 11:52:17.703 11103 11103 E AndroidRuntime:        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
11-22 11:52:17.703 11103 11103 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
11-22 11:52:17.703 11103 11103 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "de.appplant.cordova.plugin.notification.util.AssetProvider" on path: DexPathList[[zip file "/data/app/cc.cs_tao.whu_library_seat_mobile-1/base.apk"],nativeLibraryDirectories=[/data/app/cc.cs_tao.whu_library_seat_mobile-1/lib/arm, /vendor/lib, /system/lib]]
11-22 11:52:17.703 11103 11103 E AndroidRuntime:        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
11-22 11:52:17.703 11103 11103 E AndroidRuntime:        at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
11-22 11:52:17.703 11103 11103 E AndroidRuntime:        at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
11-22 11:52:17.703 11103 11103 E AndroidRuntime:        at android.app.ActivityThread.installProvider(ActivityThread.java:5141)
11-22 11:52:17.703 11103 11103 E AndroidRuntime:        ... 10 more
11-22 11:52:17.703 11103 11103 E AndroidRuntime:        Suppressed: java.lang.ClassNotFoundException: de.appplant.cordova.plugin.notification.util.AssetProvider
11-22 11:52:17.703 11103 11103 E AndroidRuntime:                at java.lang.Class.classForName(Native Method)
11-22 11:52:17.703 11103 11103 E AndroidRuntime:                at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
11-22 11:52:17.703 11103 11103 E AndroidRuntime:                at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
11-22 11:52:17.703 11103 11103 E AndroidRuntime:                at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
11-22 11:52:17.703 11103 11103 E AndroidRuntime:                ... 12 more
11-22 11:52:17.703 11103 11103 E AndroidRuntime:        Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
11-22 11:52:17.704  1910  3271 W ActivityManager:   Force finishing activity cc.cs_tao.whu_library_seat_mobile/.MainActivity

Removing the plugin fixed the crash.

You were using a beta version of this plugin anyway: cordova-plugin-local-notification 0.9.0-beta.2 "LocalNotification" Try upgrading to the available beta3 or downgrade to an older, stable version.

If upgrading to beta does not help, please report the problem at the plugin's repository issues, I didn't see an existing one on a first look.

janpio commented 5 years ago

If using the newer version of the plugin doesn't work, please also report back here - maybe this is indeed caused by 7.1.3. Someone else from the team will look into this then.

janpio commented 5 years ago

Further investigation showed that this is indeed a problem of cordov-androida. The plugin files are copied to different places in 7.1.3 than they were in 7.1.2, which causes the plugin to crash. In your case it was cordova-plugin-local-notifications, but it could theoretically affect lots of other plugins as well.

We will continue investigating and provide a fix asap. Until then: Best stay with 7.1.2 @CS-Tao .

jcesarmobile commented 5 years ago

Closing in favour of https://github.com/apache/cordova-android/issues/571 as it contains the key problem. But thanks for reporting and being so cooperative!

brodybits commented 5 years ago

571 is now fixed in master. Will be fixed in nightly build and upcoming patch release, details in https://github.com/apache/cordova-android/issues/571#issuecomment-441039608.

brodybits commented 5 years ago

7.1.4 patch release is now published to resolve the issue.