Android NotificationCompact.Builder不';不接受通道id,仅接受上下文
我正在尝试在我的应用程序中创建通知,但下面的方法不接受带有上下文的频道id。它只接受上下文,所以我没有收到通知。请告诉我如何解决这个问题Android NotificationCompact.Builder不';不接受通道id,仅接受上下文,android,android-notifications,android-8.0-oreo,Android,Android Notifications,Android 8.0 Oreo,我正在尝试在我的应用程序中创建通知,但下面的方法不接受带有上下文的频道id。它只接受上下文,所以我没有收到通知。请告诉我如何解决这个问题 NotificationCompat.Builder builder = new NotificationCompat.Builder(ctx, CHANNEL_ID). 这是我的身材。格雷德尔: apply plugin: 'com.android.application' android { compileSdkVersion 26 b
NotificationCompat.Builder builder = new NotificationCompat.Builder(ctx, CHANNEL_ID).
这是我的身材。格雷德尔:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.example.murarilal.atry"
minSdkVersion 14
targetSdkVersion 26
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding{
enabled true
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '25.3.1'
}
}
}
}
//compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
compile 'com.android.support:design:26.0.0-alpha1'
compile 'com.android.support:appcompat-v7:26.0.2'
compile 'com.android.support:support-v4:26.1.0'
compile 'com.android.support:support-v4:26.0.0-alpha1'
compile 'com.android.support:recyclerview-v7:26.0.0-alpha1'
compile 'com.android.support:cardview-v7:26.0.0-alpha1'
compile 'de.hdodenhof:circleimageview:2.2.0'
compile 'com.miguelcatalan:materialsearchview:1.4.0'
}
删除以下内容:
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '25.3.1'
}
}
}
}
这将迫使您的所有依赖项
25.3.1
。除其他外,它没有您想要的NotificationCompat.Builder
。我仍然没有得到。