DEV Community

Sathish Gnanavel
Sathish Gnanavel

Posted on

I need to fix my deeplink issue

Hi everyone,

I have an existing Flutter project where deep linking was working perfectly before. Recently, I upgraded my Flutter SDK, Android Studio, Android SDK, Gradle/AGP, etc. The project code and deep-link implementation were not intentionally changed.

After the upgrade, I’m facing two issues:

Debug build:
When the app is running in the background and I open a deep link from WhatsApp/Google Chat, the app sometimes crashes or gets stuck on a black screen. I’m seeing logs related to SurfaceView, performTraversals, predraw, and WIN DEATH.

Release build:
The app opens from the deep link, but it appears to take over the Android task/intent stack. After opening the link from WhatsApp or Google Chat, I cannot reopen the originating app normally until I close my Flutter application.

I have already verified that Digital Asset Links / assetlinks.json is not the issue. The same deep-link implementation worked correctly before the environment upgrades.

I suspect this may be related to Android activity/task configuration, such as launchMode, taskAffinity, intent flags, MainActivity, startup theme/window configuration, or changes in Flutter/AGP/Android behavior.

Has anyone experienced this after upgrading Flutter/Android tooling? What configuration should I check or change to fix both the debug black-screen/crash and the release task-stack behavior?

Top comments (1)

Collapse
 
devshakib profile image
K M Shahriar Hossain

Two things changed underneath you that fit "worked before the upgrade":

  1. Flutter 3.27 turned its own deep-link handling on by default. If you also use app_links or uni_links, both now receive the link and both navigate. Set flutter_deeplinking_enabled to false in the manifest's <meta-data> if your package is meant to own it.
  2. The release symptom sounds like your activity is launching into WhatsApp's task. When another app fires a VIEW intent without FLAG_ACTIVITY_NEW_TASK, Android puts a standard or singleTop activity on top of the caller's task. Switching back to WhatsApp then shows that task, with your app on top of it: "can't reopen the originating app until I close mine". The Flutter template uses singleTop; singleTask keeps MainActivity in your own task and delivers later links through onNewIntent.

Before changing anything, confirm it: open a link from WhatsApp, run adb shell dumpsys activity activities, and look at which task your MainActivity sits under. Either change could also explain the debug black screen, so re-test that after each one.