proguard 中的否定符(感叹号)应该允许我保留 apache 库之外的其他内容:
-keep class !org.apache.**
Run Code Online (Sandbox Code Playgroud)
根据这些答案。这就是要走的路:
但是,它混淆了我的 APK 中的所有类。
这是我的 build.gradle 的一部分(我有 Android Studio 3.5.3)
compileSdkVersion 29
buildToolsVersion "29.0.2"
//...
buildTypes {
release {
minifyEnabled true
proguardFiles /*getDefaultProguardFile('proguard-android.txt'),*/ 'proguard-rules.pro'
// Enables resource shrinking, which is performed by the
// Android Gradle plugin.
shrinkResources false
}
}
dependencies {
//Utility libs
implementation 'org.apache.commons:commons-collections4:4.1'
implementation 'org.apache.commons:commons-lang3:3.4'
implementation group: 'commons-io', name: 'commons-io', version: '2.5'
}
Run Code Online (Sandbox Code Playgroud)
添加 …