【发布时间】:2018-04-26 16:41:53
【问题描述】:
mDatabse = FirebaseDatabase.getInstance().getReference().child("Users");
HashMap<String, String> usermMap = new HashMap<>();
usermMap.put("name", display_name);
usermMap.put("status", "Hey, ich benutze die App.");
usermMap.put("image", "default_pic");
usermMap.put("thumb_image", "default_pic");
mDatabse.setValue(usermMap);
它只注册此帐户,但不创建数据库数据。
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "de.epix_crew.epixchat"
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
//implementation 'com.android.support:design-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.google.firebase:firebase-auth:15.0.0'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.google.firebase:firebase-database:15.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'
implementation 'com.android.support:design:27.1.1'
implementation 'de.hdodenhof:circleimageview:2.2.0'
}
apply plugin: 'com.google.gms.google-services'
这是这个文件,希望你能帮助我让它工作。 也许如果你有 Teamviewer 你可以看到问题:)
也谢谢:)
【问题讨论】:
-
你检查权限了吗?请解释您的问题!
-
我在 Youtube 上遵循教程,现在他不将我的数据写入数据库。
-
如果即使设置了权限也不能工作,是不是代码执行进入了if (task.isSuccessful())
-
你是什么意思?对不起,我的英语不太好^^