web-dev-qa-db-fra.com

Proguard et erreur

J'utilise ce fichier proguard:

 -dontskipnonpubliclibraryclasses
 -dontskipnonpubliclibraryclassmembers

 !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/*
 -optimizationpasses 10
 -allowaccessmodification
 -mergeinterfacesaggressively
 -overloadaggressively

 -assumenosideeffects class Android.util.Log {
*;
 }

-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.BackupAgent
-keep public class * extends Android.preference.Preference
-keep public class * extends Android.support.v4.app.Fragment
-keep public class * extends Android.support.v4.app.DialogFragment
-keep public class * extends com.actionbarsherlock.app.SherlockListFragment
-keep public class * extends com.actionbarsherlock.app.SherlockFragment
-keep public class * extends com.actionbarsherlock.app.SherlockFragmentActivity
-keep public class * extends Android.app.Fragment
-keep public class com.Android.vending.licensing.ILicensingService
-keep public class org.jsoup.** {
public *;
}

-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);
}

-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 *;
}

-keepclassmembers class **.R$* {
 public static <fields>;
}

-keep class Android.support.v4.app.** { *; }
-keep interface Android.support.v4.app.** { *; }
-keep class com.actionbarsherlock.** { *; }
-keep interface com.actionbarsherlock.** { *; }

-keep class com.google.ads.** {*;}
-keep class com.google.ads.internal.** {*;}
-keep class com.google.ads.mediation.** {*;}
-keep class com.google.ads.mediation.adfonic.** {*;}
-keep class com.google.ads.mediation.admob.** {*;}
-keep class com.google.ads.mediation.adfonic.util.** {*;}
-keep class com.google.ads.mediation.customevent.** {*;}
-keep class com.google.ads.searchads.** {*;}
-keep class com.google.ads.util.** {*;}

-dontwarn Android.support.**
-dontwarn com.google.ads.**

Mais après quelques mises à jour sur le code, j'ai les erreurs suivantes:

Warning:com.google.Android.gms.internal.zzw$zza: can't find superclass or interface org.Apache.http.client.methods.HttpEntityEnclosingRequestBase
Warning:com.google.Android.gms.analytics.internal.zzam: can't find referenced class org.Apache.http.NameValuePair
Warning:com.google.Android.gms.analytics.internal.zzam: can't find referenced class org.Apache.http.client.utils.URLEncodedUtils
Warning:com.google.Android.gms.analytics.internal.zzam: can't find referenced class org.Apache.http.NameValuePair
Warning:com.google.Android.gms.analytics.internal.zzj: can't find referenced class org.Apache.http.NameValuePair
Warning:com.google.Android.gms.analytics.internal.zzj: can't find referenced class org.Apache.http.client.utils.URLEncodedUtils
Warning:com.google.Android.gms.analytics.internal.zzj: can't find referenced class org.Apache.http.NameValuePair
Warning:com.google.Android.gms.internal.zzac: can't find referenced class Android.net.http.AndroidHttpClient
Warning:com.google.Android.gms.internal.zzqt: can't find referenced class org.Apache.http.HttpEntity
Warning:com.google.Android.gms.internal.zzqt: can't find referenced class org.Apache.http.HttpResponse
Warning:com.google.Android.gms.internal.zzqt: can't find referenced class org.Apache.http.StatusLine
Warning:com.google.Android.gms.internal.zzqt: can't find referenced class org.Apache.http.client.HttpClient
Warning:com.google.Android.gms.internal.zzqt: can't find referenced class org.Apache.http.client.methods.HttpGet
Warning:com.google.Android.gms.internal.zzqt: can't find referenced class org.Apache.http.conn.ClientConnectionManager
Warning:com.google.Android.gms.internal.zzqt: can't find referenced class org.Apache.http.impl.client.DefaultHttpClient
Warning:com.google.Android.gms.internal.zzqt: can't find referenced class org.Apache.http.params.BasicHttpParams
Warning:com.google.Android.gms.internal.zzqt: can't find referenced class org.Apache.http.client.methods.HttpGet
Warning:com.google.Android.gms.internal.zzqt: can't find referenced class org.Apache.http.impl.client.DefaultHttpClient
Warning:com.google.Android.gms.internal.zzqt: can't find referenced class org.Apache.http.params.BasicHttpParams
Warning:com.google.Android.gms.internal.zzqt: can't find referenced class org.Apache.http.HttpEntity
Warning:com.google.Android.gms.internal.zzqt: can't find referenced class org.Apache.http.HttpResponse
Warning:com.google.Android.gms.internal.zzqt: can't find referenced class org.Apache.http.StatusLine
Warning:com.google.Android.gms.internal.zzqt: can't find referenced class org.Apache.http.client.HttpClient
Warning:com.google.Android.gms.internal.zzqt: can't find referenced class org.Apache.http.conn.ClientConnectionManager
Warning:com.google.Android.gms.internal.zzqt: can't find referenced class org.Apache.http.client.HttpClient
Warning:com.google.Android.gms.internal.zzqt: can't find referenced class org.Apache.http.HttpResponse
Warning:com.google.Android.gms.internal.zzqt: can't find referenced class org.Apache.http.client.HttpClient
Warning:com.google.Android.gms.internal.zzt: can't find referenced class org.Apache.http.Header
Warning:com.google.Android.gms.internal.zzt: can't find referenced class org.Apache.http.HttpEntity
Warning:com.google.Android.gms.internal.zzt: can't find referenced class org.Apache.http.HttpResponse
Warning:com.google.Android.gms.internal.zzt: can't find referenced class org.Apache.http.StatusLine
Warning:com.google.Android.gms.internal.zzt: can't find referenced class org.Apache.http.impl.cookie.DateUtils
Warning:com.google.Android.gms.internal.zzt: can't find referenced class org.Apache.http.Header
Warning:com.google.Android.gms.internal.zzt: can't find referenced class org.Apache.http.HttpEntity
Warning:com.google.Android.gms.internal.zzt: can't find referenced class org.Apache.http.HttpResponse
Warning:com.google.Android.gms.internal.zzt: can't find referenced class org.Apache.http.StatusLine
Warning:com.google.Android.gms.internal.zzt: can't find referenced class org.Apache.http.HttpEntity
Warning:com.google.Android.gms.internal.zzt: can't find referenced class org.Apache.http.Header
Warning:com.google.Android.gms.internal.zzw: can't find referenced class org.Apache.http.client.HttpClient
Warning:com.google.Android.gms.internal.zzw: can't find referenced class org.Apache.http.client.methods.HttpDelete
Warning:com.google.Android.gms.internal.zzw: can't find referenced class org.Apache.http.client.methods.HttpEntityEnclosingRequestBase
Warning:com.google.Android.gms.internal.zzw: can't find referenced class org.Apache.http.client.methods.HttpGet
Warning:com.google.Android.gms.internal.zzw: can't find referenced class org.Apache.http.client.methods.HttpHead
Warning:com.google.Android.gms.internal.zzw: can't find referenced class org.Apache.http.client.methods.HttpOptions
Warning:com.google.Android.gms.internal.zzw: can't find referenced class org.Apache.http.client.methods.HttpPost
Warning:com.google.Android.gms.internal.zzw: can't find referenced class org.Apache.http.client.methods.HttpPut
Warning:com.google.Android.gms.internal.zzw: can't find referenced class org.Apache.http.client.methods.HttpTrace
Warning:com.google.Android.gms.internal.zzw: can't find referenced class org.Apache.http.client.methods.HttpUriRequest
Warning:com.google.Android.gms.internal.zzw: can't find referenced class org.Apache.http.entity.ByteArrayEntity
Warning:com.google.Android.gms.internal.zzw: can't find referenced method 'void addHeader(Java.lang.String,Java.lang.String)' in program class com.google.Android.gms.internal.zzw$zza
Warning:com.google.Android.gms.internal.zzw: can't find referenced class org.Apache.http.client.methods.HttpDelete
Warning:com.google.Android.gms.internal.zzw: can't find referenced class org.Apache.http.client.methods.HttpEntityEnclosingRequestBase
Warning:com.google.Android.gms.internal.zzw: can't find referenced class org.Apache.http.client.methods.HttpGet
Warning:com.google.Android.gms.internal.zzw: can't find referenced class org.Apache.http.client.methods.HttpHead
Warning:com.google.Android.gms.internal.zzw: can't find referenced class org.Apache.http.client.methods.HttpOptions
Warning:com.google.Android.gms.internal.zzw: can't find referenced class org.Apache.http.client.methods.HttpPost
Warning:com.google.Android.gms.internal.zzw: can't find referenced class org.Apache.http.client.methods.HttpPut
Warning:com.google.Android.gms.internal.zzw: can't find referenced class org.Apache.http.client.methods.HttpTrace
Warning:com.google.Android.gms.internal.zzw: can't find referenced class org.Apache.http.entity.ByteArrayEntity
Warning:com.google.Android.gms.internal.zzw: can't find referenced class org.Apache.http.client.HttpClient
Warning:com.google.Android.gms.internal.zzw: can't find referenced class org.Apache.http.client.methods.HttpUriRequest
Warning:com.google.Android.gms.internal.zzw: can't find referenced class org.Apache.http.client.HttpClient
Warning:com.google.Android.gms.internal.zzw: can't find referenced class org.Apache.http.client.methods.HttpUriRequest
Warning:com.google.Android.gms.internal.zzw: can't find referenced class org.Apache.http.HttpResponse
Warning:com.google.Android.gms.internal.zzw: can't find referenced class org.Apache.http.client.methods.HttpUriRequest
Warning:com.google.Android.gms.internal.zzw: can't find referenced class org.Apache.http.client.methods.HttpEntityEnclosingRequestBase
Warning:com.google.Android.gms.internal.zzw: can't find referenced class org.Apache.http.client.methods.HttpUriRequest
Warning:com.google.Android.gms.internal.zzw$zza: can't find referenced class org.Apache.http.client.methods.HttpEntityEnclosingRequestBase
Warning:com.google.Android.gms.internal.zzw$zza: can't find referenced method 'void setURI(Java.net.URI)' in program class com.google.Android.gms.internal.zzw$zza
Warning:com.google.Android.gms.internal.zzw$zza: can't find referenced class org.Apache.http.client.methods.HttpEntityEnclosingRequestBase
Warning:com.google.Android.gms.internal.zzx: can't find referenced class org.Apache.http.impl.cookie.DateParseException
Warning:com.google.Android.gms.internal.zzx: can't find referenced class org.Apache.http.impl.cookie.DateUtils
Warning:com.google.Android.gms.internal.zzy: can't find referenced class org.Apache.http.HttpResponse
Warning:com.google.Android.gms.internal.zzz: can't find referenced class org.Apache.http.ProtocolVersion
Warning:com.google.Android.gms.internal.zzz: can't find referenced class org.Apache.http.entity.BasicHttpEntity
Warning:com.google.Android.gms.internal.zzz: can't find referenced class org.Apache.http.message.BasicHeader
Warning:com.google.Android.gms.internal.zzz: can't find referenced class org.Apache.http.message.BasicHttpResponse
Warning:com.google.Android.gms.internal.zzz: can't find referenced class org.Apache.http.message.BasicStatusLine
Warning:com.google.Android.gms.internal.zzz: can't find referenced class org.Apache.http.ProtocolVersion
Warning:com.google.Android.gms.internal.zzz: can't find referenced class org.Apache.http.entity.BasicHttpEntity
Warning:com.google.Android.gms.internal.zzz: can't find referenced class org.Apache.http.message.BasicHeader
Warning:com.google.Android.gms.internal.zzz: can't find referenced class org.Apache.http.message.BasicHttpResponse
Warning:com.google.Android.gms.internal.zzz: can't find referenced class org.Apache.http.message.BasicStatusLine
Warning:com.google.Android.gms.internal.zzz: can't find referenced class org.Apache.http.HttpResponse
Warning:com.google.Android.gms.internal.zzz: can't find referenced class org.Apache.http.HttpEntity
Warning:com.google.Android.gms.tagmanager.zzby: can't find referenced class org.Apache.http.impl.client.DefaultHttpClient
Warning:com.google.Android.gms.tagmanager.zzcx: can't find referenced class org.Apache.http.Header
Warning:com.google.Android.gms.tagmanager.zzcx: can't find referenced class org.Apache.http.HttpEntity
Warning:com.google.Android.gms.tagmanager.zzcx: can't find referenced class org.Apache.http.HttpEntityEnclosingRequest
Warning:com.google.Android.gms.tagmanager.zzcx: can't find referenced class org.Apache.http.HttpHost
Warning:com.google.Android.gms.tagmanager.zzcx: can't find referenced class org.Apache.http.HttpResponse
Warning:com.google.Android.gms.tagmanager.zzcx: can't find referenced class org.Apache.http.StatusLine
Warning:com.google.Android.gms.tagmanager.zzcx: can't find referenced class org.Apache.http.client.ClientProtocolException
Warning:com.google.Android.gms.tagmanager.zzcx: can't find referenced class org.Apache.http.client.HttpClient
Warning:com.google.Android.gms.tagmanager.zzcx: can't find referenced class org.Apache.http.message.BasicHttpEntityEnclosingRequest
Warning:com.google.Android.gms.tagmanager.zzcx: can't find referenced class org.Apache.http.HttpHost
Warning:com.google.Android.gms.tagmanager.zzcx: can't find referenced class org.Apache.http.message.BasicHttpEntityEnclosingRequest
Warning:com.google.Android.gms.tagmanager.zzcx: can't find referenced class org.Apache.http.HttpEntity
Warning:com.google.Android.gms.tagmanager.zzcx: can't find referenced class org.Apache.http.HttpEntityEnclosingRequest
Warning:com.google.Android.gms.tagmanager.zzcx: can't find referenced class org.Apache.http.HttpResponse
Warning:com.google.Android.gms.tagmanager.zzcx: can't find referenced class org.Apache.http.StatusLine
Warning:com.google.Android.gms.tagmanager.zzcx: can't find referenced class org.Apache.http.client.HttpClient
Warning:com.google.Android.gms.tagmanager.zzcx: can't find referenced class org.Apache.http.HttpEntityEnclosingRequest

J'ai essayé avec:

-keep class org.Apache.http.**
-keep interface org.Apache.http.**
-dontwarn org.Apache.**

Mais ça ne marche toujours pas, qu'est-ce qui ne va pas? Je ne comprends vraiment pas ce que je peux faire ... PS. Avez-vous des suggestions pour optimiser mon fichier?.

15
helloimyourmind

J'ai eu le même problème.

J'ai trouvé la réponse ici et cela a fonctionné pour moi: Comment ajouter l'API HTTP Apache (héritée) en tant que dépendance de compilation à build.grade?

Dans votre fichier build.gradle de niveau supérieur, ajoutez:

buildscript {
    ...
    dependencies {
        classpath 'com.Android.tools.build:gradle:1.3.1'
    }
}
...

Dans votre fichier build.gradle spécifique à l'application, ajoutez:

Android {
    compileSdkVersion 23
    buildToolsVersion "23.0.0"
    useLibrary 'org.Apache.http.legacy'
    ...
}

J'espère que ça marche pour toi! cela fonctionne maintenant avec ProGuard sur. J'ai eu exactement le même problème que toi. 

34
gbhall

Il semble que l'avertissement vienne de la bibliothèque Google. Avez-vous déjà essayé quelque chose comme ça:

-dontwarn com.google.Android.gms.**
-keep class com.google.Android.gms.**

J'essaierais aussi sans la variable dontwarn car je suppose que vous voulez être averti s'il y a quelque chose à propos de laquelle il faut être averti!

15
Distwo

Dans Eclipse, recherchez org.Apache.http.legacy.jar dans ..sdk/plateformes/Android-23/facultatif.

Importez-le comme un pot externe, vérifiez l'ordre/l'exportation et dans le type de programme:

-keep class org.Apache.http.** { *; }
-keepclassmembers class org.Apache.http.** {*;}
-dontwarn org.Apache.**

-keep class Android.net.http.** { *; }
-keepclassmembers class Android.net.http.** {*;}
-dontwarn Android.net.**
9
Samarakande

Ajoutez les lignes suivantes dans votre fichier proguard.

-keep class org.Apache.http.** { *; }
-keep class org.Apache.** { *; }
-dontwarn org.Apache.**
-dontwarn org.Apache.http.**
-dontwarn org.Apache.commons.**
1
Manoj Tarkar