"Package file is invalid", solution by the developer (Android)

I’m tired of seeing a lot of Stackoverflow questions about this, even in Google forums or the official Google support site, posting “solutions” that lead to package removal via ADB, to do something with a rooted phone, to delete the cache of Google Play services, etc. d.

Is there a solution on the part of the package?

I mean, I have an application with hundreds of thousands of installations, and, unfortunately, many users complain about this error when updating from my new version.

Obviously, I cannot go one by one, saying that they should do this or that because they are not developers, they just want to update and launch the application!

Some users tell me (complain) that this has happened since the last attempt to update my application, and they don’t experience this “package file invalid” with any other application on their phones.

So, I think I can fix another update.

Is there a SOLUTION that I can make in the next compilation of the APK by uploading it to the Google Play Store and fixing it without "bothering" my users?

Thank you in advance

+6
source share
1 answer

I also encountered the same problem in my project. I have added many more features with the new jar, git open source library code for Nice UI.

To find a solution, I found that there is a problem in the game store in one of my updates http://www.androidcentral.com/google-investigating-package-file-invalid-errors-google-play But this does not apply to my problem at all .

Search again I found this http://birbit.com/how-to-solve-linearalloc-problem/ Thus, the solution looks like to load multiple jar files dynamically using DexClassLoader. http://android-developers.blogspot.in/2011/07/custom-class-loading-in-dalvik.html

  • Prepare the interface for the jar file (a list of all classes and methods) and get the interface in the application. You need to see how to do it. - We can just have the classes that we need in our application and ignore the other classes. Thus, we can implement several existing cans and any new banks that we must add to make sure that we are not faced with this problem again.
  • Store container in resource folder
  • Download each class from jar (based on the list of banners that we have in the interface). (Classes will be loaded only once at first start)

But on the basis of this, it seems that this is due to many changes in coding and a lot of time.

In addition, I found that facebook also encountered the same problem in its original Android application https://www.facebook.com/notes/facebook-engineering/under-the-hood-dalvik-patch-for-facebook- for-android / 10151345597798920

The final approach I took was to remove the extra code from the jar / git library project, which is not required for my application. after that, my application got installed on 2.3.X without errors.

0
source

Source: https://habr.com/ru/post/972434/


All Articles