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

Flutter Branch SDK doesn't auto reinitialise when we use the GoogleSignIn method for Signing IN only in Android #416

Open
vamsi-branch opened this issue Feb 11, 2025 · 9 comments
Labels
bug Something isn't working

Comments

@vamsi-branch
Copy link

Keep the template and provide all requested information:

Describe the bug
Flutter Branch SDK doesn't auto reinitialise when we use the GoogleSignIn method for Signing IN.
As Google SignIn creates new activity, when we are finished with it, the MainActivity of the App resumes, but the branch sdk doesn't resume in this particular flow.

To Reproduce
Steps to reproduce the behavior:

  1. Go to drive link and download the setup
  2. Would be required to clean cache and re-run flutter
  3. Now After the app is installed, click on the LoginButton which will open the login flow and after it ends, we will be redirected to mainactivity
  4. When we try to track any content we find that the branch sdk didn't re-init.

Expected behavior
The expected behaviour is that after the siginin screen is completed, the main activity is resumed with the branch sdk

Logs

2025-02-07 11:52:38.392 31559-31559 FlutterBranchSDK com.mosl.research360app D triggered onActivityPaused: com.mosl.research360app.MainActivity
2025-02-07 11:52:38.454 31559-31559 BranchSDK com.mosl.research360app V onActivityCreated, activity = com.google.android.gms.auth.api.signin.internal.SignInHubActivity@8b3bfec
2025-02-07 11:52:38.454 31559-31559 FlutterBranchSDK com.mosl.research360app D triggered onActivityCreated: com.google.android.gms.auth.api.signin.internal.SignInHubActivity
2025-02-07 11:52:38.515 31559-31559 BranchSDK com.mosl.research360app V onActivityStarted, activity = com.google.android.gms.auth.api.signin.internal.SignInHubActivity@8b3bfec
2025-02-07 11:52:38.515 31559-31559 FlutterBranchSDK com.mosl.research360app D triggered onActivityStarted: com.google.android.gms.auth.api.signin.internal.SignInHubActivity
2025-02-07 11:52:38.521 31559-31559 BranchSDK com.mosl.research360app V onActivityResumed, activity = com.google.android.gms.auth.api.signin.internal.SignInHubActivity@8b3bfec
2025-02-07 11:52:38.522 31559-31559 BranchSDK com.mosl.research360app V onIntentReady com.google.android.gms.auth.api.signin.internal.SignInHubActivity@8b3bfec removing INTENT_PENDING_WAIT_LOCK
2025-02-07 11:52:38.522 31559-31559 BranchSDK com.mosl.research360app V processNextQueueItem onIntentReady
2025-02-07 11:52:38.522 31559-31559 BranchSDK com.mosl.research360app V Queue is:
2025-02-07 11:52:38.522 31559-31559 FlutterBranchSDK com.mosl.research360app D triggered onActivityResumed: com.google.android.gms.auth.api.signin.internal.SignInHubActivity
2025-02-07 11:52:38.548 31559-31559 BranchSDK com.mosl.research360app V onActivityPaused, activity = com.google.android.gms.auth.api.signin.internal.SignInHubActivity@8b3bfec
2025-02-07 11:52:38.548 31559-31559 FlutterBranchSDK com.mosl.research360app D triggered onActivityPaused: com.google.android.gms.auth.api.signin.internal.SignInHubActivity
2025-02-07 11:52:44.834 31559-31559 BranchSDK com.mosl.research360app V onActivityResumed, activity = com.google.android.gms.auth.api.signin.internal.SignInHubActivity@8b3bfec
2025-02-07 11:52:44.834 31559-31559 BranchSDK com.mosl.research360app V onIntentReady com.google.android.gms.auth.api.signin.internal.SignInHubActivity@8b3bfec removing INTENT_PENDING_WAIT_LOCK
2025-02-07 11:52:44.834 31559-31559 BranchSDK com.mosl.research360app V processNextQueueItem onIntentReady
2025-02-07 11:52:44.834 31559-31559 BranchSDK com.mosl.research360app V Queue is:
2025-02-07 11:52:44.834 31559-31559 FlutterBranchSDK com.mosl.research360app D triggered onActivityResumed: com.google.android.gms.auth.api.signin.internal.SignInHubActivity
2025-02-07 11:52:44.850 31559-31559 BranchSDK com.mosl.research360app V onActivityPaused, activity = com.google.android.gms.auth.api.signin.internal.SignInHubActivity@8b3bfec
2025-02-07 11:52:44.850 31559-31559 FlutterBranchSDK com.mosl.research360app D triggered onActivityPaused: com.google.android.gms.auth.api.signin.internal.SignInHubActivity
2025-02-07 11:52:44.888 31559-31559 BranchSDK com.mosl.research360app V onActivityResumed, activity = com.mosl.research360app.MainActivity@62c0df
2025-02-07 11:52:44.888 31559-31559 BranchSDK com.mosl.research360app V onIntentReady com.mosl.research360app.MainActivity@62c0df removing INTENT_PENDING_WAIT_LOCK
2025-02-07 11:52:44.888 31559-31559 BranchSDK com.mosl.research360app V processNextQueueItem onIntentReady
2025-02-07 11:52:44.888 31559-31559 BranchSDK com.mosl.research360app V Queue is:
2025-02-07 11:52:44.888 31559-31559 FlutterBranchSDK com.mosl.research360app D triggered onActivityResumed: com.mosl.research360app.MainActivity
2025-02-07 11:52:44.933 31559-31559 BranchSDK com.mosl.research360app V onActivityStopped, activity = com.google.android.gms.auth.api.signin.internal.SignInHubActivity@8b3bfec
2025-02-07 11:52:44.933 31559-31559 FlutterBranchSDK com.mosl.research360app D triggered onActivityStopped: com.google.android.gms.auth.api.signin.internal.SignInHubActivity
2025-02-07 11:52:44.945 31559-31559 BranchSDK com.mosl.research360app V onActivityDestroyed, activity = com.google.android.gms.auth.api.signin.internal.SignInHubActivity@8b3bfec
2025-02-07 11:52:44.946 31559-31559 FlutterBranchSDK com.mosl.research360app D triggered onActivityDestroyed: com.google.android.gms.auth.api.signin.internal.SignInHubActivity
2025-02-07 11:52:48.531 31559-31559 FlutterBranchSDK com.mosl.research360app D triggered trackContent
2025-02-07 11:52:48.533 31559-31559 FlutterBranchSDK com.mosl.research360app D triggered trackContent
2025-02-07 11:52:48.534 31559-31559 FlutterBranchSDK com.mosl.research360app D triggered trackContentWithoutBuo
2025-02-07 11:52:48.535 31559-31559 FlutterBranchSDK com.mosl.research360app D triggered trackContentWithoutBuo
2025-02-07 11:52:48.538 31559-31559 BranchSDK com.mosl.research360app V setPostUserAgent main
2025-02-07 11:52:48.538 31559-31559 BranchSDK com.mosl.research360app V userAgent was cached: Mozilla/5.0 (Linux; Android 12; SM-M215F Build/SP1A.210812.016; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/132.0.6834.163 Mobile Safari/537.36
2025-02-07 11:52:48.538 31559-31559 BranchSDK com.mosl.research360app V processNextQueueItem setPostUserAgent
2025-02-07 11:52:48.538 31559-31559 BranchSDK com.mosl.research360app V Queue is:
2025-02-07 11:52:48.546 31559-31559 BranchSDK com.mosl.research360app V Preparing V2 event, user agent is Mozilla/5.0 (Linux; Android 12; SM-M215F Build/SP1A.210812.016; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/132.0.6834.163 Mobile Safari/537.36
2025-02-07 11:52:48.546 31559-31559 BranchSDK com.mosl.research360app D handleNewRequest io.branch.referral.util.BranchEvent$1@cf709d
2025-02-07 11:52:48.546 31559-31559 BranchSDK com.mosl.research360app D handleNewRequest io.branch.referral.util.BranchEvent$1@cf709d needs a session
2025-02-07 11:52:48.548 31559-31559 BranchSDK com.mosl.research360app V processNextQueueItem handleNewRequest
2025-02-07 11:52:48.548 31559-31559 BranchSDK com.mosl.research360app V Queue is: io.branch.referral.util.BranchEvent$1@cf709d with locks [SDK_INIT_WAIT_LOCK]

Mobile (Please complete the following information. remove session if not Mobile):

  • FlutterSDK: version: 3.27.1

  • flutter_branch_sdk version: 8.2.0

  • OS: All Android version

  • Additional context
    This is the life cycle flow that is actually happening
    onActivityPaused → MainActivity
    onActivityCreated → SignInHubActivity
    onActivityStarted → SignInHubActivity
    onActivityResumed → SignInHubActivity
    onActivityPaused → SignInHubActivity
    onActivityResumed → SignInHubActivity
    onActivityPaused → SignInHubActivity
    onActivityResumed → MainActivity

But on the final onActivityResumed when MainActivity is resumed the branch sdk is not being called which should be

The drive link shared contains the below

  1. Video recording
  2. Sample Project
  3. Complete logs
@vamsi-branch vamsi-branch added the bug Something isn't working label Feb 11, 2025
@RodrigoSMarques
Copy link
Owner

I will evaluate.

@vamsi-branch
Copy link
Author

HI @RodrigoSMarques
Were you able to look into this issue ?
Thanks

@RodrigoSMarques
Copy link
Owner

HI @RodrigoSMarques
Were you able to look into this issue ?
Thanks

Not yet. I'll look into it in the next few days.

@RodrigoSMarques
Copy link
Owner

@vamsi-branch

I tried to run your project on the latest version of Flutter and it didn't work.

What version are you running it on?

@vamsi-branch
Copy link
Author

@RodrigoSMarques My flutter version is Flutter 3.27.1
JDK is 17

What issue did you face when trying to run the project?

@RodrigoSMarques
Copy link
Owner

@RodrigoSMarques My flutter version is Flutter 3.27.1 JDK is 17

What issue did you face when trying to run the project?

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not open cp_settings generic class cache for settings file '/Users/rodrigo/Temp/flutter_projects/r360_mobileapp_new/android/settings.gradle' (/Users/rodrigo/.gradle/caches/7.5/scripts/810u8hvg7if80rbclyyr245xj).

BUG! exception in phase 'semantic analysis' in source unit 'BuildScript' Unsupported class file major version 65

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.

BUILD FAILED in 457ms
Running Gradle task 'assembleRelease'... 1.549ms

┌─ Flutter Fix ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ [!] Your project's Gradle version is incompatible with the Java version that Flutter is using for Gradle. │
│ │
│ If you recently upgraded Android Studio, consult the migration guide at https://flutter.dev/to/java-gradle-incompatibility. │
│ │
│ Otherwise, to fix this issue, first, check the Java version used by Flutter by running flutter doctor --verbose. │
│ │
│ Then, update the Gradle version specified in /Users/rodrigo/Temp/flutter_projects/r360_mobileapp_new/android/gradle/wrapper/gradle-wrapper.properties to be compatible with that Java version. See │
│ the link below for more information on compatible Java/Gradle versions: │
https://docs.gradle.org/current/userguide/compatibility.html#java
│ │
│ │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

@RodrigoSMarques
Copy link
Owner

[✓] Flutter (Channel stable, 3.29.0, on macOS 15.3.1 24D70 darwin-arm64, locale pt-BR) [335ms]
• Flutter version 3.29.0 on channel stable at /Users/rodrigo/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 35c388afb5 (2 weeks ago), 2025-02-10 12:48:41 -0800
• Engine revision f73bfc4522
• Dart version 3.7.0
• DevTools version 2.42.2

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [1.478ms]
• Android SDK at /Users/rodrigo/Library/Android/sdk
• Platform android-35, build-tools 34.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
This is the JDK bundled with the latest Android Studio installation on this machine.
To manually set the JDK path, use: flutter config --jdk-dir="path/to/jdk".
• Java version OpenJDK Runtime Environment (build 21.0.5+-12932927-b750.29)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.2) [810ms]
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 16C5032a
• CocoaPods version 1.16.2

[✓] Chrome - develop for the web [9ms]
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.2) [9ms]
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 21.0.5+-12932927-b750.29)

