question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Attach to running iOS application already running Xcode debugger

See original GitHub issue

Is there a way to attach Android Studio/ IntelliJ to the running iOS application?

I have tried running the iOS application through Android Studio, and then trying to Xcode > Debug > Attach to process > Runner, and I got the error: Screenshot 2021-08-25 at 07 36 39

error: attach by pid '425' failed -- tried to attach to process already being debugged

This would be great as it would allow debugging the iOS and dart code simultaneously, like we can do for Android Applications (by attaching to the Android process in Android Studio).

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
jmagmancommented, Aug 25, 2021

flutter run (same from the IDE) launches the app with lldb and stays connected. You can’t attach another lldb session through Xcode (that I’m aware of).
I would start the app from Xcode, then flutter attach as @stevemessick suggested.
If you need to launch the app through flutter instead of Xcode it’s more complicated–you would need to flutter run, detach (“d”), attach from Xcode, then flutter attach again.

2reactions
stevemessickcommented, Aug 25, 2021

Maybe @jmagman would have an idea about Xcode.

You might be able to launch your app from the command line, then try to attach both the Flutter debugger and Xcode debugger. I don’t know if that would work, but it may depend on the order of attachment. The Android Studio menu item is Run > Flutter Attach; it is also on the tool bar. Fair warning: Flutter Attach was designed to work for add-to-app projects; some people have reported success using it for regular apps, though. You might need to use additional arguments like flutter run --start-paused --machine. Some experimentation would be required. flutter help run lists all the arguments. The --start-paused arg is mostly used to ensure breakpoints are initialized before the app starts running. If you don’t need to debug initialization then you may be able to omit it. (It has been a while since I looked at the debugger code.)

Read more comments on GitHub >

github_iconTop Results From Across the Web

xcode - How to attach debugger to iOS app after launch?
Attach your device connected your Mac; Debug > Attach to Process by PID or Name; In the dialog sheet, enter the name of...
Read more >
Connecting Xcode To A Running Process - Use Your Loaf
Build and run your App to install it on the simulator or device of your choosing. · Stop the Xcode debug session. ·...
Read more >
Not able to attach Xcode debugger … | Apple Developer Forums
I would like to be able to start debugger using process name and launch the extension and be able to debug from first...
Read more >
Advanced Xcode debugging trick - Medium
When your app is installed either on a device/simulator but not running. · In the Xcode Menu, select Debug -> Attach to Process...
Read more >
Exploring Xcode's Debugging Tools - Cocoacasts
When you run an application in Xcode, the debugger is automatically started and attached to the process of the application. Click the Run...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found