Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/229.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/tfs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在android firebase中注册用户错误_Android_Firebase - Fatal编程技术网

在android firebase中注册用户错误

在android firebase中注册用户错误,android,firebase,Android,Firebase,我是android开发新手。我正在尝试开发一个大学应用程序,通过它管理员将在firebase中注册用户。代码没有显示任何错误,但当我单击注册按钮时,应用程序正在重新启动。请帮帮我。 先谢谢你 这是我的密码 package com.example.abhisek.abacollege; import android.app.ProgressDialog; import android.support.v7.app.AppCompatActivity; import android.os.

我是android开发新手。我正在尝试开发一个大学应用程序,通过它管理员将在firebase中注册用户。代码没有显示任何错误,但当我单击注册按钮时,应用程序正在重新启动。请帮帮我。 先谢谢你 这是我的密码

    package com.example.abhisek.abacollege;

import android.app.ProgressDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;


import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;

public class AdminLayout extends AppCompatActivity {
    private EditText SID;
    private EditText SPass;
    private Button AReg;
    private Prog`enter code here`ressDialog progressDialog;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_admin_layout);

        final DatabaseReference mRootRef = FirebaseDatabase.getInstance().getReferenceFromUrl("https://abacollege-2730a.firebaseio.com/STUDENTS");
        progressDialog = new ProgressDialog(this);
        SID = (EditText) findViewById(R.id.StID);
        SPass = (EditText) findViewById(R.id.StPass);
        AReg = (Button) findViewById(R.id.StRegBtn);

        AReg.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String ID = SID.getText().toString();
                String Pass = SPass.getText().toString();

                DatabaseReference childRef = mRootRef.child(ID);
                childRef.setValue(Pass);
            }
        });


    }

我的身材渐变

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.example.abhisek.abacollege"
        minSdkVersion 19
        targetSdkVersion 26
        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:26.0.0-beta1'
    implementation 'com.android.support:design:26.0.0-beta1'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.android.support:support-v4:26.1.0'
    implementation 'com.google.android.gms:play-services-auth:11.8.0'
    implementation 'com.google.firebase:firebase-messaging:11.8.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:0.5'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    compile 'com.google.firebase:firebase-database:11.8.0'
    compile 'com.google.firebase:firebase-crash:11.8.0'
    compile 'com.google.firebase:firebase-auth:11.8.0'
}
apply plugin: 'com.google.gms.google-services'
configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '25.3.0'
            }
        }
    }
}
请帮帮我,我真的需要它。。再次感谢你 校正 我的原木猫

