web-dev-qa-db-fra.com

Proguard est retourné avec le code d'erreur 1. Voir console

Je reçois cette exception lors de la création de l'apk signé de ma candidature.

J'ai également ajouté 5 projets de bibliothèque à mon projet.

Une astuce pour résoudre ce problème?

Voici mon fichier de configuration:

-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*

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

et voici l'exception dans la console.

    [2012-11-03 16:20:10 - ] Proguard returned with error code 1. See console
[2012-11-03 16:20:10 - ] Note: there were 12 duplicate class definitions.
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.transform.AbstractProcessTask: can't find superclass or interface org.Apache.tools.ant.Task
[2012-11-03 16:20:10 - ] Warning: library class Android.test.AndroidTestCase extends or implements program class junit.framework.TestCase
[2012-11-03 16:20:10 - ] Warning: library class Android.test.AndroidTestRunner extends or implements program class junit.runner.BaseTestRunner
[2012-11-03 16:20:10 - ] Warning: library class Android.test.InstrumentationTestCase extends or implements program class junit.framework.TestCase
[2012-11-03 16:20:10 - ] Warning: library class Android.test.InstrumentationTestSuite extends or implements program class junit.framework.TestSuite
[2012-11-03 16:20:10 - ] Warning: library class Android.test.suitebuilder.TestSuiteBuilder$FailedToCreateTests extends or implements program class junit.framework.TestCase
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.beans.BeanCopier$Generator: can't find referenced class Java.beans.PropertyDescriptor
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.beans.BeanCopier$Generator: can't find referenced class Java.beans.PropertyDescriptor
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.beans.BeanCopier$Generator: can't find referenced class Java.beans.PropertyDescriptor
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.beans.BeanCopier$Generator: can't find referenced class Java.beans.PropertyDescriptor
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.beans.BeanCopier$Generator: can't find referenced class Java.beans.PropertyDescriptor
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.beans.BeanCopier$Generator: can't find referenced class Java.beans.PropertyDescriptor
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.beans.BeanCopier$Generator: can't find referenced class Java.beans.PropertyDescriptor
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.beans.BeanCopier$Generator: can't find referenced class Java.beans.PropertyDescriptor
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.beans.BeanCopier$Generator: can't find referenced class Java.beans.PropertyDescriptor
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.beans.BeanCopier$Generator: can't find referenced class Java.beans.PropertyDescriptor
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.beans.BeanCopier$Generator: can't find referenced class Java.beans.PropertyDescriptor
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.beans.BeanCopier$Generator: can't find referenced class Java.beans.PropertyDescriptor
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.beans.BeanCopier$Generator: can't find referenced class Java.beans.PropertyDescriptor
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.beans.BeanGenerator: can't find referenced class Java.beans.PropertyDescriptor
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.beans.BeanGenerator: can't find referenced class Java.beans.PropertyDescriptor
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.beans.BeanGenerator: can't find referenced class Java.beans.PropertyDescriptor
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.beans.BeanGenerator: can't find referenced class Java.beans.PropertyDescriptor
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.beans.BeanGenerator: can't find referenced class Java.beans.PropertyDescriptor
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.beans.BeanMapEmitter: can't find referenced class Java.beans.PropertyDescriptor
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.beans.BeanMapEmitter: can't find referenced class Java.beans.PropertyDescriptor
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.beans.BeanMapEmitter: can't find referenced class Java.beans.PropertyDescriptor
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.beans.BeanMapEmitter: can't find referenced class Java.beans.PropertyDescriptor
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.beans.BeanMapEmitter$1: can't find referenced class Java.beans.PropertyDescriptor
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.beans.BeanMapEmitter$1: can't find referenced class Java.beans.PropertyDescriptor
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.beans.BeanMapEmitter$1: can't find referenced class Java.beans.PropertyDescriptor
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.beans.BeanMapEmitter$2: can't find referenced class Java.beans.PropertyDescriptor
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.beans.BeanMapEmitter$2: can't find referenced class Java.beans.PropertyDescriptor
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.beans.BeanMapEmitter$2: can't find referenced class Java.beans.PropertyDescriptor
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.beans.BeanMapEmitter$2: can't find referenced class Java.beans.PropertyDescriptor
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.beans.BeanMapEmitter$3: can't find referenced class Java.beans.PropertyDescriptor
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.beans.BeanMapEmitter$3: can't find referenced class Java.beans.PropertyDescriptor
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.beans.BeanMapEmitter$3: can't find referenced class Java.beans.PropertyDescriptor
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.beans.ImmutableBean$Generator: can't find referenced class Java.beans.PropertyDescriptor
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.core.ReflectUtils: can't find referenced class Java.beans.PropertyDescriptor
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.core.ReflectUtils: can't find referenced class Java.beans.PropertyDescriptor
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.core.ReflectUtils: can't find referenced class Java.beans.PropertyDescriptor
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.core.ReflectUtils: can't find referenced class Java.beans.IntrospectionException
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.core.ReflectUtils: can't find referenced class Java.beans.Introspector
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.core.ReflectUtils: can't find referenced class Java.beans.Introspector
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.core.ReflectUtils: can't find referenced class Java.beans.BeanInfo
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.core.ReflectUtils: can't find referenced class Java.beans.BeanInfo
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.core.ReflectUtils: can't find referenced class Java.beans.PropertyDescriptor
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.core.ReflectUtils: can't find referenced class Java.beans.PropertyDescriptor
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.core.ReflectUtils: can't find referenced class Java.beans.PropertyDescriptor
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.core.ReflectUtils: can't find referenced class Java.beans.PropertyDescriptor
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.core.ReflectUtils: can't find referenced class Java.beans.PropertyDescriptor
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.core.ReflectUtils: can't find referenced class Java.beans.PropertyDescriptor
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.core.ReflectUtils: can't find referenced class Java.beans.PropertyDescriptor
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.core.ReflectUtils: can't find referenced class Java.beans.PropertyDescriptor
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.core.ReflectUtils: can't find referenced class Java.beans.PropertyDescriptor
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.core.ReflectUtils: can't find referenced class Java.beans.BeanInfo
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.core.ReflectUtils: can't find referenced class Java.beans.PropertyDescriptor
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.core.ReflectUtils: can't find referenced class Java.beans.IntrospectionException
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.transform.AbstractProcessTask: can't find referenced class org.Apache.tools.ant.Task
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.transform.AbstractProcessTask: can't find referenced class org.Apache.tools.ant.Task
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.transform.AbstractProcessTask: can't find referenced method 'org.Apache.tools.ant.Project getProject()' in class org.mockito.cglib.transform.AbstractProcessTask
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.transform.AbstractProcessTask: can't find referenced class org.Apache.tools.ant.types.FileSet
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.transform.AbstractProcessTask: can't find referenced class org.Apache.tools.ant.types.FileSet
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.transform.AbstractProcessTask: can't find referenced class org.Apache.tools.ant.DirectoryScanner
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.transform.AbstractProcessTask: can't find referenced class org.Apache.tools.ant.DirectoryScanner
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.transform.AbstractProcessTask: can't find referenced class org.Apache.tools.ant.types.FileSet
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.transform.AbstractProcessTask: can't find referenced class org.Apache.tools.ant.BuildException
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.transform.AbstractProcessTask: can't find referenced class org.Apache.tools.ant.BuildException
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.transform.AbstractProcessTask: can't find referenced class org.Apache.tools.ant.types.FileSet
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.transform.AbstractProcessTask: can't find referenced class org.Apache.tools.ant.types.FileSet
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.transform.AbstractProcessTask: can't find referenced class org.Apache.tools.ant.types.FileSet
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.transform.AbstractProcessTask: can't find referenced class org.Apache.tools.ant.DirectoryScanner
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.transform.AbstractProcessTask: can't find referenced class org.Apache.tools.ant.Project
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.transform.AbstractTransformTask: can't find referenced method 'void log(Java.lang.String,int)' in class org.mockito.cglib.transform.AbstractTransformTask
[2012-11-03 16:20:10 - ] Warning: org.mockito.cglib.transform.AbstractTransformTask: can't find referenced method 'void log(Java.lang.String)' in class org.mockito.cglib.transform.AbstractTransformTask
[2012-11-03 16:20:10 - ] Warning: org.objenesis.instantiator.Sun.SunReflectionFactoryInstantiator: can't find referenced class Sun.reflect.ReflectionFactory
[2012-11-03 16:20:10 - ] Warning: org.objenesis.instantiator.Sun.SunReflectionFactoryInstantiator: can't find referenced class Sun.reflect.ReflectionFactory
[2012-11-03 16:20:10 - ] Warning: org.objenesis.instantiator.Sun.SunReflectionFactoryInstantiator: can't find referenced class Sun.reflect.ReflectionFactory
[2012-11-03 16:20:10 - ] Warning: org.objenesis.instantiator.Sun.SunReflectionFactoryInstantiator: can't find referenced class Sun.reflect.ReflectionFactory
[2012-11-03 16:20:10 - ] Warning: org.objenesis.instantiator.Sun.SunReflectionFactorySerializationInstantiator: can't find referenced class Sun.reflect.ReflectionFactory
[2012-11-03 16:20:10 - ] Warning: org.objenesis.instantiator.Sun.SunReflectionFactorySerializationInstantiator: can't find referenced class Sun.reflect.ReflectionFactory
[2012-11-03 16:20:10 - ] Warning: org.objenesis.instantiator.Sun.SunReflectionFactorySerializationInstantiator: can't find referenced class Sun.reflect.ReflectionFactory
[2012-11-03 16:20:10 - ] Warning: org.objenesis.instantiator.Sun.SunReflectionFactorySerializationInstantiator: can't find referenced class Sun.reflect.ReflectionFactory
[2012-11-03 16:20:10 - ]       You should check if you need to specify additional program jars.
[2012-11-03 16:20:10 - ] Warning: there were 76 unresolved references to classes or interfaces.
[2012-11-03 16:20:10 - ]          You may need to specify additional library jars (using '-libraryjars').
[2012-11-03 16:20:10 - ] Warning: there were 5 instances of library classes depending on program classes.
[2012-11-03 16:20:10 - ]          You must avoid such dependencies, since the program classes will
[2012-11-03 16:20:10 - ]          be processed, while the library classes will remain unchanged.
[2012-11-03 16:20:10 - ] Warning: there were 3 unresolved references to program class members.
[2012-11-03 16:20:10 - ]          Your input classes appear to be inconsistent.
[2012-11-03 16:20:10 - ]          You may need to recompile them and try again.
[2012-11-03 16:20:10 - ]          Alternatively, you may have to specify the option 
[2012-11-03 16:20:10 - ]          '-dontskipnonpubliclibraryclassmembers'.
[2012-11-03 16:20:10 - ] Java.io.IOException: Please correct the above warnings first.
[2012-11-03 16:20:10 - ]    at proguard.Initializer.execute(Initializer.Java:321)
[2012-11-03 16:20:10 - ]    at proguard.ProGuard.initialize(ProGuard.Java:211)
[2012-11-03 16:20:10 - ]    at proguard.ProGuard.execute(ProGuard.Java:86)
[2012-11-03 16:20:10 - ]    at proguard.ProGuard.main(ProGuard.Java:492)
33
Aqif Hamid

Les solutions consistaient à ignorer les avertissements car ils sont internes aux projets lib,

J'ai ajouté ces paramètres au fichier de configuration (proguard-project.txt)

-dontwarn org.mockito.**
-dontwarn Sun.reflect.**
-dontwarn Android.test.**
72
Aqif Hamid