我正在检查android的firebase消息传递功能,并检查了一个关于它的示例项目.当我编写代码时,我的应用程序可以导入通知管理器,但无法导入通知通道.我的gradle文件可以在下面找到.
import android.app.NotificationChannel;
import android.app.NotificationManager;
Run Code Online (Sandbox Code Playgroud)
我的gradle依赖
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:support-compat:25.0.0-beta2'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:support-v13:25.3.1'
compile 'com.google.android.gms:play-services:11.0.2'
compile 'com.google.firebase:firebase-messaging:11.0.2'
compile 'com.google.firebase:firebase-core:11.0.2
Run Code Online (Sandbox Code Playgroud)
谷歌项目的依赖性.
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:26.0.0-beta2'
compile 'com.android.support:animated-vector-drawable:26.0.0-beta2'
compile 'com.android.support:support-compat:26.0.0-beta2'
compile 'com.google.firebase:firebase-messaging:11.0.1'
compile 'com.firebase:firebase-jobdispatcher:0.6.0'
// Testing dependencies
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support:support-annotations:25.3.1'
}
Run Code Online (Sandbox Code Playgroud)
链接到谷歌的代码:https://github.com/firebase/quickstart-android/blob/master/messaging/app/build.gradle '
编辑:所有gradle文件.
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '25.0.3'
defaultConfig {
applicationId 'com.myapp.extranet'
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true …Run Code Online (Sandbox Code Playgroud)