Android obfuscate app using proguard keeps obfuscating library jars - or is it?

社会主义新天地 提交于 2019-11-28 04:43:11

You have commented your library jar directives in the Proguard config.
Change:

# -libraryjars /libs/protobuf-2.3.0.jar
# -libraryjars /libs/libmessaging.jar

to:

-libraryjars /libs/protobuf-2.3.0.jar
-libraryjars /libs/libmessaging.jar

(and then don't bother defining your library jars in your build.xml)

EDIT:
I found another way to make Proguard leave library jars alone was to ask it to preserve their package names, eg:

-keep class javax.** { *; }
-keep class org.** { *; }
-keep class twitter4j.** { *; }
Percy Vega

I had a similar problem when proGuard encrypted the jsoup lib. I fixed it by adding the following to my proguard-rules.txt:

-keep class org.jsoup** {
    *;
}

So the build.gradle will end up with the following section:

release {
    minifyEnabled true
    proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!