Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Crash] Fatal Exception: java.lang.NullPointerException Attempt to invoke virtual method 'boolean androidx.core.view.m1.o(int)' on a null object reference #2234

Open
winnievips opened this issue Nov 6, 2024 · 0 comments

Comments

@winnievips
Copy link

winnievips commented Nov 6, 2024

Bug Report

Plugin(s)

@capacitor/keyboard: 6.1.0

Capacitor Version

💊   Capacitor Doctor  💊 

Latest Dependencies:

  @capacitor/cli: 6.1.2
  @capacitor/core: 6.1.2
  @capacitor/android: 6.1.2
  @capacitor/ios: 6.1.2

Installed Dependencies:

  @capacitor/cli: 6.1.0
  @capacitor/core: 6.1.0
  @capacitor/ios: 6.1.0
  @capacitor/android: 6.1.0

[success] iOS looking great! 👌
[success] Android looking great! 👌

Platform(s)

Android Devices
47% Honor
21% Vivo
11% Oppo
5% Oppo
16% Other

Android SDK
84% Android 14
11% Android 13
5% Android 10

Current Behavior

Getting this crash error in firebase.

Fatal Exception: java.lang.NullPointerException
Attempt to invoke virtual method 'boolean androidx.core.view.m1.o(int)' on a null object reference

The log as below

com.capacitorjs.plugins.keyboard.Keyboard$1.onEnd (Keyboard.java:88)
androidx.core.view.WindowInsetsAnimationCompat$Impl30$ProxyCallback.onEnd (WindowInsetsAnimationCompat.java:1079)
android.view.View.dispatchWindowInsetsAnimationEnd (View.java:12517)
android.view.ViewGroup.dispatchWindowInsetsAnimationEnd (ViewGroup.java:7837)
android.view.ViewRootInsetsControllerHost.dispatchWindowInsetsAnimationEnd (ViewRootInsetsControllerHost.java:125)
android.view.InsetsController.dispatchAnimationEnd (InsetsController.java:2124)
android.view.InsetsController.cancelAnimation (InsetsController.java:1873)
android.view.InsetsController.cancelExistingControllers (InsetsController.java:1767)
android.view.InsetsController.cancelExistingAnimations (InsetsController.java:2062)
android.view.ViewRootImpl.dispatchDetachedFromWindow (ViewRootImpl.java:7534)
android.view.ViewRootImpl.doDie (ViewRootImpl.java:11368)
android.view.ViewRootImpl.die (ViewRootImpl.java:11327)
android.view.WindowManagerGlobal.removeViewLocked (WindowManagerGlobal.java:620)
android.view.WindowManagerGlobal.removeView (WindowManagerGlobal.java:547)
android.view.WindowManagerImpl.removeViewImmediate (WindowManagerImpl.java:251)
android.app.ActivityThread.handleDestroyActivity (ActivityThread.java:6688)
android.app.servertransaction.DestroyActivityItem.execute (DestroyActivityItem.java:47)
android.app.servertransaction.ActivityTransactionItem.execute (ActivityTransactionItem.java:45)
android.app.servertransaction.TransactionExecutor.executeLifecycleState (TransactionExecutor.java:194)
android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:106)
android.app.ActivityThread$H.handleMessage (ActivityThread.java:3067)
android.os.Handler.dispatchMessage (Handler.java:117)
android.os.Looper.loopOnce (Looper.java:210)
android.os.Looper.loop (Looper.java:302)
android.app.ActivityThread.main (ActivityThread.java:9652)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:601)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1062)

Code Reproduction

import { Component, Injector, OnDestroy, OnInit } from '@angular/core';
import { Keyboard } from '@capacitor/keyboard';
import { Platform } from '@ionic/angular';

@Component({
  selector: 'checkout',
  templateUrl: './checkout.page.html',
  styleUrls: ['./checkout.page.scss'],
  animations: [],
})

export class CheckoutPage implements OnInit, OnDestroy {
  isApp: boolean;
  isKeyboardHidden: boolean = true;
  
  _platform: Platform;

  constructor(private _injector: Injector) {
    this._platform = this._injector.get<Platform>(Platform);
  }

  ngOnInit() {
    this.isApp = this._platform.is('capacitor');

    //to re-render the UI after keyboard close
    if (this.isApp) {
      Keyboard.addListener('keyboardWillShow', () => {
        this.isKeyboardHidden = false;
      });

      Keyboard.addListener('keyboardWillHide', () => {
        this.isKeyboardHidden = true;
      });
    }
  }

  ngOnDestroy() {
    if (this.isApp) {
      Keyboard.removeAllListeners();
    }
  }
}

Other Technical Details

Not all the android will have issue. but some of the devices.

@ionitron-bot ionitron-bot bot added the triage label Nov 6, 2024
@ionitron-bot ionitron-bot bot removed the triage label Nov 6, 2024
winnievips added a commit to winnievips/capacitor-plugins that referenced this issue Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants