Bonjour, j'ai du mal à créer la version finale de mon projet. J'ai essayé beaucoup de choses sur Progaurd avec l'aide de SO/Google, mais je ne suis toujours pas en mesure de créer la version.
Quelqu'un peut-il m'aider avec ça? Je reçois toujours ce problème:
Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'. > Java.io.IOException: Please correct the above warnings first.
Voici l'erreur complète et détaillée: http://justpaste.it/perror désolé, j'ai dû mettre un lien car il est énorme.
Voici les dépendances:
//compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.Android.support:appcompat-v7:23.1.1'
compile 'com.Android.support:design:23.1.1'
compile 'com.rengwuxian.materialedittext:library:2.1.4'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.4'
compile 'org.Apache.httpcomponents:httpcore:4.4.1'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.loopj.Android:android-async-http:1.4.8'
compile 'com.Android.support:cardview-v7:23.1.1'
compile 'com.Android.support:recyclerview-v7:23.1.1'
compile project(':pageIndicator')
compile 'com.github.neopixl:PixlUI:v1.0.6'
compile 'com.github.bumptech.glide:glide:3.6.1'
Mon fichier progaurd:
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
# http://developer.Android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
-dontwarn com.google.code.**
-dontwarn org.Apache.**
-dontwarn jp.wasabeef.recyclerview.**
-dontwarn com.nostra13.universalimageloader.**
-dontwarn org.acra.**
#wasabeef recyclerview
-keep class jp.wasabeef.recyclerview.** { *; }
-keepattributes Signature
#HTTP Legacy
-keep class org.Apache.** { *; }
-keepattributes Signature
#Universal Image Loader
-keep class com.nostra13.universalimageloader.** { *; }
-keepattributes Signature
#Acra
-keep class org.acra.** { *; }
-keepattributes Signature
#Support libraries
-keep class com.Android.** { *; }
-keepattributes Signature
# Keep the annotations
-keepattributes *Annotation*
-allowaccessmodification
-keepattributes *Annotation*
-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable
-repackageclasses ''
-dontnote com.Android.vending.licensing.ILicensingService
# Explicitly preserve all serialization members. The Serializable interface
# is only a marker interface, so it wouldn't save them.
-keepclassmembers class * implements Java.io.Serializable {
static final long serialVersionUID;
private static final Java.io.ObjectStreamField[] serialPersistentFields;
private void writeObject(Java.io.ObjectOutputStream);
private void readObject(Java.io.ObjectInputStream);
Java.lang.Object writeReplace();
Java.lang.Object readResolve();
}
# Preserve all native method names and the names of their classes.
-keepclasseswithmembernames class * {
native <methods>;
}
-keepclasseswithmembernames class * {
public <init>(Android.content.Context, Android.util.AttributeSet);
}
-keepclasseswithmembernames class * {
public <init>(Android.content.Context, Android.util.AttributeSet, int);
}
# Preserve static fields of inner classes of R classes that might be accessed
# through introspection.
-keepclassmembers class **.R$* {
public static <fields>;
}
# Preserve the special static methods that are required in all enumeration classes.
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(Java.lang.String);
}
-keep public class * {
public protected *;
}
-keep class * implements Android.os.Parcelable {
public static final Android.os.Parcelable$Creator *;
}
-keep class com.splunk.** { *; }
-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 * extends Android.app.backup.BackupAgentHelper
-keep public class * extends Android.preference.Preference
-keep public class com.Android.vending.licensing.ILicensingService
-keepclasseswithmembernames class * {
native <methods>;
}
-keepclasseswithmembers class * {
public <init>(Android.content.Context, Android.util.AttributeSet);
}
-keepclasseswithmembers class * {
public <init>(Android.content.Context, Android.util.AttributeSet, int);
}
-keepclassmembers class * extends Android.app.Activity {
public void *(Android.view.View);
}
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(Java.lang.String);
}
-keep class * implements Android.os.Parcelable {
public static final Android.os.Parcelable$Creator *;
}
-keep class com.splunk.** { *; }
-dontwarn rx.**
-dontwarn okio.**
-dontwarn com.squareup.okhttp.**
-keep class com.squareup.okhttp.** { *; }
-keep interface com.squareup.okhttp.** { *; }
-keep class org.Apache.http.** { *; }
-dontwarn org.Apache.http.**
-dontwarn Android.net.**
-dontwarn retrofit.**
-dontwarn retrofit.appengine.UrlFetchClient
-keep class retrofit.** { *; }
-keepclasseswithmembers class * {
@retrofit.http.* <methods>;
}
-keepattributes Signature
-keepattributes *Annotation*
-keep class Sun.misc.Unsafe { *; }
#your package path where your gson models are stored
-keep class com.ylg.others.** { *; }
Dans votre fichier ProGuard, ajoutez:
-ignorewarnings
comme :
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in D:\Softwares\Developing\Android\sdk/tools/proguard/proguard-Android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.Android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-ignorewarnings
Vous n'avez pas à spécifier de paquet comme com.viewpagerindicator.**
, cela supprimera tous les avertissements et le Gradle Console
dira simplement:
......
Warning: there were 4 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: there were 2 unresolved references to library class members.
You probably need to update the library versions.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedlibraryclassmember)
Note: you're ignoring all warnings!
Ignoring unused library classes...
Original number of library classes: 4237
Final number of library classes: 1317
Printing kept classes, fields, and methods...
Shrinking...
......
Dans mon cas, le fichier proguard a été totalement ignoré car le projet consistait en plusieurs modules. Selon cette réponse , la solution consistait à définir les éléments suivants dans la hiérarchie du module à l'origine du problème:
defaultConfig {
consumerProguardFiles 'proguard-rules.txt'
}
Cela semble inclure la progression du module dans la progression de l'application. Maintenant, mes déclarations dontwarn
sont prises en compte.
Ce qui m'a aidé était de mettre à jour toutes les dépendances avec la dernière version.