Android Gradle build result apk contains both running and not obfuscated classes

When creating my android project, I added the following to the build.gradle file to enable proguard:

buildTypes { release { runProguard true proguardFile 'proguard-project.txt' proguardFile '../common/proguard-shared.txt' proguardFile getDefaultProguardFile('proguard-android.txt') } } 

Everything builds fine, but when I parse the resulting dex file, it turns out that there are confused and not obfuscated files.

For example, both common.Base64 and common.a exist, the first is not confusing, and the second is.

I’m not sure that this is connected, but the project itself has a non-standard structure. This is the result of the fact that we have a large Android database with over 40 Android applications. We are trying to create an assembly stream based on gradle side by side of an existing eclipse based assembly.

If everything goes well, we intend to change the file structure to a more native gradle and start using flavors and build types to get rid of many of the libraries that we created to satisfy the lack of flaws and for example.

Project E above relies on a chain of such libraries:

E → D → C → B → A

eg. Project E depends on library D, which depends on library C ... up to A.

+6
source share
1 answer

After studying this, I found that this is a problem if you first created without using proguard and then created it with it turned on. This is due to the incremental dex mode.

You can do a clean build after turning on proguard, and this will fix it.

Edit: I pointed out earlier that you can disable incremental mode in dex, but it turns out that this doesn't really help!

+7
source

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


All Articles