Android proguard can';找不到引用的类
我试图在我的发布版apk上运行proguard,但在我的控制台中出现了很多“找不到引用的类”错误Android proguard can';找不到引用的类,android,release,proguard,Android,Release,Proguard,我试图在我的发布版apk上运行proguard,但在我的控制台中出现了很多“找不到引用的类”错误 [2014-05-06 17:35:05 - DesiDime] Warning: library class android.net.http.AndroidHttpClient extends or implements program class org.apache.http.client.HttpClient [2014-05-06 17:35:05 - DesiDime] Warning
[2014-05-06 17:35:05 - DesiDime] Warning: library class android.net.http.AndroidHttpClient extends or implements program class org.apache.http.client.HttpClient
[2014-05-06 17:35:05 - DesiDime] Warning: com.google.api.client.http.protobuf.ProtoHttpContent: can't find referenced class com.google.protobuf.MessageLite
[2014-05-06 17:35:05 - DesiDime] Warning: com.google.api.client.http.protobuf.ProtoHttpContent: can't find referenced class com.google.protobuf.MessageLite
[2014-05-06 17:35:05 - DesiDime] Warning: com.google.api.client.http.protobuf.ProtoHttpContent: can't find referenced class com.google.protobuf.MessageLite
[2014-05-06 17:35:05 - DesiDime] Warning: com.google.api.client.http.protobuf.ProtoHttpContent: can't find referenced class com.google.protobuf.MessageLite
[2014-05-06 17:35:05 - DesiDime] Warning: com.google.api.client.http.protobuf.ProtoHttpContent: can't find referenced class com.google.protobuf.MessageLite
[2014-05-06 17:35:05 - DesiDime] Warning: com.google.api.client.http.protobuf.ProtoHttpContent: can't find referenced class com.google.protobuf.MessageLite
[2014-05-06 17:35:05 - DesiDime] Warning: com.google.api.client.http.protobuf.ProtoHttpContent: can't find referenced class com.google.protobuf.MessageLite
[2014-05-06 17:35:05 - DesiDime] Warning: com.google.api.client.json.gson.GsonFactory: can't find referenced class com.google.gson.stream.JsonReader
[2014-05-06 17:35:05 - DesiDime] Warning: com.google.api.client.json.gson.GsonFactory: can't find referenced class com.google.gson.stream.JsonReader
[2014-05-06 17:35:05 - DesiDime] Warning: com.google.api.client.json.gson.GsonFactory: can't find referenced class com.google.gson.stream.JsonWriter
[2014-05-06 17:35:05 - DesiDime] Warning: com.google.api.client.json.gson.GsonFactory: can't find referenced class com.google.gson.stream.JsonWriter
[2014-05-06 17:35:05 - DesiDime] Warning: com.google.api.client.json.gson.GsonGenerator: can't find referenced class com.google.gson.stream.JsonWriter
[2014-05-06 17:35:05 - DesiDime] Warning: com.google.api.client.json.gson.GsonGenerator: can't find referenced class com.google.gson.stream.JsonWriter
[2014-05-06 17:35:05 - DesiDime] Warning: com.google.api.client.json.gson.GsonGenerator: can't find referenced class com.google.gson.stream.JsonWriter
[2014-05-06 17:35:05 - DesiDime] Warning: com.google.api.client.json.gson.GsonGenerator: can't find referenced class com.google.gson.stream.JsonWriter
[2014-05-06 17:35:05 - DesiDime] Warning: com.google.api.client.json.gson.GsonGenerator: can't find referenced class com.google.gson.stream.JsonWriter
下面是我的proguard-project.txt文件,取自
我的libs目录包含所需的库
我不明白为什么会出现这些错误?我可以看出您在Gson和protobuf方面存在问题。 要将Gson与proguard一起使用,请在proguard-project.txt文件中包含填充行:
# Gson uses generic type information stored in a class file when working with fields. Proguard
# removes such information by default, so configure it to keep all of it.
-keepattributes Signature
# For using GSON @Expose annotation
-keepattributes *Annotation*
# Gson specific classes
-keep class sun.misc.Unsafe { *; }
#-keep class com.google.gson.stream.** { *; }
# Application classes that will be serialized/deserialized over Gson
-keep class com.google.gson.examples.android.model.** { *; }
整个例子都可以找到
要修复protobuf错误,请尝试:
-keep class com.google.protobuf.** { *; }
我已经放置了示例文件,但仍然收到警告。请尝试取消注释-keep class com.google.gson.stream.*{;}并更改特定于项目的模型类名称:更改此->-keep class com.google.gson.examples.android.model.*{;}
# Gson uses generic type information stored in a class file when working with fields. Proguard
# removes such information by default, so configure it to keep all of it.
-keepattributes Signature
# For using GSON @Expose annotation
-keepattributes *Annotation*
# Gson specific classes
-keep class sun.misc.Unsafe { *; }
#-keep class com.google.gson.stream.** { *; }
# Application classes that will be serialized/deserialized over Gson
-keep class com.google.gson.examples.android.model.** { *; }
-keep class com.google.protobuf.** { *; }