任务':app:transformClassesAndResourcesWithProguardForRelease'执行失败,并带有-keep标志

时间:2018-02-19 04:42:32

标签: android-studio proguard

我希望有人可以帮助解决这些特定的构建失败 - 我已经看到所有SO线程并尝试了主要的,我的具体错误:

Error:Warning: com.google.android.maps.MapView$Repainter: can't find superclass or interface android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestListener
Warning: com.google.android.maps.MapView$Repainter: can't find referenced class android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestListener
Warning: com.google.android.maps.MapView$Repainter: can't find referenced class android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequest
Warning: com.google.android.maps.ZoomHelper$Snapshot: can't find referenced class android_maps_conflict_avoidance.com.google.map.Zoom
Warning: there were 4 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)
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.
  

作业失败,请参阅日志了解详情

我的构建文件发布部分:

release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
    }

所以在proguard-rules.txt中我试过

-ignorewarnings
-keep class * {
public private *;
}

更具体地说,我已经尝试了

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

这些似乎都不起作用 - 有什么我可以做的,以确定它是否甚至读取这个proguard txt文件?

还有其他建议吗?

1 个答案:

答案 0 :(得分:0)

嗯它没多久但是我进入了Build - >编辑构建类型,在这里我选择了release,并手动选择了我的proguard-rules.txt,点击确定并基本上添加了

proguardFile '.../StudioProjects/App/proguard-rules.txt'

使构建成功运行。