Saturday, 22 May 2021

Gradle tools 4.1.0 and higher APK generation problem

I am using Android Studio version 4.2. I updated gradle tools to version 4.1.3 on a project and I started having problems with the generated APK.

In some cases on Android I dynamically load APKs and also manually extract some native libs from the APK by unzipping the files and now this unzipping is not working.

After a lot of digging I found something very strange that is the probable cause of the problems I have. When I generate an APK using "Build"->"Generated Signed APK" with the APK option, using 7-ZIP I unzip the APK file and I get these errors: Headers error Unconfirmed start of archive Warnings: There are some data after the end of the payload data

So I thought it could be a problem with my project and I tried another thing:

1-I create a new project with Android Studio (Basic Activity) It gives me a new project using Android SDK 30 and Gradle like this: classpath "com.android.tools.build:gradle:4.2.0"

2-I don't change anything in my project and I Build a signed APK. If I try to unzip it with 7-ZIP I get that error.

3-I start rolling back gradle tools to 4.1.3 and 4.1.0 and I have the same problem

4-But if I configure gradle like this: classpath "com.android.tools.build:gradle:4.0.2" And build a new APK than I do not get any errors unzipping the APK anymore

So, does anyone know of some change in versions 4.1.0 or higher that causes problems building APKs, or something that has changed in how the APKs are compressed and makes unzipping them to have problems?



from Gradle tools 4.1.0 and higher APK generation problem

No comments:

Post a Comment