Home > Software design >  Flutter VS Code attaching to app after app has been terminated to debug deeplinks
Flutter VS Code attaching to app after app has been terminated to debug deeplinks

Time:12-30

Right, so this is proving very difficult for me to debug. On Android a flutterfire deeplink is opening the app but there is no URL data in the link. iOS is fine.

But to debug this is very difficult. I can run the app on the emulator from vscode but to debug from a terminated state i need to swipe the app up but of course as soon as i do this i loose the debug connection.

Is it possible to reattach the debugger to the android app after termination using VSCode?

Are there any command line arguments that would pass the deeplink on the initial run in the same way that it would get it from a terminated state? I tried -d but that doesn't work at all.

I've hunted high and low for examples but come up with nothing so any pointers would be hugely appreciated.

thanks Paul

CodePudding user response:

Run the app in release mode so you can also run it when it is in closed state. use this command: flutter run --release

CodePudding user response:

If I understand your question correctly, you just need some command to start app with deeplink.

If you are using Android for testing you can use adb shell command to launch the deep-link in your app.

adb shell am start -d your-deep-link

So if you deeplink is "app://profile" then you can use

adb shell am start -d app://profile

For iOS you can try this command:

xcrun simctl openurl booted app://profile

Additionally you can try to open the same url in browser. This sometime opens up the page if the browser's web url area don't work as search bar. Like if you type the url in chrome it will open google instead of opening the url. But if your deeplink starts with http or https this might also work using browser.

  • Related