android - Pro guard错误构建发布apk

标签 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"

仍然会出现相同的错误

当错误消息这样说时:“您可能需要更新库版本。”它指的是什么库,我该如何更新它?

错误中引用的文档说: “如果您正在为 Android 开发并且 ProGuard 提示它无法找到仅在最新版本的 Android 运行时中可用的方法,您应该更改 project.properties 文件中的构建目标或build.gradle 文件到最新版本。您仍然可以在 AndroidManifest.xml 文件中指定不同的 minSdkVersion 和不同的 targetSdkVersion。“

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

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

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

最佳答案

我将它添加到 pro guard.cfg 并且它起作用了:

-dontwarn android.support.v4.**

关于android - Pro guard错误构建发布apk,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33176876/

相关文章:

java - Firebase 直接从数据库反射(reflect)变化?

android - TextView 设置文本问题

android - 无法访问 ActivityCompatApi23 类

android - 如果使用Android构建工具v0.6.1,则Android Studio在启动时显示错误

android - 生成签名的 apk。错误 :(7) [MissingTranslation] in build/generated/res/generated/release/values/generated. xml

android - CC在宋语里是什么意思

android - SQLite Xamarin 重复列 ID 问题

android - 如何支持多屏维度

android - 删除动态创建的 ImageViews Android 之间的空白

android - 如果我在构建类型和产品风格中定义类会怎样?