将 Firebase 添加到我的应用程序后,我对 gradle 问题很生气, 我收到错误: 找不到 com.google.android.gms.internal.zzbgl 的类文件
我正在使用 android location 和 url stringRequest,直到那时它运行良好,然后我将 Firebase 添加到 gradle(我已经在 Firebase 网站上注册并添加了生成的 google-services.json)
我检查了很多没有帮助的答案,我已经将 gradle 更新到 3.4.2 仍然无法正常工作
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "com.example.mapwithmarker"
minSdkVersion 22
targetSdkVersion 26
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
resValue "string", "google_maps_key", (project.findProperty("GOOGLE_MAPS_API_KEY") ?: "")
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.google.android.gms:play-services:12.0.1'
implementation 'com.mcxiaoke.volley:library:1.0.19'
implementation 'com.google.firebase:firebase-core:17.0.1'
testImplementation 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
//maven {
// url "https://maven.google.com"
//}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
有什么帮助吗?
最佳答案
如 official docs 所述,
“不要使用组合播放服务目标。它引入了数十个库,使您的应用程序膨胀。相反,仅指定您的应用使用的特定 Google Play 服务 API。”
你不应该使用组合播放服务库。而是尝试使用您需要的特定库并尝试将特定库更新到 17.0.0
关于android - 如何在 Android 中使用 Firebase?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57043904/