android - 在将 Android 项目连接到 Firebase 时出现错误:“无法解决:localbroadcastmanager”
问题描述
我正在尝试将 Firebase 连接到 android,但在同步项目时出现错误。我拥有最新版本的 google 存储库,并且已将所需的依赖项添加到项目级 build.gradle 和应用级 build.gradle。
下面是我的应用级 Gradle :
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "com.example.ecommerce"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.+'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-core:17.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'
}
apply plugin: 'com.google.gms.google-services'
还有我的项目级 gradle :
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
classpath 'com.google.gms:google-services:4.2.0'
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
解决方案
我移民到androidx。我还在我的应用程序级 Gradle 中添加了以下行,并且它有效:
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
推荐阅读
- java - 无法将 Jar 文件作为 Windows 服务中的进程启动
- mongodb - 我如何在 mongoDB 中像这样迭代和减去两个命令游标对象?
- python - 如何在 Django 中运行 view.py 文件以抓取和存储数据
- sequelize.js - 如何链访问关系sequelize
- python - ModuleNotFoundError:没有名为“azure.cognitiveservices.vision.customvision”的模块
- java - 为什么我不能推送到列表 - kotlin
- c# - Stripe .NET 39.45 - Plan 类关联在 Subscription 类上移到了哪里?
- javascript - 单击时如何创建按钮并修改值?
- java - 如何解决“org.slf4j.impl.StaticLoggerBinder”错误以运行我的 Javalin Web 应用程序?
- python - 获取 keras 中 fit_generator 的当前进度