我一直在試圖讓ProGuard
運行過去2天,就是無法擺脫這個問題。ProGuard無法讀取android-support-v13.jar(;;;;;; META-INF/MANIFEST.MF)(重複的zip條目[android-support-v13.jar:])
完整的錯誤
產生java.io.IOException:無法寫入[/PATH_TO_POJECT/build/intermediates/classes-proguard/release/classes.jar](無法讀取[/ PATH_TO_POJECT /build/intermediates/exploded-aar/com.facebook.android/FaceBook320/3.20.0/libs/android-support-v13.jar(;;;;;;;META-INF/MANIFEST.MF)](重複郵編進入[Android的支持,v13.jar:安卓/支持/ V13 /應用/ FragmentCompat $ ICSFragmentCompatImpl.class))
我使用Android Studio
。我的項目包含幾個不同的模塊,其中兩個模塊取決於android-support-v13.jar
。我確定android-support-v13.jar
在每個模塊中都是相同的。
我也試過,不包括模塊的支持jar文件,像這樣: 的build.gradle
compile (project(':FaceBook320')){
exclude module: 'support-v13'
exclude module: 'support-v4'
}
但我仍然得到同樣的錯誤。
我proguard-project.pro
:
-optimizationpasses 5
#When not preverifing in a case-insensitive filing system, such as Windows. Because this tool unpacks your processed jars, you should then use:
-dontusemixedcaseclassnames
#Specifies not to ignore non-public library classes. As of version 4.5, this is the default setting
-dontskipnonpubliclibraryclasses
#Preverification is irrelevant for the dex compiler and the Dalvik VM, so we can switch it off with the -dontpreverify option.
-dontpreverify
#Specifies to write out some more information during processing. If the program terminates with an exception, this option will print out the entire stack trace, instead of just the exception message.
-verbose
#The -optimizations option disables some arithmetic simplifications that Dalvik 1.0 and 1.5 can't handle. Note that the Dalvik VM also can't handle aggressive overloading (of static fields).
#To understand or change this check http://proguard.sourceforge.net/index.html#/manual/optimizations.html
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
#To repackage classes on a single package
#-repackageclasses ''
#Uncomment if using annotations to keep them.
#-keepattributes *Annotation*
#Keep classes that are referenced on the AndroidManifest
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class com.android.vending.licensing.ILicensingService
#To remove debug logs:
-assumenosideeffects class android.util.Log {
public static *** d(...);
public static *** v(...);
}
#To avoid changing names of methods invoked on layout's onClick.
# Uncomment and add specific method names if using onClick on layouts
#-keepclassmembers class * {
# public void onClickButton(android.view.View);
#}
#Maintain java native methods
-keepclasseswithmembernames class * {
native <methods>;
}
#To maintain custom components names that are used on layouts XML.
#Uncomment if having any problem with the approach below
#-keep public class custom.components.package.and.name.**
#To maintain custom components names that are used on layouts XML:
-keep public class * extends android.view.View {
public <init>(android.content.Context);
public <init>(android.content.Context, android.util.AttributeSet);
public <init>(android.content.Context, android.util.AttributeSet, int);
public void set*(...);
}
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet);
}
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}
#Maintain enums
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
#To keep parcelable classes (to serialize - deserialize objects to sent through Intents)
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
#Keep the R
-keepclassmembers class **.R$* {
public static <fields>;
}
#Results classes that only extend a generic should be preserved as they will be pruned by Proguard
#as they are "empty", others are kept
-keep class com.project.models.**
-keep class com.project.models.singleton.**
#RoboSpice requests should be preserved in most cases
-keepclassmembers class com.project.requests.** {
public void set*(***);
public *** get*();
public *** is*();
}
#if you use public fields instead of setter/getters for your REST POJOs, add this
-keepclassmembers class com.project.models.** {
public <fields>;
}
### Jackson SERIALIZER SETTINGS
-keepclassmembers,allowobfuscation class * {
@org.codehaus.jackson.annotate.* <fields>;
@org.codehaus.jackson.annotate.* <init>(...);
}
### Simple XML SERIALIZER SETTINGS
-keepclassmembers,allowobfuscation class * {
@org.simpleframework.xml.* <fields>;
@org.simpleframework.xml.* <init>(...);
}
-dontskipnonpubliclibraryclassmembers
-keepattributes *Annotation*,EnclosingMethod
-keepnames class org.codehaus.jackson.** { *; }
#Warnings to be removed. Otherwise maven plugin stops, but not dangerous
-dontwarn android.support.**
-dontwarn android.support.v4.**
-dontwarn android.support.v13.**
-dontwarn com.sun.xml.internal.**
-dontwarn com.sun.istack.internal.**
-dontwarn org.codehaus.jackson.**
-dontwarn org.springframework.**
-dontwarn java.awt.**
-dontwarn javax.security.**
-dontwarn java.beans.**
-dontwarn javax.xml.**
-dontwarn java.util.**
-dontwarn org.w3c.dom.**
-dontwarn com.google.common.**
-dontwarn com.octo.android.robospice.persistence.**
#-optimizationpasses 5
-dontoptimize
-keep class twitter4j.CommonsLoggingLoggerFactory
-dontwarn twitter4j.CommonsLoggingLoggerFactory
-keep class twitter4j.Log4JLogger
-dontwarn twitter4j.Log4JLogger
-keep class twitter4j.Log4JLoggerFactory
-dontwarn twitter4j.Log4JLoggerFactory
-keep class twitter4j.management.APIStatisticsOpenMBean
-dontwarn twitter4j.management.APIStatisticsOpenMBean
-keep class twitter4j.management.APIStatisticsOpenMBean
-dontwarn twitter4j.management.APIStatisticsOpenMBean
-keep class twitter4j.SLF4JLogger
-dontwarn twitter4j.SLF4JLogger
-keep class twitter4j.SLF4JLoggerFactory4
-dontwarn twitter4j.SLF4JLoggerFactory
-keep class twitter4j.TwitterAPIMonitor
-dontwarn twitter4j.TwitterAPIMonitor
-keep class android.support.v4.app.** { *; }
-keep class android.support.v4.** { *; }
-keep class android.support.v13.**{ *;}
-keep interface android.support.v4.app.** { *; }
-keep class android.support.v13.app.** { *; }
-keep interface android.support.v13.app.** { *; }
#Preverification is irrelevant for the dex compiler and the Dalvik VM, so we can switch it off with the -dontpreverify option.
-dontpreverify
#To remove debug logs:
-assumenosideeffects class android.util.Log {
public static *** d(...);
public static *** v(...);
}
#Facebook
-keep class com.facebook.** { *; }
-keepattributes Signature
#Google Play Services
-keep class * extends java.util.ListResourceBundle {
protected Object[][] getContents();
}
-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
public static final *** NULL;
}
-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
@com.google.android.gms.common.annotation.KeepName *;
}
-keepnames class * implements android.os.Parcelable {
public static final ** CREATOR;
}
我的全build.gradle
:
apply plugin: 'com.android.application'
repositories {
mavenCentral()
}
dependencies {
//There is an android-support-v13.jar in the libs folder.
compile fileTree(dir: 'libs', include: '*.jar')
compile project(':PullToRefresh')
compile project(':PinnedListView')
compile ('com.google.android.gms:play-services:6.1.71'){
exclude module: 'support-v13'
exclude module: 'support-v4'
}
//The FaceBook320 project depends on android-support-v13.jar
compile (project(':FaceBook320')){
exclude module: 'support-v13'
exclude module: 'support-v4'
}
//The PagerSlidingTabStrip project depends on android-support-v13.jar
compile (project(':PagerSlidingTabStrip')){
exclude module: 'support-v13'
exclude module: 'support-v4'
}
}
android {
compileSdkVersion 19
buildToolsVersion "20.0.0"
packagingOptions {
exclude 'LICENSE.txt'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/dependencies'
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/LICENSE'
exclude 'META-INF/license'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/notice'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/README.txt'
exclude 'META-INF/services/javax.annotation.processing.Processor'
exclude '!META-INF/MANIFEST.MF'
exclude 'META-INF/MANIFEST.MF'
}
lintOptions {
checkReleaseBuilds true
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
signingConfigs {
debug {
storeFile file("secret.keystore")
storePassword "secret"
keyAlias "secret"
keyPassword "secret"
}
release {
storeFile file("secret.keystore")
storePassword "secret"
keyAlias "secret"
keyPassword "secret"
}
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
// see http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Types
buildTypes {
debug {
applicationIdSuffix ""
versionNameSuffix ""
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.pro'
signingConfig signingConfigs.debug
}
release {
applicationIdSuffix ""
versionNameSuffix ""
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.pro'
signingConfig signingConfigs.release
}
}
}
}
編輯:運行後gradlew androidDependencies
+--- LOCAL: android-support-v13.jar
+--- LOCAL: commons-io-1.3.2.jar
+--- LOCAL: commons-lang3-3.1.jar
+--- LOCAL: jackson-annotations-2.3.1.jar
+--- LOCAL: jackson-core-2.3.1.jar
+--- LOCAL: jackson-databind-2.3.1.jar
+--- LOCAL: libGoogleAnalyticsServices.jar
+--- LOCAL: robospice-1.4.9.jar
+--- LOCAL: robospice-cache-1.4.9.jar
+--- LOCAL: robospice-spring-android-1.4.9.jar
+--- LOCAL: spring-android-auth-1.0.1.RELEASE.jar
+--- LOCAL: spring-android-core-1.0.1.RELEASE.jar
+--- LOCAL: spring-android-rest-template-1.0.1.RELEASE.jar
+--- LOCAL: twitter4j-core-4.0.1.jar
+--- Droid_AS:PullToRefresh:unspecified
| \--- Droid_AS:PinnedListView:unspecified
+--- Droid_AS:PinnedListView:unspecified
+--- com.google.android.gms:play-services:6.1.71
+--- com.facebook.android:FaceBook320:3.20.0
| \--- LOCAL: android-support-v13.jar
\--- Droid_AS:PagerSlidingTabStrip:unspecified
\--- LOCAL: android-support-v13.jar
我已經看了大概幾乎每張貼在此問題和哈已經嘗試了一切,請幫助! 謝謝!
請提供完整的build.gradle,看看發生了什麼。 – gio 2014-12-07 21:53:29
用我的完整build.gradle更新。 – Sakiboy 2014-12-07 22:01:59
也請在您的項目中提供'gradlew androidDependencies'命令的結果,它會顯示項目中所有依賴關係的結構。 – gio 2014-12-07 22:20:32