[✓] VS Code (version 1.97.0) [8ms]
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension can be installed from:
🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

@vamsi-branch
Copy link
Author

@RodrigoSMarques Can you try it with the upgraded gradle properties
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
Change from 7.5 to above and it is present inside the gradle folder -> gradle-wrapper.properties

Image

It looks like due to JDK 21 it is not compiling

@RodrigoSMarques
Copy link
Owner

RodrigoSMarques commented Feb 28, 2025

@RodrigoSMarques Can you try it with the upgraded gradle properties distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip Change from 7.5 to above and it is present inside the gradle folder -> gradle-wrapper.properties

Image It looks like due to JDK 21 it is not compiling

@vamsi-branch

Unfortunately I can't run the project
I downgraded Flutter to 3.27.4, updated AGP
Still get the error:

Launching lib/main.dart on sdk gphone64 arm64 in debug mode...

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* Where:
Build file '/Users/rodrigo/Temp/flutter_projects/r360_mobileapp_new/android/build.gradle' line: 14

* What went wrong:
A problem occurred evaluating root project 'android'.
> A problem occurred configuring project ':app'.
   > Could not create task ':app:copyFlutterAssetsDebug'.
      > Could not create task ':app:mergeDebugAssets'.
         > Cannot use @TaskAction annotation on method IncrementalTask.taskAction$gradle_core() because interface org.gradle.api.tasks.incremental.IncrementalTaskInputs is not a valid parameter to an action method.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
==============================================================================

2: Task failed with an exception.
-----------
* Where:
Build file '/Users/rodrigo/Temp/flutter_projects/r360_mobileapp_new/android/build.gradle' line: 14

* What went wrong:
A problem occurred evaluating root project 'android'.
> A problem occurred configuring project ':app'.
   > Could not create task ':app:copyFlutterAssetsDebug'.
      > Could not create task ':app:mergeDebugAssets'.
         > Cannot use @TaskAction annotation on method IncrementalTask.taskAction$gradle_core() because interface org.gradle.api.tasks.incremental.IncrementalTaskInputs is not a valid parameter to an action method.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
==============================================================================

BUILD FAILED in 3s
Running Gradle task 'assembleDebug'...                              4,0s
Error: Gradle task assembleDebug failed with exit code 1

I am creating a project adding GoogleSign to analyze

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

2 participants