Proguard dando "Warning: org.msgpack. *"

Utilizando Eclipse para exportar mi proyecto, obtengo las siguientes advertencias:

[2013-08-20 10:45:24 - MyProj] Proguard returned with error code 1. See console [2013-08-20 10:45:24 - MyProj] Note: there were 3023 duplicate class definitions. [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.BeansBuildContext: can't find referenced class javassist.CtClass [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.BeansBuildContext: can't find referenced class javassist.CtClass [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.BeansBuildContext: can't find referenced class javassist.CtNewConstructor [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.BeansBuildContext: can't find referenced class javassist.CtClass [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.BeansBuildContext: can't find referenced class javassist.CannotCompileException [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.BeansBuildContext: can't find referenced class javassist.NotFoundException [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.BeansBuildContext: can't find referenced class javassist.CtNewConstructor [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.BeansBuildContext: can't find referenced class javassist.CtConstructor [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.BuildContext: can't find referenced class javassist.CtClass [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.BuildContext: can't find referenced class javassist.CtClass [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.BuildContext: can't find referenced class javassist.CtClass [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.BuildContext: can't find referenced class javassist.CtClass [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.BuildContext: can't find referenced class javassist.CtClass [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.BuildContext: can't find referenced class javassist.CtNewMethod [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.BuildContext: can't find referenced class javassist.CtClass [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.BuildContext: can't find referenced class javassist.CtClass [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.BuildContext: can't find referenced class javassist.CtClass [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.BuildContext: can't find referenced class javassist.CannotCompileException [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.BuildContext: can't find referenced class javassist.NotFoundException [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.BuildContext: can't find referenced class javassist.CtNewMethod [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.BuildContext: can't find referenced class javassist.CtClass [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.BuildContext: can't find referenced class javassist.CtClass [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.BuildContext: can't find referenced class javassist.CtClass [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.BuildContext: can't find referenced class javassist.CtClass [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.BuildContext: can't find referenced class javassist.CtMethod [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.BuildContext: can't find referenced class javassist.CtClass [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.BuildContext: can't find referenced class javassist.CtClass [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.BuildContext: can't find referenced class javassist.CtClass [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.BuildContext: can't find referenced class javassist.CtMethod [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.DefaultBuildContext: can't find referenced class javassist.CtClass [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.DefaultBuildContext: can't find referenced class javassist.CtClass [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.DefaultBuildContext: can't find referenced class javassist.CtNewConstructor [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.DefaultBuildContext: can't find referenced class javassist.CtClass [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.DefaultBuildContext: can't find referenced class javassist.CannotCompileException [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.DefaultBuildContext: can't find referenced class javassist.NotFoundException [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.DefaultBuildContext: can't find referenced class javassist.CtNewConstructor [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.DefaultBuildContext: can't find referenced class javassist.CtConstructor [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.JavassistTemplateBuilder: can't find referenced class javassist.ClassPool [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.JavassistTemplateBuilder: can't find referenced class javassist.ClassPool [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.JavassistTemplateBuilder: can't find referenced class javassist.ClassPool [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.JavassistTemplateBuilder: can't find referenced class javassist.LoaderClassPath [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.JavassistTemplateBuilder: can't find referenced class javassist.LoaderClassPath [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.JavassistTemplateBuilder: can't find referenced class javassist.ClassPool [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.JavassistTemplateBuilder: can't find referenced class javassist.ClassPool [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.JavassistTemplateBuilder: can't find referenced class javassist.ClassPool [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.JavassistTemplateBuilder: can't find referenced class javassist.ClassPool [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.JavassistTemplateBuilder: can't find referenced class javassist.NotFoundException [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.JavassistTemplateBuilder: can't find referenced class javassist.ClassPool [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.JavassistTemplateBuilder: can't find referenced class javassist.CtClass [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.template.builder.JavassistTemplateBuilder: can't find referenced class javassist.CtClass [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.util.TemplatePrecompiler: can't find referenced class javax.tools.ToolProvider [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.util.TemplatePrecompiler: can't find referenced class javax.tools.DiagnosticCollector [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.util.TemplatePrecompiler: can't find referenced class javax.tools.DiagnosticCollector [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.util.TemplatePrecompiler: can't find referenced class javax.tools.JavaCompiler [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.util.TemplatePrecompiler: can't find referenced class javax.tools.StandardLocation [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.util.TemplatePrecompiler: can't find referenced class javax.tools.JavaFileManager [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.util.TemplatePrecompiler: can't find referenced class javax.tools.JavaFileObject [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.util.TemplatePrecompiler: can't find referenced class javax.tools.JavaFileObject [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.util.TemplatePrecompiler: can't find referenced class javax.tools.JavaFileObject$Kind [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.util.TemplatePrecompiler: can't find referenced class javax.tools.JavaCompiler [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.util.TemplatePrecompiler: can't find referenced class javax.tools.JavaFileManager [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.util.TemplatePrecompiler: can't find referenced class javax.tools.ToolProvider [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.util.TemplatePrecompiler: can't find referenced class javax.tools.JavaCompiler [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.util.TemplatePrecompiler: can't find referenced class javax.tools.StandardLocation [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.util.TemplatePrecompiler: can't find referenced class javax.tools.JavaFileManager [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.util.TemplatePrecompiler: can't find referenced class javax.tools.JavaFileManager$Location [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.util.TemplatePrecompiler: can't find referenced class javax.tools.JavaFileObject [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.util.TemplatePrecompiler: can't find referenced class javax.tools.JavaCompiler [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.util.TemplatePrecompiler: can't find referenced class javax.tools.JavaFileManager [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.util.TemplatePrecompiler: can't find referenced class javax.tools.JavaFileObject$Kind [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.util.TemplatePrecompiler$1: can't find referenced class javax.tools.JavaFileObject$Kind [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.util.TemplatePrecompiler$1: can't find referenced class javax.tools.JavaFileObject$Kind [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.util.TemplatePrecompiler$1: can't find referenced class javax.tools.JavaFileObject [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.util.TemplatePrecompiler$1: can't find referenced class javax.tools.JavaFileObject$Kind [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.util.json.JSONUnpacker: can't find referenced class org.json.simple.parser.JSONParser [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.util.json.JSONUnpacker: can't find referenced class org.json.simple.parser.JSONParser [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.util.json.JSONUnpacker: can't find referenced class org.json.simple.parser.JSONParser [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.util.json.JSONUnpacker: can't find referenced class org.json.simple.parser.ParseException [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.util.json.JSONUnpacker: can't find referenced class org.json.simple.parser.ParseException [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.util.json.JSONUnpacker: can't find referenced class org.json.simple.parser.JSONParser [2013-08-20 10:45:24 - MyProj] Warning: org.msgpack.util.json.JSONUnpacker: can't find referenced class org.json.simple.parser.ParseException [2013-08-20 10:45:24 - MyProj] You should check if you need to specify additional program jars. [2013-08-20 10:45:24 - MyProj] Warning: there were 81 unresolved references to classes or interfaces. [2013-08-20 10:45:24 - MyProj] You may need to specify additional library jars (using '-libraryjars'). [2013-08-20 10:45:24 - MyProj] java.io.IOException: Please correct the above warnings first. [2013-08-20 10:45:24 - MyProj] at proguard.Initializer.execute(Initializer.java:321) [2013-08-20 10:45:24 - MyProj] at proguard.ProGuard.initialize(ProGuard.java:211) [2013-08-20 10:45:24 - MyProj] at proguard.ProGuard.execute(ProGuard.java:86) [2013-08-20 10:45:24 - MyProj] at proguard.ProGuard.main(ProGuard.java:492) 

project.properties:

 # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-myproject.txt # Project target. target=Google Inc.:Google APIs:17 android.library.reference.1=../../../android/downloaded/JakeWharton-ActionBarSherlock-e5c2d1c/library android.library.reference.2=../../../android/android-sdk-macosx/extras/google/google_play_services/libproject/google-play-services_lib 

proguard-myproject.txt:

 # To enable ProGuard in your project, edit project.properties # to define the proguard.config property as described in that file. # # Add project specific ProGuard rules here. # By default, the flags in this file are appended to flags specified # in ${sdk.dir}/tools/proguard/proguard-android.txt # 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: -injars bin/classes -injars libs -outjars bin/classes-processed.jar -libraryjars /Users/tester/Documents/workspace/android_testing/MyProj/libs/MixpanelAPI.jar -libraryjars /Users/tester/Documents/workspace/android_testing/MyProj/libs/Parse-1.3.2.jar -libraryjars /Users/tester/Documents/workspace/android_testing/MyProj/libs/TestFlightLib.jar -libraryjars /Users/tester/Documents/workspace/android_testing/MyProj/libs/android-support-v13.jar -libraryjars /Users/tester/Documents/android/android-sdk-macosx/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar -dontpreverify -repackageclasses '' -allowaccessmodification -optimizations !code/simplification/arithmetic -keepattributes *Annotation* -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.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.content.Context { public void *(android.view.View); public void *(android.view.MenuItem); } -keepclassmembers class * implements android.os.Parcelable { static android.os.Parcelable$Creator CREATOR; } -keepclassmembers class **.R$* { public static <fields>; } -keepclassmembers class * { @android.webkit.JavascriptInterface <methods>; } -keep class android.support.v4.app.** { *; } -keep interface android.support.v4.app.** { *; } -keep class com.actionbarsherlock.** { *; } -keep interface com.actionbarsherlock.** { *; } -keep class com.parse.** { *; } -keep class com.mixpanel.** { *; } -keep class com.testflightapp.** { *; } -keep class org.json.simple.** { *; } -dontwarn com.facebook.** -dontwarn android.support.** # 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 *; #} 

Algunas cosas de terceros que estoy usando son mixpanel.com, parse.com, ActionBarSherlock ( http://actionbarsherlock.com/ ) y TestFlightApp.com .

Traté de poner en lo siguiente en mi proguard-myproject.txt:

 -dontwarn javassist.** -dontwarn javax.tools.** -dontwarn json.simple.parser.** 

Sin embargo, si los pongo en mi aplicación se bloquea inmediatamente después de iniciar la aplicación, por lo que estoy adivinando que necesito limpiar las advertencias mediante la inclusión de bibliotecas correctamente.

Pregunta:

Me preguntaba qué necesitaba incluir en mi archivo proguard-myproject.txt para deshacerse de estas advertencias y ser capaz de iniciar mi aplicación en mi teléfono sin que se estrellara inmediatamente después de iniciar la aplicación. Si ejecuto la aplicación desde eclipse en la opción normal Ejecutar .. o Depurar, la aplicación funciona bien, así que estoy adivinando de alguna manera Proguard está eliminando algunas clases que necesito.

También tengo el dump.txt, mapping.txt, seeds.txt y use.txt si alguien necesita verlos, pero son bastante largos por lo que pensé que no es necesario pegar aquí por ahora.

Resuelto

gracias a @Eric Lafortune y buscando la documentación proguard

El problema principal era simplemente agregar esto:

 -keep class com.myapp.** { *; } -keep interface com.myapp.** { *; } 

donde com.myapp. ** es el paquete de mi aplicación

proguard-myproject.txt:

 -injars bin/classes -injars libs -outjars bin/classes-processed.jar -libraryjars libs/MixpanelAPI.jar -libraryjars libs/Parse-1.3.2.jar -libraryjars libs/TestFlightLib.jar -libraryjars libs/android-support-v13.jar -libraryjars libs/KiipSDK.jar -libraryjars /Users/tester/Documents/android/android-sdk-macosx/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar -dontpreverify -repackageclasses '' -allowaccessmodification -optimizations !code/simplification/arithmetic -keepattributes *Annotation* -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 class * extends java.util.ListResourceBundle { protected Object[][] getContents(); } -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.content.Context { public void *(android.view.View); public void *(android.view.MenuItem); } -keepclassmembers class * implements android.os.Parcelable { static android.os.Parcelable$Creator CREATOR; } -keepclassmembers class **.R$* { public static <fields>; } -keepclassmembers class * { @android.webkit.JavascriptInterface <methods>; } -keep class android.support.v4.** { *; } -keep interface android.support.v4.** { *; } #-keep class android.support.v4.app.** { *; } #-keep interface android.support.v4.app.** { *; } -keep class com.actionbarsherlock.** { *; } -keep interface com.actionbarsherlock.** { *; } -keep class com.parse.** { *; } -keep class com.mixpanel.** { *; } -keep class com.testflightapp.** { *; } -keep class org.json.simple.** { *; } -keep class com.myapp.** { *; } -keep interface com.myapp.** { *; } -dontwarn com.facebook.** -dontwarn android.support.** -dontwarn org.msgpack.** 

Los procesos de generación de Ant / Eclipse / Gradle en el SDK de Android especifican automáticamente jarras de entrada, jarras de biblioteca y jarras de salida para usted, por lo que no debe especificarlas de nuevo en la configuración. Esta es la razón por la que está recibiendo muchas advertencias sobre las clases duplicadas.

Por otro lado, algunas clases org.msgpack dependen de las clases que no están en el directorio libs. Si su compilación de depuración funciona correctamente, puede indicarle a ProGuard que la ignore con:

 -dontwarn org.msgpack.** 

Si su aplicación se bloquea, debe buscar en la salida logcat. Encontrará sugerencias en la sección Solución de problemas del manual de ProGuard.

  • Android: Errores de clase duplicados en proguard
  • ¿Cómo se pueden reducir las aplicaciones scala para Android en tamaño de archivo?
  • Definición de Android Proguard Duplicate
  • Proguard con la colección parametrizada orrmlite
  • Proguard con el proyecto android utilizando bibliotecas (de compatibilidad)
  • Android - Maven Build - Proguard - no puede encontrar la clase referenciada
  • Error: Error de ejecución para la tarea ': app: packageRelease'. > Java.io.IOException: No se pudo leer el archivo zip
  • Proguard Nota para la clase desconocida 'Objeto' con Android Studio y Gradle
  • ¿Cómo ofuscar sólo un poco de clase o un solo paquete?
  • Retrofit2 proguard remove param
  • Eliminar el registro con Proguard
  • FlipAndroid es un fan de Google para Android, Todo sobre Android Phones, Android Wear, Android Dev y Aplicaciones para Android Aplicaciones.