Pro guard error build release apk

时间:2015-10-16 18:05:44

标签: android android-build

我在尝试构建发布apk时遇到以下错误

:app:compileReleaseNdk UP-TO-DATE
:app:compileReleaseSources
:app:lintVitalRelease
:app:proguardRelease
Warning: android.support.v4.app.NotificationCompat$NotificationCompatImplBase: can't find referenced method 'void setLatestEventInfo(android.content.Context,java.lang.CharSequence,java.lang.CharSequence,android.app.PendingIntent)' in library class android.app.Notification
Warning: android.support.v4.app.NotificationCompat$NotificationCompatImplGingerbread: can't find referenced method 'void setLatestEventInfo(android.content.Context,java.lang.CharSequence,java.lang.CharSequence,android.app.PendingIntent)' in library class android.app.Notification
Warning: android.support.v4.app.NotificationCompatGingerbread: can't find referenced method 'void setLatestEventInfo(android.content.Context,java.lang.CharSequence,java.lang.CharSequence,android.app.PendingIntent)' in library class android.app.Notification
Warning: there were 3 unresolved references to library class members.
         You probably need to update the library versions.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedlibraryclassmember)
:app:proguardRelease FAILED

在build.gradle中我有这个:

依赖{     编译" com.android.support:support-v4:23.0.0" }

如果我将其更改为"com.android.support:support-v13:23.0.0"

,仍会出现相同的错误

当错误消息显示:"您可能需要更新库版本。"它指的是什么库,如何更新?

错误中引用的文档说:  "If you're developing for Android and ProGuard complains that it can't find a method that is only available in a recent version of the Android run-time, you should change the build target in your project.properties file or build.gradle file to that recent version. You can still specify a different minSdkVersion and a different targetSdkVersion in your AndroidManifest.xml file."

这是我的build.gradle,它与API 23一样最新。 那么我该如何解决这个问题?

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.cequint.ecid"
        minSdkVersion 23
        compileSdkVersion 23
    }

1 个答案:

答案 0 :(得分:13)

我将此添加到pro guard.cfg并且它有效:

-dontwarn android.support.v4.**