Gradle

时间:2015-10-30 05:54:15

标签: android android-proguard

我正在尝试构建我的APP我收到以下错误:所有这些时间App用于正确生成构建。

我将compileSdkVersion和build升级到23,GMS升级到8.1,AsyncHttpclient升级到1.4.9。我收到以下错误。

不确定该怎么做:

  Warning:com.google.android.gms.internal.zzac: can't find referenced class android.net.http.AndroidHttpClient
    Warning:com.google.android.gms.internal.zzw: can't find referenced method 'void addHeader(java.lang.String,java.lang.String)' in program class com.google.android.gms.internal.zzw$zza
    Warning:com.google.android.gms.internal.zzw$zza: can't find referenced method 'void setURI(java.net.URI)' in program class com.google.android.gms.internal.zzw$zza
    Warning:there were 2 unresolved references to classes or interfaces.
             You may need to add missing library jars or update their versions.
             If your code works fine without the missing classes, you can suppress
             the warnings with '-dontwarn' options.
             (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
    Warning:there were 2 unresolved references to program class members.
             Your input classes appear to be inconsistent.
             You may need to recompile the code.
             (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedprogramclassmember)
    :app:proguardRelease FAILED
    Error:Execution failed for task ':app:proguardRelease'.
    > java.io.IOException: Please correct the above warnings first.

这里可能有什么问题?

1 个答案:

答案 0 :(得分:0)

如果你还没有在progruard中添加命令,那么添加。

-keep class com.google.android.gms.maps.** { *; }
-keep interface com.google.android.gms.maps.** { *; }

如果您使用地图,则应查看开发者网站。已经有了进展。

对于地图,您可能需要添加以下代码。如果你没有添加。

# The Maps API uses custom Parcelables.
# Use this rule (which is slightly broader than the standard recommended one)
# to avoid obfuscating them.
-keepclassmembers class * implements android.os.Parcelable {
    static *** CREATOR;
}

# The Maps API uses serialization.
-keepclassmembers class * implements java.io.Serializable {
    static final long serialVersionUID;
    static final java.io.ObjectStreamField[] serialPersistentFields;
    private void writeObject(java.io.ObjectOutputStream);
    private void readObject(java.io.ObjectInputStream);
    java.lang.Object writeReplace();
    java.lang.Object readResolve();
}

-dontwarn com.google.android.maps.GeoPoint
-dontwarn com.google.android.maps.MapActivity
-dontwarn com.google.android.maps.MapView
-dontwarn com.google.android.maps.MapController
-dontwarn com.google.android.maps.Overlay
-dontwarn com.google.android.gms.maps.model.*