Android Proguard 跳过外部 jar

发布于 2024-10-16 14:38:32 字数 11699 浏览 0 评论 0原文

我尝试在我的 Android 项目中使用 Proguard,我使用命令行“android update project /path/to/project”设置 Proguard,并在项目的根目录中创建文件 proguard.cfg。 (在我的带有 Android 2.3 sdk 的 Eclipse 中,创建新项目时,不会自动创建 proguard.cfg 文件,因此我必须使用命令行手动添加它)。

当我导出项目时,出现以下错误

    [2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.jetty.client.HttpExchange
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.jetty.HttpFields
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.jetty.client.HttpExchange
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.io.Buffer
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.jetty.client.HttpExchange
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.jetty.client.HttpExchange
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.jetty.HttpFields
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.jetty.HttpFields$Field
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.jetty.HttpFields$Field
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.jetty.HttpFields$Field
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.jetty.client.HttpExchange
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.jetty.client.HttpExchange
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.jetty.client.Address
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.jetty.client.HttpExchange
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.jetty.client.HttpExchange
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.jetty.HttpFields
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.io.Buffer
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.jetty.client.Address
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.jetty.client.HttpExchange
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.jetty.client.HttpExchange
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.jetty.client.HttpExchange
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.jetty.HttpFields
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.jetty.HttpFields
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.jetty.HttpFields$Field
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.jetty.HttpFields
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.CommonsLoggingLoggerFactory: can't find referenced class org.apache.commons.logging.LogFactory
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.CommonsLoggingLoggerFactory: can't find referenced class org.apache.commons.logging.LogFactory
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.SLF4JLoggerFactory: can't find referenced class org.slf4j.LoggerFactory
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.SLF4JLoggerFactory: can't find referenced class org.slf4j.LoggerFactory
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.JettyOAuthConsumer: can't find referenced class org.mortbay.jetty.client.HttpExchange
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.Log4JLoggerFactory: can't find referenced class org.apache.log4j.Logger
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.Log4JLoggerFactory: can't find referenced class org.apache.log4j.Logger
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.signature.OAuthMessageSigner: can't find referenced class org.apache.commons.codec.binary.Base64
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.signature.OAuthMessageSigner: can't find referenced class org.apache.commons.codec.binary.Base64
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.signature.OAuthMessageSigner: can't find referenced class org.apache.commons.codec.binary.Base64
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.signature.OAuthMessageSigner: can't find referenced class org.apache.commons.codec.binary.Base64
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.signature.OAuthMessageSigner: can't find referenced class org.apache.commons.codec.binary.Base64
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.SLF4JLogger: can't find referenced class org.slf4j.Logger
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.SLF4JLogger: can't find referenced class org.slf4j.Logger
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.SLF4JLogger: can't find referenced class org.slf4j.Logger
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.SLF4JLogger: can't find referenced class org.slf4j.Logger
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.SLF4JLogger: can't find referenced class org.slf4j.Logger
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.SLF4JLogger: can't find referenced class org.slf4j.Logger
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.SLF4JLogger: can't find referenced class org.slf4j.Logger
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.SLF4JLogger: can't find referenced class org.slf4j.Logger
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.SLF4JLogger: can't find referenced class org.slf4j.Logger
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.SLF4JLogger: can't find referenced class org.slf4j.Logger
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.Log4JLogger: can't find referenced class org.apache.log4j.Logger
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.Log4JLogger: can't find referenced class org.apache.log4j.Logger
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.Log4JLogger: can't find referenced class org.apache.log4j.Level
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.Log4JLogger: can't find referenced class org.apache.log4j.Logger
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.Log4JLogger: can't find referenced class org.apache.log4j.Logger
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.Log4JLogger: can't find referenced class org.apache.log4j.Logger
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.Log4JLogger: can't find referenced class org.apache.log4j.Logger
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.Log4JLogger: can't find referenced class org.apache.log4j.Logger
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.Log4JLogger: can't find referenced class org.apache.log4j.Level
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.Log4JLogger: can't find referenced class org.apache.log4j.Logger
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.Log4JLogger: can't find referenced class org.apache.log4j.Logger
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.Log4JLogger: can't find referenced class org.apache.log4j.Logger
[2011-02-06 09:02:49 - TestProject]       You should check if you need to specify additional program jars.
[2011-02-06 09:02:49 - TestProject] Warning: there were 59 unresolved references to classes or interfaces.
[2011-02-06 09:02:49 - TestProject]          You may need to specify additional library jars (using '-libraryjars'),
[2011-02-06 09:02:49 - TestProject]          or perhaps the '-dontskipnonpubliclibraryclasses' option.
[2011-02-06 09:02:49 - TestProject] java.io.IOException: Please correct the above warnings first.
[2011-02-06 09:02:49 - TestProject]     at proguard.Initializer.execute(Initializer.java:308)
[2011-02-06 09:02:49 - TestProject]     at proguard.ProGuard.initialize(ProGuard.java:210)
[2011-02-06 09:02:49 - TestProject]     at proguard.ProGuard.execute(ProGuard.java:85)
[2011-02-06 09:02:49 - TestProject]     at proguard.ProGuard.main(ProGuard.java:499)

这些错误消息指向我的项目中使用的四个外部 jar

(.classpath)

<classpathentry kind="lib" path="/Users/lorensiuswlt/Android/android-sdk-mac_x86/libs/Twitter/signpost-commonshttp4-1.2.1.1.jar"/>
        <classpathentry kind="lib" path="/Users/lorensiuswlt/Android/android-sdk-mac_x86/libs/Twitter/signpost-core-1.2.1.1.jar"/>
        <classpathentry kind="lib" path="/Users/lorensiuswlt/Android/android-sdk-mac_x86/libs/Twitter/signpost-jetty6-1.2.1.1.jar"/>
        <classpathentry kind="lib" path="/Users/lorensiuswlt/Android/android-sdk-mac_x86/libs/Twitter/twitter4j-core-2.1.6.jar"/>

这是我的 proguard.cfg 文件

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

-keepclasseswithmembernames class * {
    public <init>(android.content.Context, android.util.AttributeSet);
}

-keepclasseswithmembernames class * {
    public <init>(android.content.Context, android.util.AttributeSet, int);
}

-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

-keep class * implements android.os.Parcelable {
  public static final android.os.Parcelable$Creator *;
}

我尝试了通过添加“-libraryjars”选项在网上找到的一些解决方案,例如:

-libraryjars /Users/lorensiuswlt/Android/android-sdk-mac_x86/libs/Twitter/twitter4j-core-2.1.6.jar

但这没有帮助。

有什么解决办法吗?

I tried to use Proguard in my Android project, i setup Proguard using command line 'android update project /path/to/project' and file proguard.cfg was created in project's root directory. (In my Eclipse with Android 2.3 sdk, when create a new project, proguard.cfg file is not automatically created so i have to add it manually using command line).

When i export the project, i got the following errors

    [2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.jetty.client.HttpExchange
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.jetty.HttpFields
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.jetty.client.HttpExchange
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.io.Buffer
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.jetty.client.HttpExchange
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.jetty.client.HttpExchange
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.jetty.HttpFields
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.jetty.HttpFields$Field
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.jetty.HttpFields$Field
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.jetty.HttpFields$Field
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.jetty.client.HttpExchange
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.jetty.client.HttpExchange
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.jetty.client.Address
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.jetty.client.HttpExchange
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.jetty.client.HttpExchange
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.jetty.HttpFields
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.io.Buffer
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.jetty.client.Address
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.jetty.client.HttpExchange
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.jetty.client.HttpExchange
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.jetty.client.HttpExchange
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.jetty.HttpFields
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.jetty.HttpFields
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.jetty.HttpFields$Field
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.HttpRequestAdapter: can't find referenced class org.mortbay.jetty.HttpFields
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.CommonsLoggingLoggerFactory: can't find referenced class org.apache.commons.logging.LogFactory
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.CommonsLoggingLoggerFactory: can't find referenced class org.apache.commons.logging.LogFactory
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.SLF4JLoggerFactory: can't find referenced class org.slf4j.LoggerFactory
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.SLF4JLoggerFactory: can't find referenced class org.slf4j.LoggerFactory
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.jetty.JettyOAuthConsumer: can't find referenced class org.mortbay.jetty.client.HttpExchange
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.Log4JLoggerFactory: can't find referenced class org.apache.log4j.Logger
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.Log4JLoggerFactory: can't find referenced class org.apache.log4j.Logger
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.signature.OAuthMessageSigner: can't find referenced class org.apache.commons.codec.binary.Base64
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.signature.OAuthMessageSigner: can't find referenced class org.apache.commons.codec.binary.Base64
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.signature.OAuthMessageSigner: can't find referenced class org.apache.commons.codec.binary.Base64
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.signature.OAuthMessageSigner: can't find referenced class org.apache.commons.codec.binary.Base64
[2011-02-06 09:02:49 - TestProject] Warning: oauth.signpost.signature.OAuthMessageSigner: can't find referenced class org.apache.commons.codec.binary.Base64
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.SLF4JLogger: can't find referenced class org.slf4j.Logger
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.SLF4JLogger: can't find referenced class org.slf4j.Logger
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.SLF4JLogger: can't find referenced class org.slf4j.Logger
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.SLF4JLogger: can't find referenced class org.slf4j.Logger
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.SLF4JLogger: can't find referenced class org.slf4j.Logger
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.SLF4JLogger: can't find referenced class org.slf4j.Logger
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.SLF4JLogger: can't find referenced class org.slf4j.Logger
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.SLF4JLogger: can't find referenced class org.slf4j.Logger
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.SLF4JLogger: can't find referenced class org.slf4j.Logger
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.SLF4JLogger: can't find referenced class org.slf4j.Logger
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.Log4JLogger: can't find referenced class org.apache.log4j.Logger
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.Log4JLogger: can't find referenced class org.apache.log4j.Logger
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.Log4JLogger: can't find referenced class org.apache.log4j.Level
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.Log4JLogger: can't find referenced class org.apache.log4j.Logger
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.Log4JLogger: can't find referenced class org.apache.log4j.Logger
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.Log4JLogger: can't find referenced class org.apache.log4j.Logger
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.Log4JLogger: can't find referenced class org.apache.log4j.Logger
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.Log4JLogger: can't find referenced class org.apache.log4j.Logger
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.Log4JLogger: can't find referenced class org.apache.log4j.Level
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.Log4JLogger: can't find referenced class org.apache.log4j.Logger
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.Log4JLogger: can't find referenced class org.apache.log4j.Logger
[2011-02-06 09:02:49 - TestProject] Warning: twitter4j.internal.logging.Log4JLogger: can't find referenced class org.apache.log4j.Logger
[2011-02-06 09:02:49 - TestProject]       You should check if you need to specify additional program jars.
[2011-02-06 09:02:49 - TestProject] Warning: there were 59 unresolved references to classes or interfaces.
[2011-02-06 09:02:49 - TestProject]          You may need to specify additional library jars (using '-libraryjars'),
[2011-02-06 09:02:49 - TestProject]          or perhaps the '-dontskipnonpubliclibraryclasses' option.
[2011-02-06 09:02:49 - TestProject] java.io.IOException: Please correct the above warnings first.
[2011-02-06 09:02:49 - TestProject]     at proguard.Initializer.execute(Initializer.java:308)
[2011-02-06 09:02:49 - TestProject]     at proguard.ProGuard.initialize(ProGuard.java:210)
[2011-02-06 09:02:49 - TestProject]     at proguard.ProGuard.execute(ProGuard.java:85)
[2011-02-06 09:02:49 - TestProject]     at proguard.ProGuard.main(ProGuard.java:499)

These error messages point to four external jars used in my project

(.classpath)

<classpathentry kind="lib" path="/Users/lorensiuswlt/Android/android-sdk-mac_x86/libs/Twitter/signpost-commonshttp4-1.2.1.1.jar"/>
        <classpathentry kind="lib" path="/Users/lorensiuswlt/Android/android-sdk-mac_x86/libs/Twitter/signpost-core-1.2.1.1.jar"/>
        <classpathentry kind="lib" path="/Users/lorensiuswlt/Android/android-sdk-mac_x86/libs/Twitter/signpost-jetty6-1.2.1.1.jar"/>
        <classpathentry kind="lib" path="/Users/lorensiuswlt/Android/android-sdk-mac_x86/libs/Twitter/twitter4j-core-2.1.6.jar"/>

Here is my proguard.cfg file

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

-keepclasseswithmembernames class * {
    public <init>(android.content.Context, android.util.AttributeSet);
}

-keepclasseswithmembernames class * {
    public <init>(android.content.Context, android.util.AttributeSet, int);
}

-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

-keep class * implements android.os.Parcelable {
  public static final android.os.Parcelable$Creator *;
}

I've tried some solutions found on web by adding '-libraryjars' option, ex:

-libraryjars /Users/lorensiuswlt/Android/android-sdk-mac_x86/libs/Twitter/twitter4j-core-2.1.6.jar

but it won't help.

Any solutions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

韬韬不绝 2024-10-23 14:38:32

您的库 jar 引用了更​​多库 jar(Mortbay、SLF4J、Apache Commons Logging、Log4j 等),使用额外的“-libraryjars”选项添加这些 jar 应该可以解决问题。

如果您绝对确定您的代码不使用这些库,您可以指定“-ignorewarnings”或“-dontwarn”,例如

-dontwarn org.mortbay.**
-dontwarn org.slf4j.**
-dontwarn org.apache.log4j.**
-dontwarn org.apache.commons.logging.**
-dontwarn org.apache.commons.codec.binary.**

Your library jars refer to yet more library jars (Mortbay, SLF4J, Apache Commons Logging, Log4j, ...) Adding these jars with extra '-libraryjars' options should solve the problem.

If you are absolutely sure that your code doesn't use these libraries, you can specify '-ignorewarnings' or '-dontwarn', e.g.

-dontwarn org.mortbay.**
-dontwarn org.slf4j.**
-dontwarn org.apache.log4j.**
-dontwarn org.apache.commons.logging.**
-dontwarn org.apache.commons.codec.binary.**
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文