找不到引用的方法'void setLatestEventInfo(

时间:2016-02-10 16:13:12

标签: android

我正在更新我的应用,使其与Android 6.0中的新权限模型保持一致。更新了我的build.gradle文件但是我现在收到这个正在停止构建的编译消息:

Warning:com.google.android.gms.common.GooglePlayServicesUtil: 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

我的build.grade就在这里:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.myspace.ian.myapp"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 65
        versionName "3.21"
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'jcifs:jcifs:1.3.17'
    compile files('libs/gson-2.3.1.jar')
    compile files('libs/logback-android-1.1.1-3.jar')
    compile files('libs/slf4j-api-1.7.6.jar')
    compile 'com.google.android.gms:play-services:6.5.87'

    compile 'com.android.support:appcompat-v7:23.1.0'
    compile 'com.android.support:design:23.1.0'
}

...这是我的proguard-rules.pro文件:

-keepclassmembers class com.dom925.xxxx {
   public *;
}
-keep class !android.support.v7.internal.view.menu.**,android.support.** {*;}
-dontwarn javax.mail.**
-dontwarn org.apache.http.**
-dontwarn android.net.http.AndroidHttpClient
-dontwarn com.octo.android.robospice.SpiceService
-dontwarn android.support.v4.**

有人可以帮忙吗? (我是一个相对的菜鸟!)

2 个答案:

答案 0 :(得分:3)

compile 'com.google.android.gms:play-services:6.5.87'

这已经过时了。之一:

  • 更新到最新的Play服务(或者,更好的是,您正在使用的Play服务的各个工件),或

  • compileSdkVersion降级为6.5.87支持的内容

目前,您使用的旧版Play服务代码需要一些旧版本的Android SDK,而不是compileSdkVersion 23setLatestEventInfo()不再存在。

答案 1 :(得分:0)

" setLatestEventInfo'方法不再受支持。尝试使用NotificationBuilder来创建通知。