dexguard 库无法加密 类
dexguard library cannot encrypt classes
我尝试在我的 android 库项目中加密 类。但我不能那样做。变量和字符串由 dexguard 更改,但不受 -encrypt类 的影响。我在构建输出中收到日志:
Warning: not encrypting kept class com.justexample.SomeClass1
Warning: not encrypting kept class com.justexample.SomeClass2
Warning: the configuration specifies to encrypt 2 classes that it keeps at the same time.
Not encrypting those classes to avoid problems at runtime.
Note: inner class com.justexample.SomeClass1 is unencrypted, while its outer class is encrypted.
Note: inner class com.justexample.SomeClass2 is unencrypted, while its outer class is encrypted.
Note: one or more encrypted classes have unencrypted inner classes.
我的 dexguard-project.txt 是:
-verbose
-encryptstrings com.justexample.SomeClass1
-encryptclasses com.justexample.SomeClass1, com.justexample.SomeClass2
我的 gradle 模块:
apply plugin: 'com.android.library'
apply plugin: 'dexguard'
android {
compileSdkVersion 25
defaultConfig {
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName gitVersionName()
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFile getDefaultDexGuardFile('dexguard-library-release.pro')
proguardFile 'dexguard-project.txt'
}
}
sourceSets { main {
assets.srcDirs = ['src/main/assets', 'src/androidTest/assets/']
} }
}
dependencies {
//my dependecies
}
您正在使用默认库配置:dexguard-library-release.pro 默认情况下将保留所有 public / protected 类.
您无法对保留的 类 进行加密。
要解决该问题,请使用积极的配置:dexguard-library-release-aggressive.pro 并指定不应混淆的库的 public API。
别忘了使用-repackage类 com.mypackage.internal
将所有经过混淆的 类 移动到此包中。
我尝试在我的 android 库项目中加密 类。但我不能那样做。变量和字符串由 dexguard 更改,但不受 -encrypt类 的影响。我在构建输出中收到日志:
Warning: not encrypting kept class com.justexample.SomeClass1
Warning: not encrypting kept class com.justexample.SomeClass2
Warning: the configuration specifies to encrypt 2 classes that it keeps at the same time.
Not encrypting those classes to avoid problems at runtime.
Note: inner class com.justexample.SomeClass1 is unencrypted, while its outer class is encrypted.
Note: inner class com.justexample.SomeClass2 is unencrypted, while its outer class is encrypted.
Note: one or more encrypted classes have unencrypted inner classes.
我的 dexguard-project.txt 是:
-verbose
-encryptstrings com.justexample.SomeClass1
-encryptclasses com.justexample.SomeClass1, com.justexample.SomeClass2
我的 gradle 模块:
apply plugin: 'com.android.library'
apply plugin: 'dexguard'
android {
compileSdkVersion 25
defaultConfig {
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName gitVersionName()
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFile getDefaultDexGuardFile('dexguard-library-release.pro')
proguardFile 'dexguard-project.txt'
}
}
sourceSets { main {
assets.srcDirs = ['src/main/assets', 'src/androidTest/assets/']
} }
}
dependencies {
//my dependecies
}
您正在使用默认库配置:dexguard-library-release.pro 默认情况下将保留所有 public / protected 类.
您无法对保留的 类 进行加密。
要解决该问题,请使用积极的配置:dexguard-library-release-aggressive.pro 并指定不应混淆的库的 public API。
别忘了使用-repackage类 com.mypackage.internal
将所有经过混淆的 类 移动到此包中。