Android 工作室 proguard 错误
Android studio proguard error
我启用混淆器来混淆我的应用程序代码。具体来说,我只会模糊应用程序的 activity,但在创建 APK 时我会遇到很多错误。如果在库中强加 proguard true,也会出现此错误。谁能帮帮我?
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "my.packname"
minSdkVersion 16
targetSdkVersion 23
versionCode 52
versionName "2.0.2"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile files('libs/commons-codec-1.8.jar')
compile files('libs/dropbox-android-sdk-1.6.3.jar')
compile files('libs/httpmime-4.0.3.jar')
compile files('libs/json_simple-1.1.jar')
compile files('libs/pass-v1.2.1.jar')
compile files('libs/sdk-v1.0.0.jar')
compile project(':library_edittext')
compile project(':aFileChooser')
compile project(':library_color_picker')
compile project(':sqlcipher-for-android')
compile project(':library_menu_main')
compile 'io.reactivex:rxjava:1.0.10'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:design:23.1.1'
}
错误:
Warning:there were 87 unresolved references to classes or interfaces.
You may need to add missing library jars or update their versions.
If your code works fine without the missing classes, you can suppress
the warnings with '-dontwarn' options.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
Warning:Exception while processing task java.io.IOException: Please correct the above warnings first.
:app:transformClassesAndResourcesWithProguardForRelease FAILED
Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.
> java.io.IOException: Please correct the above warnings first.
Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.
> java.io.IOException: Please correct the above warnings first.
如错误消息所示,如果应用 运行 正常,您可以在 proguard 文件中使用 --dontwarn 等。像这样:
-dontwarn android.support.**
-dontnote android.support.**
如果您遇到问题,则必须深入研究原因。
比如如何优化等等
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*,!code/allocation/variable
-keepparameternames
-keepattributes Signature,Exceptions,InnerClasses,Deprecated,
SourceFile,LineNumberTable,EnclosingMethod,
*Annotation*
这是一个 android 参考:https://developer.android.com/studio/build/shrink-code.html
许多图书馆也有他们图书馆的混淆器信息,这是最有帮助的。
我启用混淆器来混淆我的应用程序代码。具体来说,我只会模糊应用程序的 activity,但在创建 APK 时我会遇到很多错误。如果在库中强加 proguard true,也会出现此错误。谁能帮帮我?
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "my.packname"
minSdkVersion 16
targetSdkVersion 23
versionCode 52
versionName "2.0.2"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile files('libs/commons-codec-1.8.jar')
compile files('libs/dropbox-android-sdk-1.6.3.jar')
compile files('libs/httpmime-4.0.3.jar')
compile files('libs/json_simple-1.1.jar')
compile files('libs/pass-v1.2.1.jar')
compile files('libs/sdk-v1.0.0.jar')
compile project(':library_edittext')
compile project(':aFileChooser')
compile project(':library_color_picker')
compile project(':sqlcipher-for-android')
compile project(':library_menu_main')
compile 'io.reactivex:rxjava:1.0.10'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:design:23.1.1'
}
错误:
Warning:there were 87 unresolved references to classes or interfaces.
You may need to add missing library jars or update their versions.
If your code works fine without the missing classes, you can suppress
the warnings with '-dontwarn' options.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
Warning:Exception while processing task java.io.IOException: Please correct the above warnings first.
:app:transformClassesAndResourcesWithProguardForRelease FAILED
Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.
> java.io.IOException: Please correct the above warnings first.
Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.
> java.io.IOException: Please correct the above warnings first.
如错误消息所示,如果应用 运行 正常,您可以在 proguard 文件中使用 --dontwarn 等。像这样:
-dontwarn android.support.**
-dontnote android.support.**
如果您遇到问题,则必须深入研究原因。
比如如何优化等等
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*,!code/allocation/variable
-keepparameternames
-keepattributes Signature,Exceptions,InnerClasses,Deprecated,
SourceFile,LineNumberTable,EnclosingMethod,
*Annotation*
这是一个 android 参考:https://developer.android.com/studio/build/shrink-code.html
许多图书馆也有他们图书馆的混淆器信息,这是最有帮助的。