在firebase代码android中获取错误如何解决



获取以下错误:

错误:(209,62(错误:无法访问zzbgl找不到com.google.android.gms.internal.zzbgl的类文件

模块等级:

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.qltech.ql.yupit"
minSdkVersion 19
targetSdkVersion 26
versionCode 7
versionName "7.0"
multiDexEnabled true
testInstrumentationRunner 
"android.support.test.runner.AndroidJUnitRunner"
}
dexOptions {
javaMaxHeapSize "4g"
}
buildTypes {
build {
ndk {
abiFilters "arm64-v8a", "armeabi-v7a"
}
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
ndk {
abiFilters "arm64-v8a", "armeabi-v7a"
}
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
}
dependencies {
implementation  fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', 
{
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation  'com.facebook.android:facebook-login:4.28.0'
implementation  'com.android.support:appcompat-v7:26.+'
implementation  'pl.droidsonroids.gif:android-gif-drawable:1.2.2'
implementation "com.google.android.gms:play-services-base:16.0.1"
implementation "com.google.android.gms:play-services-analytics:16.0.5"
implementation  'com.pixplicity.easyprefs:library:1.8.1@aar'
implementation  'com.wang.avi:library:2.1.3'
implementation  'com.android.volley:volley:1.0.0'
implementation  'com.android.support:recyclerview-v7:23.2.1'
implementation  'com.android.support:cardview-v7:23.4.0'
implementation  'com.google.code.gson:gson:2.7'
implementation  'de.hdodenhof:circleimageview:2.2.0'
implementation  'com.android.support:design:27.1.1'
implementation  'com.github.bumptech.glide:glide:3.7.0'
implementation  'com.stripe:stripe-android:2.0.2'
implementation  'com.google.firebase:firebase-auth:16.0.6'
implementation  'com.google.firebase:firebase-core:16.0.6'
implementation  'com.squareup.okhttp:okhttp:2.0.0'
implementation  'com.squareup.retrofit:retrofit:1.9.0'
implementation  'com.google.android:flexbox:0.3.0'
implementation  'com.github.lzyzsd:circleprogress:1.2.1'
implementation  'net.gotev:uploadservice:2.1'
implementation  'com.squareup.okhttp:okhttp-urlconnection:2.0.0'
implementation 'com.github.faruktoptas:FancyShowCaseView:1.0.1'
implementation  'com.google.android.gms:play-services-analytics:16.0.1'
implementation  'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
implementation  "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
apply plugin: 'com.google.gms.google-services'
repositories {
mavenCentral()
}

app.gradle;

buildscript {
ext.kotlin_version = '1.2.41'
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0-alpha18'
classpath 'com.google.gms:google-services:4.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

要解决此问题,请将所有compile关键字更改为implementation。根据我在帖子中的回答,请评论/删除以下代码行:

//compile 'com.google.android.gms:play-services:12.0.1'

并且只能使用:

implementation "com.google.android.gms:play-services-base:16.0.1"
implementation "com.google.android.gms:play-services-analytics:16.0.5"

这是关于Individual API的官方文档和相应的build.gradle描述。

根据您编辑的问题,也请更改:

classpath 'com.android.tools.build:gradle:3.2.0-alpha18'

classpath 'com.android.tools.build:gradle:3.2.1'

implementation 'com.google.firebase:firebase-core:16.0.5'

implementation "com.google.firebase:firebase-core:16.0.6"

最新更新