vaenow / cordova-plugin-app-update

App updater for Cordova/PhoneGap
MIT License
298 stars 146 forks source link

Unfortunately Myapp has stopped. #89

Open arinze1008 opened 6 years ago

arinze1008 commented 6 years ago

The new version of cordova-plugin-app-update throws an error

Unfortunately Myapp has stopped work To debug, firstly I created a new ionic projects - ionic start Myapp tabs. Then I ran the command ionic cordova run android --device and it worked fine.

Then when I install cordova-plugin-app-update, and nothing else ionic cordova plugin add cordova-plugin-app-update npm install --save @ionic-native/app-update

Myapp throws an error

Unfortunately Myapp has stopped.

This is the result of my ionic info

@ionic/cli-utils  : 1.19.1

ionic (Ionic CLI) : 3.19.1

global packages:

cordova (Cordova CLI) : 8.0.0

local packages:

@ionic/app-scripts : 3.1.8
Cordova Platforms  : android 7.0.0
Ionic Framework    : ionic-angular 3.9.2

System:

Node : v6.11.3
npm  : 3.10.10
OS   : Windows 10

Thanks

vaenow commented 6 years ago

This plugin is now updated to 1.5.2 and I tested passed in Nexus 5

shivamsngh commented 6 years ago

Its sill not working on version 1.5.2

vaenow commented 6 years ago

What phone model do you use?

In addition, you can try to use adb to get more debug info.

arinze1008 commented 6 years ago

Thank you Vaenow. It is not working for me now. However when I tested it on Saturday it seemed to have worked. My phone model is Samsung Duos, and it is running android 5.0.2. I also tested it on Nexus Emulator and it runs android 7.01

vaenow commented 6 years ago

This plugin works good in Nexus 5 android 6.0

I suggest you use a new workspace to retest this plugin or use adb logcat

ian-beer commented 6 years ago

We have the same problem.

Ours is also an ionic 2 app, it builds fine locally from visual studio code or web storm. but the build is flawed once it goes thru our build pipeline, signed etc.

it does not work on either: Pixel 2 Samsung S7

LogCat Error:

01-29 11:32:41.019: E/AndroidRuntime(32341): java.lang.RuntimeException: Unable to get provider com.vaenow.appupdate.android.GenericFileProvider: java.lang.ClassNotFoundException: Didn't find class "com.vaenow.appupdate.android.GenericFileProvider" on path: DexPathList[[zip file "/data/app/dev.dt.buyonic-0wIZ-ocXJDVePwsPQm_OiQ==/base.apk"],nativeLibraryDirectories=[/data/app/dev.dt.buyonic-0wIZ-ocXJDVePwsPQm_OiQ==/lib/arm64, /system/lib64]]
01-29 11:32:41.019: E/AndroidRuntime(32341):    at android.app.ActivityThread.installProvider(ActivityThread.java:6242)
01-29 11:32:41.019: E/AndroidRuntime(32341):    at android.app.ActivityThread.installContentProviders(ActivityThread.java:5805)
01-29 11:32:41.019: E/AndroidRuntime(32341):    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5722)
01-29 11:32:41.019: E/AndroidRuntime(32341):    at android.app.ActivityThread.-wrap1(Unknown Source:0)
01-29 11:32:41.019: E/AndroidRuntime(32341):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
01-29 11:32:41.019: E/AndroidRuntime(32341):    at android.os.Handler.dispatchMessage(Handler.java:106)
01-29 11:32:41.019: E/AndroidRuntime(32341):    at android.os.Looper.loop(Looper.java:164)
01-29 11:32:41.019: E/AndroidRuntime(32341):    at android.app.ActivityThread.main(ActivityThread.java:6494)
01-29 11:32:41.019: E/AndroidRuntime(32341):    at java.lang.reflect.Method.invoke(Native Method)
01-29 11:32:41.019: E/AndroidRuntime(32341):    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
01-29 11:32:41.019: E/AndroidRuntime(32341):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
01-29 11:32:41.019: E/AndroidRuntime(32341): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.vaenow.appupdate.android.GenericFileProvider" on path: DexPathList[[zip file "/data/app/dev.dt.buyonic-0wIZ-ocXJDVePwsPQm_OiQ==/base.apk"],nativeLibraryDirectories=[/data/app/dev.dt.buyonic-0wIZ-ocXJDVePwsPQm_OiQ==/lib/arm64, /system/lib64]]
01-29 11:32:41.019: E/AndroidRuntime(32341):    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
01-29 11:32:41.019: E/AndroidRuntime(32341):    at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
01-29 11:32:41.019: E/AndroidRuntime(32341):    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
01-29 11:32:41.019: E/AndroidRuntime(32341):    at android.app.ActivityThread.installProvider(ActivityThread.java:6227)
01-29 11:32:41.019: E/AndroidRuntime(32341):    ... 10 more
vaenow commented 6 years ago

I guess this issue is caused by the PR Prevent INSTALL_FAILED_CONFLICTING_PROVIDER error

arthursp commented 6 years ago

@ian-beer, did you tried to reinstall the plugin, and / or remove and re-add android support ?

egrendonDev commented 6 years ago

@arthursp @ian-beer - We were able to solve the 'Unable to get provider com.vaenow.appupdate.android.GenericFileProvider' error by removing cordova-android 7.0.0 and adding cordova-android 6.4.0. This plugin is broken on cordova-android 7.0.0 for our project.

fxp528 commented 6 years ago

@ian-beer @egrendonDev My solution is move the folder in android/src/com/vaenow to android/app/src/main/java/com. I think it's wrong when installing plugin. cordova (Cordova CLI) : 8.0.0 Cordova Platforms : android 7.0.0 ios 4.3.1

arthursp commented 6 years ago

I am currently on : "cordova-android": "6.3.0" So @egrendonDev , I think you are right.

vaenow commented 6 years ago

Thanks for your feedback, I've already updated the install requirement

khaled9544 commented 6 years ago

This plugin is not working on the both android versions 7.0.0 and 6.4.0. Please solve this issue. Thanks.

rexpie commented 6 years ago

@fxp528 I moved the folder as you mentioned and it did fix my problem. Thank you.

li-wen-qi commented 6 years ago

@egrendonDev Your method is effective!

rafaelbrier commented 6 years ago

@fxp528

Man, i was struggled with this problems for several hours, you have solved my problem. I was about to give up.

Thank you very much

gunarathnemdd commented 6 years ago

@fxp528 Thanks for saving my time. This works fine

gunarathnemdd commented 6 years ago

@fxp528 Now app build perfectly. I put update.xml file and new version apk in a server. Old app version detected it and gave a alert that "This app has a new version. Need to be updated." And I press update button.

Then it show an alert "Updating, Update in background." It took more than 15 mins but app still appear same. And "Updating, Update in background." alert is still present. How to solve this? Any idea?

When I call http://www.*****.lk/apk/myapk.apk in the browser it says The requested document was not found on this server. But when I call to a html doc in the same folder it shows.

This is my update.xml file

<update>
  <version>2</version>
  <name>myapk</name>
  <url>http://www.*****.lk/apk/myapk.apk</url>
</update>
fxp528 commented 6 years ago

@gunarathnemdd Sorry, It's too little information to judge. Make sure you can download new apk via browser. And use adb to get more debug info.

fxp528 commented 6 years ago

Recommended use "cordova-android": "6.3.0", if you want to use this plugin correctly. Moving the folder to other is strange, Because the line <source-file src="src/android" target-dir="src/com/vaenow/appupdate"/> in plugin.xml show the folder where is this. But moving the folder is ok for me in "cordova-android": "7.0.0".

gunarathnemdd commented 6 years ago

@fxp528 I think there is not a version problem. Because my app is now working without stopped. I think server is not giving access to download the apk. As I updated my previous question, I can't download it through browser.

fxp528 commented 6 years ago

@gunarathnemdd It seems like the problem is caused by your server. You need to check your server can serve static file. It's not the plugin issue.

gunarathnemdd commented 6 years ago

@fxp528 Thanks for the help. I added MIME-type: application/vnd.android.package-archive to web.config file. Then it is works fine.

johanvdb commented 6 years ago

@fxp528 Just FYI, this issue is still happening on the latest install of ionic. I had to copy the sources to get the app to run correctly.

sbangani commented 6 years ago

@johanvdb Copy the source to where?

johanvdb commented 6 years ago

From android/src/com/vaenow to android/app/src/main/java/com as mentioned above.

kashban commented 6 years ago

Any news about when this plugin will work out of the box with Cordova Android 7.0+? We cannot go back to 6.3.x because of other constraints.

EcoFreak commented 6 years ago

I use the following tasks in my ionic project's package.json file (cordova 7.0). They copy the folders when running or building the project. I'm using copyfiles to copy the folder.

    "move-files": "copyfiles -u 4 \"./platforms/android/src/com/vaenow/**\" \"platforms/android/app/src/main/java/com\"",
    "ionic:watch:before": "npm run move-files",
    "ionic:build:before": "npm run move-files",

Hope it helps ;)

thiagossi commented 5 years ago

I use the following tasks in my ionic project's package.json file (cordova 7.0). They copy the folders when running or building the project. I'm using copyfiles to copy the folder.

    "move-files": "copyfiles -u 4 \"./platforms/android/src/com/vaenow/**\" \"platforms/android/app/src/main/java/com\"",
    "ionic:watch:before": "npm run move-files",
    "ionic:build:before": "npm run move-files",

Hope it helps ;)

Hi @EcoFreak ! Where did you put this code ?

kkduniya commented 5 years ago

@ian-beer @egrendonDev My solution is move the folder in android/src/com/vaenow to android/app/src/main/java/com. I think it's wrong when installing plugin. cordova (Cordova CLI) : 8.0.0 Cordova Platforms : android 7.0.0 ios 4.3.1

remore cordova-plugin-firebase and reinstall