android studio open debug mode when app is running - debugging

How can open debug mode when application is running on android studio.,
My application is appearing on -Android Device Monitor- Devices tab . When i clicked application line on this screen ,debug icon is not active
How can i pass to debug mode after running my application?

In Android Studio (I'm currently using I/O Preview 0.2.10) simply click on the icon in the toolbar that looks like a phone with a bug over it - the hover text says: Attach debugger to Android process. It's the third icon along:
A list will then appear showing your processes that you can debug. Choose one and select OK - your application is now being debugged!
Note: Make sure your app is debuggable, as shown here.

Main Menu Toolbar -> Attach Debugger to Android Process
//or
Run -> Attach Debugger to Android Process
Icon looks like
One more interesting feature is Attach Debugger when app is starting(using Run or open/reopen on device)
Developer options -> Select debug app
Developer options -> Wait for debugger

Related

How to close a simulator window without closing all of them?

I'm using the iOS simulator on a Mac connected to Visual Studio for debugging a Xamarin app. I launched it for an iPhone and then for an iPad. Then I wanted to close the iPhone window only but couldn’t find a way.
Use the File / Close Window (CMD-W) to close the current window (i.e. each Simulator is running in its own window).
As well as File/Close as shown by #SushiHangover, with Bezels turned off (Menu:Window/Show Device Bezels) the red 'Close' button on each window also closes just that simulator:
(You can use Hardware/Device from the menu to check which simulators are currently active.)

Xamarin iOS opens and immediately closes

My Xamarin iOS app will build successfully, however, during launch it will flash the launch screen and immediately return to my phones home screen exiting my app without an error.
Upon reviewing Xamarin Studio, the status appears at top:
Waiting for debugger to connect to Phone on port 10000 view USB...
and simply hangs.
How can this be alleviated?
just right click on your project and set it as a startup project. I solved the same problem and it launches the app properly without closing it.

Find crash logs on iOS 8 device

Crash logs used to be accessible through the Settings app. I can't find that in iOS 8. Where did that go?
It's not gone now is it.
I found it. It moved, it's no longer inside General/Diagnostics... It's in Privacy/Diagnostics.
Start by opening up the Settings app.
Navigate to Settings - Privacy - Diagnostics & usage - Diagnostics &
usage Data
Tap on the crash and you will see a text field with a crash log. Long
press to Select All and then Copy the crash text.
Paste it into something you can get off of your device (for example,
an email to yourself).
If you have iOS 10.3 or later, go to Settings > Privacy, scroll down and tap Analytics. Then tap Share iPhone & Watch Analytics.
If you have iOS 10 to iOS 10.2, go to Settings > Privacy > Diagnostics & Usage and select Automatically Send or Don't Send.
Getting Crash Logs Directly From a Device Without Xcode
Your users can retrieve crash reports from their device and send them to you via email by following these instructions.
(It is not possible to get device console logs directly from a device)
1) Open Settings app
2) Go to Privacy, then Diagnostics & Usage
3) Select Diagnostics & Usage Data
4) Locate the log for the crashed app. The logs will be named in the format:
5) Select the desired log. Then, using the text selection UI select the entire text of the log. Once the text is selected, tap Copy
6) Paste the copied text to Mail and send to an email address as desired
Getting Crash Logs and Console Output From a Device Using Xcode
Even though you won't be able to run the app in Xcode's debugger, Xcode can still give you all the information you need to debug the problem.
Using Xcode 6
1) Plug in the device and open Xcode
2) Choose Window -> Devices from the menu bar
3) Under the DEVICES section in the left column, choose the device
4) To see the device console, click the up-triangle at the bottom left of the right hand panel
5) Click the down arrow on the bottom right to save the console as a file
6) To see crash logs, select the View Device Logs button under the Device Information section on the right hand panel
7) Find your app in the Process column and select the Crash log to see the contents.
8) To save a crash log, right click the entry on the left column and choose "Export Log"
9) Xcode 6 will also list low memory logs here. These will be shown with a Process name "Unknown" and Type "Unknown". You should examine the contents of these logs to determine whether any of these are caused by your app. For more information about low memory logs, see Understanding and Analyzing iOS Application Crash Reports.
Using Xcode 5
1) Plug in the device and open Xcode
2) Open the Organizer window and select the Devices tab
3) Under the DEVICES section in the left column, expand the listing for the device
4) Select Device Logs to see crash logs or select Console to see Console output
Back to Top
Enabling App Store Diagnostic Reporting
Crash logs are automatically collected from customers who have opted in to sending diagnostic and usage information to Apple.
Beginning with Xcode 6.3, crash logs from App Store customers running at least iOS 8.3 and TestFlight beta testers can be found in the Xcode Organizer. To obtain these crash logs:
1) Open the Organizer window in Xcode 6.3 and above
2) Select "Crashes" at the top. The available crash logs can then be found within this window.
The App Distribution Guide contains further information about the Crash Reporting service.
Crash reports from customers running older iOS versions may be found in iTunes Connect.
If someone is reporting a crash, and you do not see a corresponding report in iTunes Connect, you should direct them to the following knowledge base articles for Mac or for Windows so they can opt-in to sending you crash reports.
Back to Top
iOS 13.4.1
Using iPhone
Settings -> Privacy -> Analytics & Improvements -> Analytics Data -> <app_name>
Using MacOS
~/Library/Logs/CrashReporter/MobileDevice/<device_name>/<app_name>
Using Xcode
Window -> Devices and Simulators -> <device_name> -> View Device Logs -> All Logs -> <app_name>
When your app crashes, Xcode will enter the debugger and show you more information about the crash:The most important parts are:
The red arrow
The red arrow displays which line of code crashed & why it crashed.
The debugger console
Many crashes log more information to the debugger console. It should automatically appear when the app crashes, but if it’s not there, show the debugger by selecting the button in the top-right corner of Xcode, and show the console by clicking the button in the bottom-right corner of the debugger.
The stack trace
The stack trace lists the functions the program came from before it got to the code that crashed.
Part of the stack trace is displayed in the Debug Navigator on the left of the screen, and the debugger controls allow you to select a stack frame to view in the debugger:
If you enter the bt command at the (lldb) prompt in the debugger and press return , you will get a textual representation of the stack trace that you can copy and paste:
Ref:https://medium.com/#javedmultani16/finding-information-about-a-crash-ios-642902134469

