我做了google docs中说的话。
实际上我想将FCM添加到我的项目中,我认为可能是因为应用程序未与Google服务器通信。
这是应用程序级别的gradle文件
buildscript {
repositories {
jcenter()
google()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 28
buildToolsVersion('28.0.3')
flavorDimensions "default"
defaultConfig {
applicationId "com.kbcipl.mgk.com"
minSdkVersion 16
targetSdkVersion 26
versionCode 56
versionName "5.0.1"
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
lintOptions {
disable 'MissingTranslation'
}
}
}
productFlavors {
dev {
applicationId "com.kbcipl.mgk.com.dev"
buildConfigField 'String', 'HOST', '"host"'
buildConfigField 'String', 'BASE_URL', '"url"'
buildConfigField 'String', 'SUPPLIERTYPE', '"pkl"'
buildConfigField 'String', 'DATABASETYPE', '"dev"'
}
}
}
dependencies {
configurations {
all*.exclude group: 'com.android.support', module: 'support-v13'
}
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.mcxiaoke.volley:library:1.0.19'
implementation 'com.toptoche.searchablespinner:searchablespinnerlibrary:1.3.1'
implementation 'com.github.rey5137:material:1.2.2'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'de.hdodenhof:circleimageview:3.0.0'
implementation 'com.kbeanie:image-chooser-library:1.5.8@aar'
implementation 'com.afollestad.material-dialogs:core:0.9.4.4'
implementation 'com.google.firebase:firebase-crash:16.2.1'
implementation 'com.google.firebase:firebase-messaging:18.0.0'
implementation('com.crashlytics.sdk.android:crashlytics:2.8.0@aar') {
transitive = true
}
implementation 'com.google.firebase:firebase-analytics:16.2.1'
implementation 'com.google.firebase:firebase-core:16.0.9'
implementation 'com.google.code.gson:gson:2.8.0'
}
这是我的项目级别gradle
顶级构建文件,您可以在其中添加所有子项目/模块共有的配置选项。
buildscript {
repositories {
jcenter()
google() // Google's Maven repository
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.google.gms:google-services:4.3.3'
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url "https://maven.google.com" // Google's Maven repository
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}