firebase - 如何使用 Firebase 修复 Android Studio 自动完成?
问题描述
我正在将 Android Studio 设置为使用 Firebase,但是在设置之后,Android Studio 自动完成不会显示例如(DatabaseReference)。我按照谷歌的建议设置一切。出了什么问题?
看图片:
Firebase 配置
安卓工作室
我的项目摇篮:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.0"
classpath "com.google.gms:google-services:4.3.4"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
我的应用程序摇篮:
plugins {
id 'com.android.application'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.2"
defaultConfig {
applicationId "com.example.firebase"
minSdkVersion 26
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation platform('com.google.firebase:firebase-bom:26.0.0')
implementation 'com.google.firebase:firebase-analytics'
}
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
谢谢你
解决方案
1.关闭Android studio然后进入android studio所在的文件夹或者你可以去
驱动器 C -> 用户 -> 找到 .gradle 文件并执行以下操作
查找 .gradle 文件 -> 在 .gradle 文件夹中删除缓存文件夹,然后重新启动 android studio 将您的文件与 gradle 同步。
推荐阅读
- php - 如果客户购买了特定产品,请禁用 WooCommerce 产品一段时间
- python - 从 textinput 更改更新 kivy recycleview self.data
- python - Python Gtk Notebook 从按钮打开一个新选项卡
- react-native - 如何在本机反应中使用状态钩子来动态创建组件
- ios - 没有为给定的视图控制器注册本机启动画面。首先为给定的视图控制器调用“splashscreen.show”
- javascript - 仅使用解析和 Math.random 从 JSON 中获取随机值,没有循环、数组和 Object.keys
- grid - 如何将 QML 中的项目包装和堆叠成行和列
- python - 如何使用opencv获取轮廓作为图像
- python-3.x - 在 python 中导入包时遇到问题
- postgresql - 将记录从一个表插入到另一个表,然后删除插入的记录