2

OK This is driving me nuts since a day. I am mainly an iOS guy so i dont know much about Proguard and stuff. I have made an Android app which includes both dropbox and Google Drive API. The app is working great if i deploy it on a phone thru Eclipse but I am getting a nasty error on Console when i try to export the app for apk file generation. My project.properties files was like so...

# 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-17
android.library=false

And the error dialog was this... PROJECT_FOLDER_NAME/proguard-project.txt does not exist or is not a regular file

So i edited my project.properties and removed proguard-project.txt part.

Now while creating apk i get these errors on console...

[2013-05-15 18:48:28 - BackMyAppUp] Proguard returned with error code 1. See console
[2013-05-15 18:48:28 - BackMyAppUp] Note: there were 367 duplicate class definitions.
[2013-05-15 18:48:28 - BackMyAppUp] Warning: org.apache.commons.logging.impl.ServletContextCleaner: can't find superclass or interface javax.servlet.ServletContextListener
[2013-05-15 18:48:28 - BackMyAppUp] Warning: org.apache.http.entity.mime.FormBodyPart: can't find superclass or interface org.apache.james.mime4j.message.BodyPart
[2013-05-15 18:48:28 - BackMyAppUp] Warning: org.apache.http.entity.mime.HttpMultipart: can't find superclass or interface org.apache.james.mime4j.message.Multipart
[2013-05-15 18:48:28 - BackMyAppUp] Warning: org.apache.http.entity.mime.MinimalField: can't find superclass or interface org.apache.james.mime4j.parser.Field
[2013-05-15 18:48:28 - BackMyAppUp] Warning: org.apache.http.entity.mime.content.AbstractContentBody: can't find superclass or interface org.apache.james.mime4j.message.SingleBody
[2013-05-15 18:48:28 - BackMyAppUp] Warning: org.apache.http.entity.mime.content.ContentBody: can't find superclass or interface org.apache.james.mime4j.message.Body
[2013-05-15 18:48:28 - BackMyAppUp] Warning: org.apache.http.entity.mime.content.ContentBody: can't find superclass or interface org.apache.james.mime4j.descriptor.ContentDescriptor
[2013-05-15 18:48:28 - BackMyAppUp] Warning: library class android.net.http.AndroidHttpClient extends or implements program class org.apache.http.client.HttpClient
[2013-05-15 18:48:28 - BackMyAppUp] Warning: com.google.android.gms.auth.GoogleAuthUtil: can't find referenced class com.google.android.gms.R
[2013-05-15 18:48:28 - BackMyAppUp] Warning: com.google.android.gms.auth.GoogleAuthUtil: can't find referenced class com.google.android.gms.R$string
[2013-05-15 18:48:28 - BackMyAppUp] Warning: com.google.android.gms.auth.GoogleAuthUtil: can't find referenced class com.google.android.gms.R$string
[2013-05-15 18:48:28 - BackMyAppUp] Warning: com.google.android.gms.auth.GoogleAuthUtil: can't find referenced class com.google.android.gms.R$string

and some 300 similar lines.

If i use the apk generated from bin folder, the google drive feature doesn't work in the phone, but it works if i deploy thru Ecipse. Please help me out.

4

3 回答 3

4

FWIW,在升级到 ADT 22 后,我遇到了 800 多个类似的错误,而 Proguard 配置以前运行良好,该应用程序在没有 Proguard 的情况下在带有 ClassDefNotFound 错误的设备上崩溃。

最后的解决方案是在我的主项目及其所有库项目的构建路径编辑器的 Order and Export 选项卡上勾选“Android Private Libraries”。

于 2013-05-18T04:08:29.127 回答
2

要么你想使用 Proguard(优化,混淆,......),要么你不想。

如果您不想要,只需在 project.properties 中注释(用 # 号)指向您的 proguard 配置的部分:

proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt:proguard-google-api-client.txt

如果您愿意,解决方案是保持该行不变,并创建以下文件:proguard-project.txt 和 proguard-google-api-client.txt

对于 proguard-google-api-client.txt,您可以在此处找到示例: https ://google-api-java-client.googlecode.com/hg/google-api-client-assembly/proguard-google-api -client.txt

对于 proguard-project.txt,这将取决于您在提交另一个错误后遇到的错误。您可能需要添加几个:

-libjars <path_to_a_jar_used_in_app>

和其他一些-dontwarn,取决于你得到的警告......

于 2013-05-17T08:00:33.230 回答
0

嗯,这感觉有点愚蠢,3天我搞砸了proguard,但问题是我在发布apk中使用了调试密钥库SHA1密钥,因此谷歌驱动应用程序崩溃,我在谷歌API控制台中使用了正确的SHA1密钥来解决它。

于 2013-05-18T18:22:43.617 回答