Running iOS8 extension on simulator offers no suitable host app

When I run my ios8 action extension on the iPhone simulator it gives me a list of apps to act as host, but it only offers 'today' and my own app even though I have specified the following in NSExtensionActivationRule in the plist:
NSExtensionActivationSupportsImageWithMaxCount:1
NSExtensionActivationSupportsWebURLWithMaxCount:1
so I would have expected safari, photos etc.
You may want to forego launching the extension directly from the simulator.
I've been debugging extensions all week and what I'd suggest is this (not too long) process:
Launch the app so that your latest version of the extension is
loaded onto the simulator.
Then stop the app so the simulator is not in use.
Attach to the extension via this Xcode menu Item: Debug->Attach to Process->By Process Identifier (PID) or Name
Xcode will now say "Waiting for 'EXTENSION NAME HERE' to start" and may prompt you to "take the appropriate action"
(On the simulator) Launch Safari (or the appropriate app) and interact like you would if Xcode had launched it on your device.
Once your extension is run, Xcode will attach and you can debug
I would recommend binding that menu item to a keyboard shortcut (I used Opt-Shift-Cmd-A because I hate my carpal tunnel) because it's two items down and the stupid attach menu loads all the active process AFTER it opens so the item you want jumps to the top of the screen.
Once you load the extension you can keep re-attaching to it if it crashes without having to relaunch the containing app.
This has sped up my debugging process quite a bit.
Create action extension involves the following three steps
1) Create a Target with "Action extension" template
2) Goto iPhone "Photos" app and choose a photo and click Share icon. It will show "Share" activities(FB, Twitter, etc) and "Action" activities(Copy, Slideshow, etc). Goto end of "Action" activities and click "More" button
3) In the "Activities" page, you have to enable your "Action" extension

How do you debug your application if they got started using a custom URL scheme?

I'm developing an app for the iPhone, but I guess the question is the same on the Mac.
What is your approach to debug the state of your application after it has been launched by its URL scheme?
There is a way to debug your application when it is launched from an external URL:
Set a breakpoint where you want it in application:handleOpenURL: or application:didFinishLaunchingWithOptions:
In Xcode, edit the Active Executable's settings. On the Debugging tab, select the "Wait for next launch/push notification" checkbox.
Build and Debug. The Console will give you an alert saying "Waiting for [AppName] to launch... The debugger will attach to [AppName] the next time it is launched."
Open your app by invoking a custom URL or sending it a push notification. The debugger will stop at your breakpoint.
I'm on Xcode 8.2.1 and the fastest way is to simply go to Product -> Edit Scheme and select “Wait for executable to be launched” like the image below. When debugging started, it will not launch the app but "waiting for "THE APP" to launch..". When an action (click on the push notification), the breakpoint will kick in.
Actually, I think it would be quite different on the Mac than on the iPhone as you can have the application open already on the Mac and call the URL scheme, whereas on the iPhone you need to quit the application to open another to call the URL scheme.
What you could try is adding a debug button to your UI which allows you to call the URL scheme from inside the running application (calling -openURL: on NSWorkspace). This should in theory work the same whether your app is open or closed when the URL scheme is sent.

Resources