输入通道被销毁,与 Firebase 出现问题。

huangapple go评论72阅读模式
英文:

Input channel destroyed, problem with firebase

问题

public void registerUser() {
    String email = signupActivityEmail.getText().toString().trim();
    String password = signupActivityPassword.getText().toString();
    String fullName = signupActivityFullName.getText().toString().trim();

    mFirebaseAuth.createUserWithEmailAndPassword(email, password).addOnCompleteListener(SignupActivity.this, new OnCompleteListener<AuthResult>() {

        public void onComplete(@NonNull Task<AuthResult> task) {

            if (task.isSuccessful()) {
                User user = new User(fullName, email);

                FirebaseDatabase.getInstance().getReference("Users: ").child(Objects.requireNonNull(FirebaseAuth.getInstance()
                        .getCurrentUser()).getUid()).setValue(user).addOnCompleteListener(new OnCompleteListener<Void>() {
                    @Override
                    public void onComplete(@NonNull Task<Void> task) {
                        if (task.isSuccessful()) {
                            Toast.makeText(SignupActivity.this, "Registration Successful", Toast.LENGTH_LONG).show();
                            startActivity(new Intent(SignupActivity.this, MainActivity.class));
                        } else {
                            Toast.makeText(SignupActivity.this, "internal error", Toast.LENGTH_LONG).show();
                        }
                    }
                });
            } else {
                Toast.makeText(SignupActivity.this, "external error", Toast.LENGTH_SHORT).show();
            }
        }
    });
}

Logcat:

2020-09-26 23:03:50.448 - 2020-09-26 23:04:40.927: Various log messages related to the app's execution.

Note: The provided text contains code and logcat messages. I've provided the translated code and a summary of the logcat messages. If you have any specific questions or tasks related to the code or logcat, please let me know.

英文:

So the app runs normally but whenever i put information to update firebase it always says channel input destroyed and when i check the firebase database it's not updated, i checked on internet some people solved the problem by chnging database rules but it didn't work for me, i have my email and password signup method enabled also... Please help

public void registerUser()
{
String email = signupActivityEmail.getText().toString().trim();
String password = signupActivityPassword.getText().toString();
String fullName = signupActivityFullName.getText().toString().trim();
mFirebaseAuth.createUserWithEmailAndPassword(email, password).addOnCompleteListener(SignupActivity.this, new OnCompleteListener&lt;AuthResult&gt;()
{
public void onComplete(@NonNull Task&lt;AuthResult&gt; task)
{
if(task.isSuccessful())
{
User user = new User(fullName, email);
FirebaseDatabase.getInstance().getReference(&quot;Users: &quot;).child(Objects.requireNonNull(FirebaseAuth.getInstance()
.getCurrentUser()).getUid()).setValue(user).addOnCompleteListener(new OnCompleteListener&lt;Void&gt;()
{
@Override
public void onComplete(@NonNull Task&lt;Void&gt; task)
{
if (task.isSuccessful())
{
Toast.makeText(SignupActivity.this, &quot;Registration Successful&quot;, Toast.LENGTH_LONG).show();
startActivity(new Intent(SignupActivity.this,MainActivity.class));
}
else
{
Toast.makeText(SignupActivity.this, &quot;internal error&quot;, Toast.LENGTH_LONG).show();
}
}
});
}
else
{
Toast.makeText(SignupActivity.this, &quot;external error&quot;, Toast.LENGTH_SHORT).show();
}
}
});
}

Logcat

 2020-09-26 23:03:50.448 18941-18941/? E/Zygote: isWhitelistProcess - Process is Whitelisted
