Proguard 返回错误代码 1。请参阅控制台

Posted

技术标签:

【中文标题】Proguard 返回错误代码 1。请参阅控制台【英文标题】:Proguard returned with error code 1. See console 【发布时间】:2012-10-23 21:53:26 【问题描述】:

我在创建应用程序的签名 apk 时收到此异常。

我的项目中也添加了 5 个库项目。

任何提示如何解决这个问题?

这是我的配置文件:

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

这是控制台中的异常。

    [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)

【问题讨论】:

如果您添加了 proguard 配置文件可能会有所帮助。 已添加。我使用的是android生成的默认配置。 【参考方案1】:

解决方案是忽略警告,因为它们是 lib 项目内部的,

我将这些设置添加到配置文件 (proguard-project.txt)

-dontwarn org.mockito.**
-dontwarn sun.reflect.**
-dontwarn android.test.**

【讨论】:

sdk 里面的 progaurd-project.txt 文件在哪里? prateek,它在您项目的根目录中。 帮了我很多,谢谢:)

以上是关于Proguard 返回错误代码 1。请参阅控制台的主要内容,如果未能解决你的问题,请参考以下文章

带有外部 jar 的 Proguard 错误 - 返回错误代码 1

httpd.service 的作业失败,因为控制进程以错误代码退出。有关详细信息,请参阅“systemctl status httpd.service”和“journalctl -xe”

带有重复 Zip 输入错误的 Proguard

Android - Proguard 未使用 Joda Time jar 文件编译

Proguard 返回错误 1 ​​- 项目 bin 文件夹中没有 proguard.txt 文件?

通过将 proguard 规则映射文件上传到 google play 控制台去混淆生产 Android 错误