我正在尝试从Firebase读取数据,但是由于某种原因我无法同步我的Gradle项目。
我去from pytest import fixture # added
from paste.fixture import TestApp
from app import app
def test_index(test_app):
r = test_app.get('/')
assert r.status == 200
assert 'Hello, world!' in r
@fixture()
def test_app():
middleware = []
return TestApp(app.wsgifunc(*middleware))
并添加了身份验证和实时数据库作为我在YouTube上推荐的视频。
但是之后我的Gradle项目同步继续失败。
我已经在Google上搜索了此问题,并试图更新我的版本,但没有成功。
我还在Tools -> Firebase
文件的底部添加了com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
,但它表示这是不必要的合格引用。
这是一些代码。
build.gradle
// 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:3.2.1'
classpath 'com.google.gms:google-services:4.0.1'
// 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
}
更新 抱歉,我忘记添加错误消息了。
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.el.ariby"
minSdkVersion 21
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'
}
}
dataBinding {
enabled = true
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.google.firebase:firebase-core:16.0.8'
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.google.firebase:firebase-database:15.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.3'
implementation 'com.google.firebase:firebase-storage:16.0.1'
//implementation 'com.google.firebase:firebase-auth:16.2.1'
//implementation 'com.google.firebase:firebase-storage:16.1.0'
//implementation 'com.google.firebase:firebase-database:16.0.1:15.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
implementation 'com.github.bumptech.glide:glide:4.9.0'
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
implementation 'com.squareup.okhttp3:okhttp:3.4.2'
implementation 'com.squareup.okhttp3:logging-interceptor:3.9.1'
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.google.firebase:firebase-auth:16.0.1:15.0.0'
implementation 'com.google.firebase:firebase-database:16.0.1:15.0.0'
}
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
我真的希望我可以同步文件。
谢谢!
答案 0 :(得分:0)
请下次根据控制台或xlint提供有关错误的更多详细信息,以便我们评估问题。 但是我已经遇到一个阻止同步的错误,您使用的库版本不同,会引起冲突。请注意,如果您使用一个版本的Firebase库,则必须使用相同版本的所有库。错误在这里:
implementation 'com.google.firebase:firebase-database:15.0.1' // 15.0.1????
implementation 'com.google.firebase:firebase-auth:16.0.3' // 16.0.3???
implementation 'com.google.firebase:firebase-storage:16.0.1' //16.0.1???
示例:
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.google.firebase:firebase-core:16.0.3' //this is the same version
implementation 'com.google.firebase:firebase-auth:16.0.3' //than this
implementation 'com.google.firebase:firebase-database:16.0.3'
implementation 'com.google.firebase:firebase-storage:16.0.3'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
implementation 'com.github.bumptech.glide:glide:4.9.0'
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
implementation 'com.squareup.okhttp3:okhttp:3.4.2'
implementation 'com.squareup.okhttp3:logging-interceptor:3.9.1'
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'
答案 1 :(得分:0)
只需替换此行
implementation 'com.google.firebase:firebase-auth:16.0.1:15.0.0'
implementation 'com.google.firebase:firebase-database:16.0.1:15.0.0'
与
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'