2020-09-26 23:03:50.449 18941-18941/? E/Zygote: accessInfo : 1
2020-09-26 23:03:50.455 18941-18941/? I/ctivity.classe: Late-enabling -Xcheck:jni
2020-09-26 23:03:52.213 18941-18941/activity.classes I/FirebaseApp: Device unlocked: initializing all Firebase APIs for app [DEFAULT]
2020-09-26 23:03:52.293 18941-18970/activity.classes I/DynamiteModule: Considering local module com.google.android.gms.measurement.dynamite:17 and remote module com.google.android.gms.measurement.dynamite:0
2020-09-26 23:03:52.293 18941-18970/activity.classes I/DynamiteModule: Selected local version of com.google.android.gms.measurement.dynamite
2020-09-26 23:03:52.314 18941-18970/activity.classes W/ctivity.classe: Unsupported class loader
2020-09-26 23:03:52.317 18941-18970/activity.classes W/ctivity.classe: Skipping duplicate class check due to unsupported classloader
2020-09-26 23:03:52.353 18941-18976/activity.classes W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
2020-09-26 23:03:52.367 18941-18941/activity.classes I/FirebaseInitProvider: FirebaseApp initialization successful
2020-09-26 23:03:52.404 18941-18979/activity.classes W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
2020-09-26 23:03:52.417 18941-18979/activity.classes I/FirebaseAuth: [FirebaseAuth:] Preparing to create service connection to gms implementation
2020-09-26 23:03:52.541 18941-18941/activity.classes W/ctivity.classe: Accessing hidden method Landroid/graphics/drawable/Drawable;-&gt;getOpticalInsets()Landroid/graphics/Insets; (light greylist, linking)
2020-09-26 23:03:52.541 18941-18941/activity.classes W/ctivity.classe: Accessing hidden field Landroid/graphics/Insets;-&gt;left:I (light greylist, linking)
2020-09-26 23:03:52.541 18941-18941/activity.classes W/ctivity.classe: Accessing hidden field Landroid/graphics/Insets;-&gt;right:I (light greylist, linking)
2020-09-26 23:03:52.541 18941-18941/activity.classes W/ctivity.classe: Accessing hidden field Landroid/graphics/Insets;-&gt;top:I (light greylist, linking)
2020-09-26 23:03:52.541 18941-18941/activity.classes W/ctivity.classe: Accessing hidden field Landroid/graphics/Insets;-&gt;bottom:I (light greylist, linking)
2020-09-26 23:03:52.570 18941-18980/activity.classes I/FA: App measurement initialized, version: 31049
2020-09-26 23:03:52.570 18941-18980/activity.classes I/FA: To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
2020-09-26 23:03:52.571 18941-18980/activity.classes I/FA: To enable faster debug mode event logging run:
adb shell setprop debug.firebase.analytics.app activity.classes
2020-09-26 23:03:52.571 18941-18980/activity.classes D/FA: Debug-level message logging enabled
2020-09-26 23:03:52.577 18941-18941/activity.classes I/MultiWindowDecorSupport: updateCaptionType &gt;&gt; DecorView@5b34881[], isFloating: false, isApplication: true, hasWindowDecorCaption: false, hasWindowControllerCallback: true
2020-09-26 23:03:52.578 18941-18941/activity.classes D/MultiWindowDecorSupport: setCaptionType = 0, DecorView = DecorView@5b34881[]
2020-09-26 23:03:52.631 18941-18941/activity.classes W/ctivity.classe: Accessing hidden method Landroid/view/View;-&gt;getAccessibilityDelegate()Landroid/view/View$AccessibilityDelegate; (light greylist, linking)
2020-09-26 23:03:52.652 18941-18941/activity.classes W/ctivity.classe: Accessing hidden method Landroid/view/View;-&gt;computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (light greylist, reflection)
2020-09-26 23:03:52.655 18941-18941/activity.classes W/ctivity.classe: Accessing hidden method Landroid/view/ViewGroup;-&gt;makeOptionalFitsSystemWindows()V (light greylist, reflection)
2020-09-26 23:03:52.688 18941-18941/activity.classes W/ctivity.classe: Accessing hidden method Landroid/graphics/FontFamily;-&gt;&lt;init&gt;()V (light greylist, reflection)
2020-09-26 23:03:52.688 18941-18941/activity.classes W/ctivity.classe: Accessing hidden method Landroid/graphics/FontFamily;-&gt;addFontFromAssetManager(Landroid/content/res/AssetManager;Ljava/lang/String;IZIII[Landroid/graphics/fonts/FontVariationAxis;)Z (light greylist, reflection)
2020-09-26 23:03:52.688 18941-18941/activity.classes W/ctivity.classe: Accessing hidden method Landroid/graphics/FontFamily;-&gt;addFontFromBuffer(Ljava/nio/ByteBuffer;I[Landroid/graphics/fonts/FontVariationAxis;II)Z (light greylist, reflection)
2020-09-26 23:03:52.688 18941-18941/activity.classes W/ctivity.classe: Accessing hidden method Landroid/graphics/FontFamily;-&gt;freeze()Z (light greylist, reflection)
2020-09-26 23:03:52.688 18941-18941/activity.classes W/ctivity.classe: Accessing hidden method Landroid/graphics/FontFamily;-&gt;abortCreation()V (light greylist, reflection)
2020-09-26 23:03:52.689 18941-18941/activity.classes W/ctivity.classe: Accessing hidden method Landroid/graphics/Typeface;-&gt;createFromFamiliesWithDefault([Landroid/graphics/FontFamily;Ljava/lang/String;II)Landroid/graphics/Typeface; (light greylist, reflection)
2020-09-26 23:03:52.903 18941-18941/activity.classes D/OpenGLRenderer: Skia GL Pipeline
2020-09-26 23:03:52.908 18941-18941/activity.classes D/EmergencyMode: [EmergencyManager] android createPackageContext successful
2020-09-26 23:03:52.928 18941-18941/activity.classes D/InputTransport: Input channel constructed: fd=67
2020-09-26 23:03:52.930 18941-18941/activity.classes D/ViewRootImpl@4263e22[SignupActivity]: setView = DecorView@5b34881[SignupActivity] TM=true MM=false
2020-09-26 23:03:52.950 18941-18980/activity.classes I/FA: Tag Manager is not found and thus will not be used
2020-09-26 23:03:53.057 18941-18941/activity.classes D/ViewRootImpl@4263e22[SignupActivity]: Relayout returned: old=[0,0][720,1280] new=[0,0][720,1280] result=0x7 surface={true 3592433664} changed=true
2020-09-26 23:03:53.066 18941-18985/activity.classes I/ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
2020-09-26 23:03:53.066 18941-18985/activity.classes I/ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
2020-09-26 23:03:53.066 18941-18985/activity.classes I/OpenGLRenderer: Initialized EGL, version 1.4
2020-09-26 23:03:53.067 18941-18985/activity.classes D/OpenGLRenderer: Swap behavior 2
2020-09-26 23:03:53.080 18941-18985/activity.classes D/mali_winsys: EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000,  [720x1280]-format:1
2020-09-26 23:03:53.080 18941-18985/activity.classes D/OpenGLRenderer: eglCreateWindowSurface = 0xe82ca9e0, 0xd6203008
2020-09-26 23:03:53.122 18941-18985/activity.classes D/vndksupport: Loading /vendor/lib/hw/android.hardware.graphics.mapper@2.0-impl.so from current namespace instead of sphal namespace.
2020-09-26 23:03:53.158 18941-18941/activity.classes D/ViewRootImpl@4263e22[SignupActivity]: MSG_RESIZED: frame=[0,0][720,1280] ci=[0,48][0,0] vi=[0,48][0,0] or=1
2020-09-26 23:03:53.159 18941-18941/activity.classes D/ViewRootImpl@4263e22[SignupActivity]: MSG_WINDOW_FOCUS_CHANGED 1 1
2020-09-26 23:03:53.160 18941-18941/activity.classes D/InputMethodManager: prepareNavigationBarInfo() DecorView@5b34881[SignupActivity]
2020-09-26 23:03:53.160 18941-18941/activity.classes D/InputMethodManager: getNavigationBarColor() -855310
2020-09-26 23:03:53.179 18941-18941/activity.classes D/InputMethodManager: prepareNavigationBarInfo() DecorView@5b34881[SignupActivity]
2020-09-26 23:03:53.179 18941-18941/activity.classes D/InputMethodManager: getNavigationBarColor() -855310
2020-09-26 23:03:53.179 18941-18941/activity.classes D/InputMethodManager: startInputInner - Id : 0
2020-09-26 23:03:53.180 18941-18941/activity.classes I/InputMethodManager: startInputInner - mService.startInputOrWindowGainedFocus
2020-09-26 23:03:53.187 18941-18953/activity.classes D/InputTransport: Input channel constructed: fd=77
2020-09-26 23:03:53.199 18941-18980/activity.classes D/FA: Connected to remote service
2020-09-26 23:03:53.199 18941-18941/activity.classes D/InputMethodManager: prepareNavigationBarInfo() DecorView@5b34881[SignupActivity]
2020-09-26 23:03:53.200 18941-18941/activity.classes D/InputMethodManager: getNavigationBarColor() -855310
2020-09-26 23:03:53.200 18941-18941/activity.classes D/InputMethodManager: startInputInner - Id : 0
2020-09-26 23:04:16.506 18941-18941/activity.classes D/ViewRootImpl@4263e22[SignupActivity]: ViewPostIme pointer 0
2020-09-26 23:04:16.582 18941-18941/activity.classes D/ViewRootImpl@4263e22[SignupActivity]: ViewPostIme pointer 1
2020-09-26 23:04:16.610 18941-18941/activity.classes D/InputMethodManager: prepareNavigationBarInfo() DecorView@5b34881[SignupActivity]
2020-09-26 23:04:16.610 18941-18941/activity.classes D/InputMethodManager: getNavigationBarColor() -855310
2020-09-26 23:04:16.611 18941-18941/activity.classes D/InputMethodManager: startInputInner - Id : 0
2020-09-26 23:04:16.619 18941-18941/activity.classes I/InputMethodManager: startInputInner - mService.startInputOrWindowGainedFocus
2020-09-26 23:04:16.622 18941-18941/activity.classes D/InputTransport: Input channel constructed: fd=81
2020-09-26 23:04:16.622 18941-18941/activity.classes D/InputTransport: Input channel destroyed: fd=77
2020-09-26 23:04:16.623 18941-18941/activity.classes D/InputMethodManager: SSI - flag : 0 Pid : 18941 view : activity.classes
2020-09-26 23:04:16.623 18941-18941/activity.classes D/InputMethodManager: prepareNavigationBarInfo() DecorView@5b34881[SignupActivity]
2020-09-26 23:04:16.623 18941-18941/activity.classes D/InputMethodManager: getNavigationBarColor() -855310
2020-09-26 23:04:16.629 18941-18941/activity.classes D/Editor: waiting for the right moment
2020-09-26 23:04:16.653 18941-18941/activity.classes I/AssistStructure: Flattened final assist data: 3180 bytes, containing 1 windows, 9 views
2020-09-26 23:04:16.791 18941-18941/activity.classes D/ViewRootImpl@4263e22[SignupActivity]: MSG_RESIZED: frame=[0,0][720,1280] ci=[0,48][0,0] vi=[0,48][0,618] or=1
2020-09-26 23:04:19.964 18941-18941/activity.classes D/ViewRootImpl@4263e22[SignupActivity]: ViewPostIme key 0
2020-09-26 23:04:19.967 18941-18941/activity.classes D/ViewRootImpl@4263e22[SignupActivity]: ViewPostIme key 1
2020-09-26 23:04:19.996 18941-18941/activity.classes D/InputMethodManager: prepareNavigationBarInfo() DecorView@5b34881[SignupActivity]
2020-09-26 23:04:19.996 18941-18941/activity.classes D/InputMethodManager: getNavigationBarColor() -855310
2020-09-26 23:04:19.997 18941-18941/activity.classes D/InputMethodManager: startInputInner - Id : 0
2020-09-26 23:04:20.005 18941-18941/activity.classes I/InputMethodManager: startInputInner - mService.startInputOrWindowGainedFocus
2020-09-26 23:04:20.009 18941-18941/activity.classes D/InputTransport: Input channel constructed: fd=77
2020-09-26 23:04:20.009 18941-18941/activity.classes D/InputTransport: Input channel destroyed: fd=81
2020-09-26 23:04:21.536 18941-18941/activity.classes D/ViewRootImpl@4263e22[SignupActivity]: ViewPostIme key 1
2020-09-26 23:04:22.598 18941-18941/activity.classes D/ViewRootImpl@4263e22[SignupActivity]: ViewPostIme key 0
2020-09-26 23:04:22.617 18941-18941/activity.classes D/ViewRootImpl@4263e22[SignupActivity]: ViewPostIme key 1
2020-09-26 23:04:23.404 18941-18941/activity.classes D/ViewRootImpl@4263e22[SignupActivity]: ViewPostIme key 1
2020-09-26 23:04:26.079 18941-18941/activity.classes D/ViewRootImpl@4263e22[SignupActivity]: ViewPostIme key 1
2020-09-26 23:04:28.411 18941-18941/activity.classes D/ViewRootImpl@4263e22[SignupActivity]: ViewPostIme key 1
2020-09-26 23:04:33.663 18941-18941/activity.classes D/ViewRootImpl@4263e22[SignupActivity]: ViewPostIme key 0
2020-09-26 23:04:33.664 18941-18941/activity.classes D/ViewRootImpl@4263e22[SignupActivity]: ViewPostIme key 1
2020-09-26 23:04:33.690 18941-18941/activity.classes D/InputMethodManager: prepareNavigationBarInfo() DecorView@5b34881[SignupActivity]
2020-09-26 23:04:33.691 18941-18941/activity.classes D/InputMethodManager: getNavigationBarColor() -855310
2020-09-26 23:04:33.691 18941-18941/activity.classes D/InputMethodManager: startInputInner - Id : 0
2020-09-26 23:04:33.700 18941-18941/activity.classes I/InputMethodManager: startInputInner - mService.startInputOrWindowGainedFocus
2020-09-26 23:04:33.704 18941-18941/activity.classes D/InputTransport: Input channel constructed: fd=81
2020-09-26 23:04:33.704 18941-18941/activity.classes D/InputTransport: Input channel destroyed: fd=77
2020-09-26 23:04:35.932 18941-18941/activity.classes D/ViewRootImpl@4263e22[SignupActivity]: ViewPostIme key 0
2020-09-26 23:04:35.933 18941-18941/activity.classes D/ViewRootImpl@4263e22[SignupActivity]: ViewPostIme key 1
2020-09-26 23:04:35.959 18941-18941/activity.classes D/InputMethodManager: prepareNavigationBarInfo() DecorView@5b34881[SignupActivity]
2020-09-26 23:04:35.959 18941-18941/activity.classes D/InputMethodManager: getNavigationBarColor() -855310
2020-09-26 23:04:35.959 18941-18941/activity.classes D/InputMethodManager: startInputInner - Id : 0
2020-09-26 23:04:35.967 18941-18941/activity.classes I/InputMethodManager: startInputInner - mService.startInputOrWindowGainedFocus
2020-09-26 23:04:35.970 18941-18941/activity.classes D/InputTransport: Input channel constructed: fd=77
2020-09-26 23:04:35.970 18941-18941/activity.classes D/InputTransport: Input channel destroyed: fd=81
2020-09-26 23:04:35.993 18941-18941/activity.classes I/AssistStructure: Flattened final assist data: 3428 bytes, containing 1 windows, 9 views
2020-09-26 23:04:39.588 18941-18941/activity.classes D/ViewRootImpl@4263e22[SignupActivity]: ViewPostIme key 0
2020-09-26 23:04:39.589 18941-18941/activity.classes D/ViewRootImpl@4263e22[SignupActivity]: ViewPostIme key 1
2020-09-26 23:04:39.592 18941-18941/activity.classes D/InputMethodManager: HSIFW - flag : 0 Pid : 18941
2020-09-26 23:04:39.637 18941-18941/activity.classes D/ViewRootImpl@4263e22[SignupActivity]: MSG_RESIZED: frame=[0,0][720,1280] ci=[0,48][0,0] vi=[0,48][0,0] or=1
2020-09-26 23:04:40.255 18941-18941/activity.classes D/ViewRootImpl@4263e22[SignupActivity]: ViewPostIme pointer 0
2020-09-26 23:04:40.339 18941-18941/activity.classes D/ViewRootImpl@4263e22[SignupActivity]: ViewPostIme pointer 1
2020-09-26 23:04:40.351 18941-18941/activity.classes I/BiChannelGoogleApi: [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzao@45ea4bb
2020-09-26 23:04:40.893 18941-18941/activity.classes D/InputTransport: Input channel constructed: fd=81
2020-09-26 23:04:40.895 18941-18941/activity.classes D/ViewRootImpl@8244c23[Toast]: setView = android.widget.LinearLayout{cb94520 V.E...... ......I. 0,0-0,0} TM=true MM=false
2020-09-26 23:04:40.920 18941-18941/activity.classes D/ViewRootImpl@8244c23[Toast]: Relayout returned: old=[0,48][720,1280] new=[228,1064][492,1152] result=0x7 surface={true 3592435712} changed=true
2020-09-26 23:04:40.923 18941-18985/activity.classes D/mali_winsys: EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000,  [264x88]-format:1
2020-09-26 23:04:40.923 18941-18985/activity.classes D/OpenGLRenderer: eglCreateWindowSurface = 0xd5e64de0, 0xd6203808
2020-09-26 23:04:40.927 18941-18941/activity.classes D/ViewRootImpl@8244c23[Toast]: MSG_RESIZED: frame=[228,1064][492,1152] ci=[0,0][0,0] vi=[0,0][0,0] or=1

答案1

得分: 1

每当Task失败时,将其异常记录下来以查明失败的原因。例如:

if (task.isSuccessful()) {
    Toast.makeText(SignupActivity.this, "注册成功", Toast.LENGTH_LONG).show();
    startActivity(new Intent(SignupActivity.this, MainActivity.class));
} else {
    Log.e("任务失败", "任务失败", e);
    Toast.makeText(SignupActivity.this, "内部错误", Toast.LENGTH_LONG).show();
}

然后在你的logcat输出中找到问题的原因,并解决它。

英文:

Whenever a Task fails, log its exception to find out the cause of the failure. For example:

if (task.isSuccessful())
{
Toast.makeText(SignupActivity.this, &quot;Registration Successful&quot;, Toast.LENGTH_LONG).show();
startActivity(new Intent(SignupActivity.this,MainActivity.class));
}
else
{
Log.e(&quot;Task failed&quot;, &quot;Task failed&quot;, e);
Toast.makeText(SignupActivity.this, &quot;internal error&quot;, Toast.LENGTH_LONG).show();
}

Then find the cause of the problem in your logcat output, and address it.

huangapple
  • 本文由 发表于 2020年9月26日 19:35:52
  • 转载请务必保留本文链接:https://go.coder-hub.com/64077202.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定