2016-10-27 150 views
0

由於我添加了這個依賴項,我無法再生成已簽名的APK。古怪,構建/編譯APK工作,但構建/生成APK簽署失敗,這些行:使用android map utils library生成已簽名apk的錯誤

Warning:com.google.maps.android.clustering.ClusterManager: can't find superclass or interface com.google.android.gms.maps.GoogleMap$OnCameraIdleListener 
Warning:com.google.maps.android.clustering.ClusterManager: can't find referenced class com.google.android.gms.maps.GoogleMap$OnCameraIdleListener 
Warning:com.google.maps.android.kml.KmlRenderer: can't find referenced method 'void setZIndex(float)' in program class com.google.android.gms.maps.model.Marker 
Warning:there were 4 unresolved references to classes or interfaces. 
Warning:there were 1 unresolved references to program class members. 
Warning:Exception while processing task java.io.IOException: Please correct the above warnings first. 
Error:java.lang.RuntimeException: java.io.IOException: Please correct the above warnings first. 
Error:java.io.IOException: Please correct the above warnings first. 
Information:BUILD FAILED 

這裏是我的模塊的build.gradle依賴部分:

apply plugin: 'com.android.model.library' 
apply plugin: 'com.google.gms.google-services' 

dependencies { 
    compile 'com.google.android.gms:play-services-maps:9.0.2' 
    compile 'com.google.maps.android:android-maps-utils:0.4+' 
} 

model 
{ 
    [etc...] 
} 

而且這是項目一級:

buildscript { 
    repositories { 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle-experimental:0.8.0' 
     classpath 'com.google.gms:google-services:3.0.0' 

     // NOTE: Do not place your application dependencies here; they belong 
     // in the individual module build.gradle files 
    } 
} 
+0

確實構建通如果禁用proguard的? – medhdj

回答

1

可能Proguard的(這是做的工作),當您試圖生成APK簽署(發行版),你可以解決這個問題通過增加

-keep public class com.google.android.gms.* { public *; } 
-dontwarn com.google.android.gms.** 

,但通常這是在地圖圖書館已經完成,我會建議使用最新版本在你面前的地圖LIB嘗試上面的解決方案

com.google.android.gms:play-services-maps:9.8.0 
+0

有道理。但切換到9.8.0時出現此錯誤:'無法解析:com.google.android.gms:play-services-maps:9.8.0' – tishu

+0

在您的模塊build.gradle中添加'apply plugin:'com。 google.gms.google-services''在你的依賴關係 – medhdj

+0

下面,當我補充說我得到了和上面相同的錯誤,而這個在上面:'錯誤:無法解析:com.google.firebase:firebase-core:9.8。 0'。我已經使用新的build.gradle(模塊級別1)更新了帖子 – tishu

相關問題