03-09 21:19:00.205 2570-2629/com.example.abhisek.abacollege I/FA: Tag Manager is not found and thus will not be used
03-09 21:19:00.282 2570-2629/com.example.abhisek.abacollege D/FA: Logging event (FE): screen_view(_vs), Bundle[{firebase_event_origin(_o)=auto, firebase_screen_class(_sc)=MainActivity, firebase_screen_id(_si)=-1484019674178325915}]
03-09 21:19:01.162 2570-2629/com.example.abhisek.abacollege V/FA: Connecting to remote service
03-09 21:19:01.170 2570-2570/com.example.abhisek.abacollege W/FA: Service connection failed: ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_REQUIRED, resolution=null, message=null}
03-09 21:19:01.193 2570-2629/com.example.abhisek.abacollege V/FA: Processing queued up service tasks: 4
03-09 21:19:01.193 2570-2629/com.example.abhisek.abacollege E/FA: Discarding data. Failed to send app launch
03-09 21:19:01.194 2570-2629/com.example.abhisek.abacollege E/FA: Failed to get app instance id
03-09 21:19:01.195 2570-2629/com.example.abhisek.abacollege E/FA: Failed to send current screen to service
03-09 21:19:01.202 2570-2629/com.example.abhisek.abacollege E/FA: Discarding data. Failed to send event to service
03-09 21:19:01.214 2570-2629/com.example.abhisek.abacollege V/FA: Processing queued up service tasks: 0
03-09 21:19:11.576 2552-2808/com.google.android.gms I/FA-SVC: App measurement is starting up, version: 11580
03-09 21:19:11.632 2552-2808/com.google.android.gms V/FA-SVC: Collection enabled
03-09 21:19:11.694 2552-2808/com.google.android.gms D/FA-SVC: Debug-level message logging enabled
03-09 21:19:11.815 2552-2808/com.google.android.gms V/FA-SVC: Cancelling job. JobID: 812057698
03-09 21:19:11.916 2552-3368/com.google.android.gms I/FA-SVC: This instance being marked as an uploader
03-09 21:19:11.978 2552-3368/com.google.android.gms V/FA-SVC: Nothing to upload or uploading impossible
03-09 21:19:11.980 2552-3368/com.google.android.gms V/FA-SVC: Cancelling job. JobID: 812057698
03-09 21:19:14.769 2552-3213/com.google.android.gms D/FA-SVC: Got package replaced intent: com.example.abhisek.abacollege
03-09 21:19:15.065 2570-2609/com.example.abhisek.abacollege E/FirebaseInstanceId: Token retrieval failed: AUTHENTICATION_FAILED
03-09 21:19:45.096 2570-2609/com.example.abhisek.abacollege E/FirebaseInstanceId: Token retrieval failed: AUTHENTICATION_FAILED
03-09 21:20:18.939 2570-3753/com.example.abhisek.abacollege V/FA: Recording user engagement, ms: 79212
03-09 21:20:18.941 2570-3753/com.example.abhisek.abacollege V/FA: Connecting to remote service
03-09 21:20:18.955 2570-3753/com.example.abhisek.abacollege V/FA: Activity paused, time: 150300
03-09 21:20:18.976 2570-3753/com.example.abhisek.abacollege D/FA: Logging event (FE): user_engagement(_e), Bundle[{firebase_event_origin(_o)=auto, engagement_time_msec(_et)=79212, firebase_screen_class(_sc)=MainActivity, firebase_screen_id(_si)=-1484019674178325915}]
03-09 21:20:19.030 2570-2570/com.example.abhisek.abacollege V/FA: onActivityCreated
03-09 21:20:19.345 2570-3753/com.example.abhisek.abacollege V/FA: Connection attempt already in progress
03-09 21:20:19.369 2570-3753/com.example.abhisek.abacollege V/FA: Connection attempt already in progress
03-09 21:20:19.370 2570-3753/com.example.abhisek.abacollege V/FA: Activity resumed, time: 150668
03-09 21:20:19.385 2570-2570/com.example.abhisek.abacollege W/FA: Service connection failed: ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_REQUIRED, resolution=null, message=null}
03-09 21:20:19.400 2570-3753/com.example.abhisek.abacollege D/FA: Logging event (FE): screen_view(_vs), Bundle[{firebase_event_origin(_o)=auto, firebase_previous_class(_pc)=MainActivity, firebase_previous_id(_pi)=-1484019674178325915, firebase_screen_class(_sc)=AdminLogin, firebase_screen_id(_si)=-1484019674178325914}]
03-09 21:20:19.485 2570-3753/com.example.abhisek.abacollege V/FA: Connecting to remote service
03-09 21:20:19.506 2570-3753/com.example.abhisek.abacollege V/FA: Processing queued up service tasks: 4
03-09 21:20:19.519 2570-3753/com.example.abhisek.abacollege E/FA: Failed to send current screen to service
03-09 21:20:19.530 2570-3753/com.example.abhisek.abacollege E/FA: Discarding data. Failed to send event to service
03-09 21:20:19.531 2570-3753/com.example.abhisek.abacollege E/FA: Failed to send current screen to service
03-09 21:20:19.532 2570-3753/com.example.abhisek.abacollege E/FA: Discarding data. Failed to send event to service
03-09 21:20:19.743 2570-2570/com.example.abhisek.abacollege W/FA: Service connection failed: ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_REQUIRED, resolution=null, message=null}
03-09 21:20:19.759 2570-3753/com.example.abhisek.abacollege V/FA: Processing queued up service tasks: 0
03-09 21:20:20.835 1774-1774/com.google.android.inputmethod.latin W/GInputConnectionWrapper: Fixing selection indices to 0, 0
03-09 21:20:24.650 1774-1774/com.google.android.inputmethod.latin W/GInputConnectionWrapper: Fixing selection indices to 0, 0
03-09 21:20:28.537 2570-3753/com.example.abhisek.abacollege V/FA: Recording user engagement, ms: 9245
03-09 21:20:28.538 2570-3753/com.example.abhisek.abacollege V/FA: Connecting to remote service
03-09 21:20:28.542 2570-3753/com.example.abhisek.abacollege V/FA: Activity paused, time: 159912
03-09 21:20:28.551 2570-3753/com.example.abhisek.abacollege D/FA: Logging event (FE): user_engagement(_e), Bundle[{firebase_event_origin(_o)=auto, engagement_time_msec(_et)=9245, firebase_screen_class(_sc)=AdminLogin, firebase_screen_id(_si)=-1484019674178325914}]
03-09 21:20:28.569 2570-2570/com.example.abhisek.abacollege W/FA: Service connection failed: ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_REQUIRED, resolution=null, message=null}
03-09 21:20:28.592 2570-3753/com.example.abhisek.abacollege V/FA: Connecting to remote service
03-09 21:20:28.600 2570-3753/com.example.abhisek.abacollege V/FA: Processing queued up service tasks: 2
03-09 21:20:28.600 2570-3753/com.example.abhisek.abacollege E/FA: Failed to send current screen to service
03-09 21:20:28.601 2570-3753/com.example.abhisek.abacollege E/FA: Discarding data. Failed to send event to service
03-09 21:20:28.615 2570-2570/com.example.abhisek.abacollege V/FA: onActivityCreated
03-09 21:20:28.839 2570-3753/com.example.abhisek.abacollege V/FA: Connection attempt already in progress
03-09 21:20:28.839 2570-3753/com.example.abhisek.abacollege V/FA: Activity resumed, time: 160204
03-09 21:20:29.027 2570-3753/com.example.abhisek.abacollege D/FA: Logging event (FE): screen_view(_vs), Bundle[{firebase_event_origin(_o)=auto, firebase_previous_class(_pc)=AdminLogin, firebase_previous_id(_pi)=-1484019674178325914, firebase_screen_class(_sc)=AdminLayout, firebase_screen_id(_si)=-1484019674178325913}]
03-09 21:20:29.063 2570-2570/com.example.abhisek.abacollege W/FA: Service connection failed: ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_REQUIRED, resolution=null, message=null}
03-09 21:20:29.215 2570-3753/com.example.abhisek.abacollege V/FA: Connecting to remote service
03-09 21:20:29.237 2570-3753/com.example.abhisek.abacollege V/FA: Processing queued up service tasks: 2
03-09 21:20:29.238 2570-3753/com.example.abhisek.abacollege E/FA: Failed to send current screen to service
03-09 21:20:29.239 2570-3753/com.example.abhisek.abacollege E/FA: Discarding data. Failed to send event to service
03-09 21:20:29.477 2570-2570/com.example.abhisek.abacollege W/FA: Service connection failed: ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_REQUIRED, resolution=null, message=null}
03-09 21:20:29.494 2570-3753/com.example.abhisek.abacollege V/FA: Processing queued up service tasks: 0
03-09 21:20:30.142 1774-1774/com.google.android.inputmethod.latin W/GInputConnectionWrapper: Fixing selection indices to 0, 0
03-09 21:20:34.170 2552-2564/com.google.android.gms W/SQLiteConnectionPool: A SQLiteConnection object for database '/data/user/0/com.google.android.gms/databases/networkstatistics.sqlite' was leaked!  Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
03-09 21:20:36.380 1774-1774/com.google.android.inputmethod.latin W/GInputConnectionWrapper: Fixing selection indices to 0, 0
03-09 21:20:40.580 2570-3753/com.example.abhisek.abacollege D/FA: Logging event (FE): app_exception(_ae), Bundle[{firebase_event_origin(_o)=crash, firebase_screen_class(_sc)=AdminLayout, firebase_screen_id(_si)=-1484019674178325913, timestamp=1520610640567, fatal=1}]
03-09 21:20:40.621 2570-3753/com.example.abhisek.abacollege V/FA: Connecting to remote service
03-09 21:20:40.625 2570-3753/com.example.abhisek.abacollege V/FA: Recording user engagement, ms: 11798
03-09 21:20:40.633 2570-3753/com.example.abhisek.abacollege D/FA: Logging event (FE): user_engagement(_e), Bundle[{firebase_event_origin(_o)=auto, engagement_time_msec(_et)=11798, firebase_screen_class(_sc)=AdminLayout, firebase_screen_id(_si)=-1484019674178325913}]
03-09 21:20:40.664 2570-3753/com.example.abhisek.abacollege V/FA: Connection attempt already in progress

您正在创建两个引用,但您可以简单地执行此操作

在您的
onClick中

mRootRef.child(ID).setValue(Pass);
确保在firebase中的规则中,如果您未登录或未经身份验证,则将其设置为true


错误是什么。发布错误日志。请参阅logCat。问题在于这里DatabaseReference childRef=mRootRef.child(ID);childRef.setValue(通过),为什么您试图引用您刚刚创建的子对象?我想将学生插入学生的子对象,将教师插入教师的子对象,您这样做是错误的,因为您将引用放在了不存在的对象上,请粘贴日志。您不需要做两次引用Firebase规则是{“规则”:{。阅读:““auth!=null”,“.write”:“auth!=null”}