【问题标题】:Proguard returned with error code 1. See console java.io.IOExceptionProguard 返回错误代码 1。请参阅控制台 java.io.IOException
【发布时间】:2015-04-19 03:15:35
【问题描述】:

从 Eclipse IDE 导出我的 Android 应用程序时,我收到如下错误:

Proguard returned with error code 1. See console
Warning: library class android.net.http.AndroidHttpClient extends or implements program class org.apache.http.client.HttpClient
       You should check if you need to specify additional program jars.
Warning: there were 1 instances of library classes depending on program classes.
          You must avoid such dependencies, since the program classes will
          be processed, while the library classes will remain unchanged.
java.io.IOException: Please correct the above warnings first.
    at proguard.Initializer.execute(Initializer.java:321)
    at proguard.ProGuard.initialize(ProGuard.java:211)
    at proguard.ProGuard.execute(ProGuard.java:86)
    at proguard.ProGuard.main(ProGuard.java:492)

project.properties

# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# 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-project.txt:proguard-google-api-client.txt

# Project target.
target=android-21

proguard-project

# 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:

# 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 *;
#}
-dontwarn com.google.android.gms.**
-dontwarn javax.jdo.**
-dontwarn com.google.api.client.googleapis.extensions.android.gms.**
-dontwarn org.apache.commons.**
-dontwarn org.ietf.jgss.**
-dontnote

我在 proguard confing 文件中添加了 dontwarn 和 dontnote 语句,我解决了一些警告但无法解决剩余的问题。请帮我解决这个问题。谢谢。

【问题讨论】:

  • 你能显示proguard配置的项目属性文件吗?
  • 查看已编辑的问题以了解属性详细信息@Opiatefuchs
  • :) ,对不起,请提供proguard文本文件,对不起,我忘记了正确的文件名是什么..
  • 现在你也可以找到 proguard 的详细信息了@Opiatefuchs
  • 您正在使用 Eclipse 进行 Android 开发?

标签: android eclipse httpclient proguard androidhttpclient


【解决方案1】:

我也遇到过这个问题。清理项目并再次导出应该可以解决此问题。

【讨论】:

  • 在问这里之前我已经尝试过了。根本不适合我。
【解决方案2】:

将此添加到您的 proguard-project 文件中:

  -keep class org.apache.http.** { *; }
  -dontwarn org.apache.http.*

如果仍然存在错误,则返回。

【讨论】:

  • 获取proguard.ParseException: Expecting java type before ';'在线错误`-keep class org.apache.http.** {; }`
  • 通过将 ; 替换为 *; 解决了 parseException 错误,但再次出现与问题相同的错误。
  • 也在清理项目之后?
【解决方案3】:

您只需将以下代码添加到项目的 proguard-project.txt 文件中。

-dontwarn ["error package name or Error file path here"]

例如:

-dontwarn com.example.media.*

如果你有更多(疯狂的)错误出现,那么只需添加

-dontskipnonpubliclibraryclassmembers

这可能对你有帮助。

【讨论】:

    【解决方案4】:

    由于问题是由于库类android.net.http.AndroidHttpClientorg.apache.http.client.HttpClient,我将两个库类的 -dontwarn 语句添加到 proguard-project 文件中。我补充的是:

    -keep class org.apache.http.** { *; }
    -dontwarn org.apache.http.*
    -dontwarn android.net.http.*
    

    我已经完成了。感谢大家对此提供帮助。

    【讨论】:

      【解决方案5】:

      请在下面给出的代码之前使用 cmets proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt:proguard-google-api-client.txt

      在 project.properties 文件中

      【讨论】:

      • 使用 cmets 如果你的 proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt:proguard-google-api-client.txt跨度>
      猜你喜欢
      • 1970-01-01
      • 2012-10-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多