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

int android.content.Intent.getFlags() #255

Closed
HarshNT opened this issue Nov 6, 2023 · 8 comments
Closed

int android.content.Intent.getFlags() #255

HarshNT opened this issue Nov 6, 2023 · 8 comments
Labels
bug Something isn't working

Comments

@HarshNT
Copy link

HarshNT commented Nov 6, 2023

Error Logs
E/MethodChannel#flutter_branch_sdk/message( 8335): Failed to handle method call
E/MethodChannel#flutter_branch_sdk/message( 8335): java.lang.NullPointerException: Attempt to invoke virtual method 'int android.content.Intent.getFlags()' on a null object reference
E/MethodChannel#flutter_branch_sdk/message( 8335): at android.app.ContextImpl.startActivity(ContextImpl.java:1122)
E/MethodChannel#flutter_branch_sdk/message( 8335): at android.app.ContextImpl.startActivity(ContextImpl.java:1103)
E/MethodChannel#flutter_branch_sdk/message( 8335): at android.content.ContextWrapper.startActivity(ContextWrapper.java:436)
E/MethodChannel#flutter_branch_sdk/message( 8335): at br.com.rsmarques.flutter_branch_sdk.FlutterBranchSdkPlugin.setupBranch(FlutterBranchSdkPlugin.java:447)
E/MethodChannel#flutter_branch_sdk/message( 8335): at br.com.rsmarques.flutter_branch_sdk.FlutterBranchSdkPlugin.onMethodCall(FlutterBranchSdkPlugin.java:252)
E/MethodChannel#flutter_branch_sdk/message( 8335): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:258)
E/MethodChannel#flutter_branch_sdk/message( 8335): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
E/MethodChannel#flutter_branch_sdk/message( 8335): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:322)
E/MethodChannel#flutter_branch_sdk/message( 8335): at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/MethodChannel#flutter_branch_sdk/message( 8335): at android.os.Handler.handleCallback(Handler.java:958)
E/MethodChannel#flutter_branch_sdk/message( 8335): at android.os.Handler.dispatchMessage(Handler.java:99)
E/MethodChannel#flutter_branch_sdk/message( 8335): at android.os.Looper.loopOnce(Looper.java:205)
E/MethodChannel#flutter_branch_sdk/message( 8335): at android.os.Looper.loop(Looper.java:294)
E/MethodChannel#flutter_branch_sdk/message( 8335): at android.app.ActivityThread.main(ActivityThread.java:8177)
E/MethodChannel#flutter_branch_sdk/message( 8335): at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#flutter_branch_sdk/message( 8335): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
E/MethodChannel#flutter_branch_sdk/message( 8335): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)

flutter_branch_sdk: ^7.0.0

Android 13

Error occure when i use this await FlutterBranchSdk.init(
useTestKey: false, enableLogging: false, disableTracking: false); in main.dart.

@HarshNT HarshNT added the bug Something isn't working label Nov 6, 2023
@moo-kesh
Copy link

moo-kesh commented Nov 6, 2023

Facing the same issue after updating the plugin to v7.0.0

@moo-kesh
Copy link

moo-kesh commented Nov 6, 2023

@RodrigoSMarques
The example code is working fine. But the issue is with the projects which use Kotlin instead of Java. after comparing the example code with my project, I found that if we use Kotlin and extend MainActivity with FlutterFragmentActivity then Branch SDK crashes and fails to initialize. I have reproduced this issue by modifying the example code and using Kotlin instead of Java. Please take a look at the screenshot I've attached for more details. It may help you to figure it out.
Screenshot 2023-11-07 at 1 26 28 AM

@RodrigoSMarques
Copy link
Owner

The problem may be related to using FlutterFragmentActivity.

I'll investigate.

@HarshNT
Copy link
Author

HarshNT commented Nov 7, 2023

@mueksh-b thank you for looking deep

@RodrigoSMarques
Copy link
Owner

Hi @HarshNT and @mueksh-b

The cause of the problem is the use of FlutterFragmentActivity.

It has no relation to the language (Java or Kotlin).

I found the solution and I'm doing final tests. The plugin will work with FlutterActivity or FlutterFragmentActivity.

I will release a new version in the next few days.

@ahkela21
Copy link

ahkela21 commented Nov 8, 2023

facing the same issue, waiting for fix thanks

RodrigoSMarques added a commit that referenced this issue Nov 10, 2023
Fix issue #255 - Attempt to invoke virtual method 'int android.content.Intent.getFlags()' on a null object reference
RodrigoSMarques added a commit that referenced this issue Nov 10, 2023
This reverts commit 39e9915.
RodrigoSMarques added a commit that referenced this issue Nov 10, 2023
…nt.Intent.getFlags()' on a null object reference` when using FlutterFragmentActivity

 Fix issue #255: `Attempt to invoke virtual method 'int android.content.Intent.getFlags()' on a null object reference` when using FlutterFragmentActivity
@RodrigoSMarques
Copy link
Owner

Resolved in version 7.0.1

@HarshNT
Copy link
Author

HarshNT commented Nov 16, 2023

@RodrigoSMarques Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants