cordova-plugin-app-update icon indicating copy to clipboard operation
cordova-plugin-app-update copied to clipboard

Unfortunately Myapp has stopped.

Open arinze1008 opened this issue 7 years ago • 30 comments

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

arinze1008 avatar Jan 25 '18 05:01 arinze1008

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

vaenow avatar Jan 26 '18 13:01 vaenow

Its sill not working on version 1.5.2

shivamsngh avatar Jan 29 '18 09:01 shivamsngh

What phone model do you use?

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

vaenow avatar Jan 29 '18 09:01 vaenow

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

arinze1008 avatar Jan 29 '18 11:01 arinze1008

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

vaenow avatar Jan 29 '18 12:01 vaenow

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

ian-beer avatar Jan 29 '18 19:01 ian-beer

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

vaenow avatar Jan 30 '18 02:01 vaenow

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

arthursp avatar Jan 30 '18 15:01 arthursp

@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.

egrendonDev avatar Jan 31 '18 02:01 egrendonDev

@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

fxp528 avatar Feb 02 '18 13:02 fxp528

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

arthursp avatar Feb 05 '18 15:02 arthursp

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

vaenow avatar Feb 06 '18 07:02 vaenow

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

khaled9544 avatar Feb 27 '18 15:02 khaled9544

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

rexpie avatar Apr 26 '18 06:04 rexpie

@egrendonDev Your method is effective!

li-wen-qi avatar May 03 '18 11:05 li-wen-qi

@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

rafaelbrier avatar May 09 '18 23:05 rafaelbrier

@fxp528 Thanks for saving my time. This works fine

gunarathnemdd avatar May 31 '18 04:05 gunarathnemdd

@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>

gunarathnemdd avatar May 31 '18 08:05 gunarathnemdd

@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 avatar May 31 '18 08:05 fxp528

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".

fxp528 avatar May 31 '18 09:05 fxp528

@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.

gunarathnemdd avatar May 31 '18 09:05 gunarathnemdd

@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.

fxp528 avatar May 31 '18 11:05 fxp528

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

gunarathnemdd avatar Jun 01 '18 04:06 gunarathnemdd

@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.

johanvdb avatar Jul 18 '18 05:07 johanvdb

@johanvdb Copy the source to where?

sbangani avatar Aug 30 '18 13:08 sbangani

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

johanvdb avatar Aug 31 '18 09:08 johanvdb

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.

kashban avatar Aug 31 '18 12:08 kashban

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 ;)

EcoFreak avatar Oct 29 '18 17:10 EcoFreak

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 ?

thiagossi avatar Nov 29 '18 15:11 thiagossi

@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

kkduniya avatar Jul 28 '19 11:07 kkduniya