Failed to debug application in Android Studio

I am making an application in Android Studio, now I am trying to debug it through adb. When I click on the word Android and the logo on the bottom panel, a log code appears and recognizes my device. Then I see the following:

screenshot

What do I need to do for my application to make it "debugged"?

FYI developed this application in Eclipse before, and adb worked fine.

+69
android debugging android-studio adb
May 25 '13 at 9:12
source share
28 answers

There is a Debug icon on the toolbar. This looks like a small β€œerror” and is located next to the Run icon (which looks like a play button). Try to launch the application with this.

Click here to debug

Edit: when using Android Studio with Gradle, the following becomes obsolete.

There is a debug flag in the AndroidManifest.xml file. It is under the application tag and should be set to true, as shown below:

<application android:debuggable="true"> </application> 
+76
May 25 '13 at 23:29
source share

I solved this problem after following these steps:

Go to Tools ==> android ==> Disable ADB integration and enable it again.

After that, disconnect the USB from the device and reconnect.

Finally press Shift + F9

+107
Dec 28 '14 at 2:46
source share

Another thing to take care of (I did this so that I know the spirit). Remember to enable Proguard for debugging!

+26
Oct 29 '14 at 23:52
source share

I also accidentally had this problem even after repeatedly debugging in Android Studio. Once, the debugger simply did not join. I just had to exit Android Studio and open it again, and the debugger started working again.

+15
Aug 01 '13 at 18:25
source share

This worked for me:

  • Close Android Studio.
  • Open a shell and write:

    adb kill-server

    adb start-server

+11
Sep 17 '14 at 9:02
source share

Make sure you enable ADB integration.

In the menu: Tools β†’ Android β†’ Enable ADB Integration (1.0)

+11
Dec 17 '14 at 9:41
source share
  <application android:debuggable="true"> </application> 

It doesn't work anymore! No need to use debuggable = "true" in the manifest.

Instead, you should set the build options for "debugging"

Debug mode

In Android Studio, go to BUILD β†’ Choose Build Option

Now try debugging. Thanks

+10
Feb 17 '16 at 10:30
source share

If your application was used for debugging, and suddenly it is no longer being debugged. Here is my solution

  • Disable and enable the USB debug switch on your phone.
  • Uninstall the application.
  • Click "Run" in Android Studio.
+9
Apr 26 '15 at 9:42 on
source share

One case when you cannot debug an application in Android Studio is when you have chosen the release option. It happened to me - Gradle creates a version of the application (which is not debugged), and then Android Studio cannot connect the debugger.

+7
Aug 01 '13 at 9:18
source share

The "Attach debugger for Android process" icon will be used if you have installed a custom "android: process" in your manifest file.
In my case, I have to select the appropriate process and click the "OK" button immediately after the "Wait for Debugger" dialog box appears.
enter image description here

+7
May 25 '16 at 13:20
source share

This happens to me, and I have yet to find out why. None of the solutions already published worked for me. The only thing that works for me is:

  • Uninstall the application from the device.
  • Clear project. "Build β†’ Clean Project".
  • Rebuild and install.
+6
Jun 24 '14 at 17:35
source share

Check if you selected the project application in the drop-down menu next to the debug button. Sometimes Android Studio simply resets this choice ...

enter image description here

+4
Dec 08 '15 at 10:13
source share

Also make sure that you are not using other applications that can use ADB, such as Eclipse.

+3
Jun 16 '15 at 15:31
source share

If you turn on

 <application android:debuggable="true"> </application> 

In the application.xml manifest, make sure you disable it when creating the final signed apk, as this can serve as a hole in the security loop for attackers. Use it only if only one of your applications does not show logs. However, before considering this option, try the following:

Go to tools in android studio

  Tools==>android==>disable adb integration and again enable it 
+3
Feb 05 '16 at 18:03
source share

Be sure to enable developer mode and USB debugging on the device or emulator. (It's easy to forget when creating a new one.)

+2
Apr 21 '16 at 16:02
source share

You must also have active tools-> Android-> Enable ADB Integration.

+2
May 23 '16 at 9:05
source share

I did a clean build using the command below. It works amazingly.

sh gradlew clean build

Hope someone gets help!

+2
Jun 20 '17 at 15:08
source share

This solved my problem. Uninstall the application from the device and launch it again through the Android studio.

+1
Sep 27 '16 at 10:32
source share

I tested all the way and did not work.

finally had to change the adb port and it worked. first kill adb server as below:

 adb kill-server 

then restart it using a different port

 adb -P 5038 start-server 
+1
Jun 13 '17 at 7:38 on
source share

In my case, a red circle appeared next to any line with a cross and a red line with the message: "No executable code was found in the line ...", as at the gradle breakpoint in Android studio. No executable code found in line .

The problem appeared after the build.gradle update. We included Kotlin support, so the number of methods exceeded 64K. Problem lines:

 buildTypes { debug { minifyEnabled true 

Change them to:

 buildTypes { debug { minifyEnabled false debuggable true 

Then synchronize Gradle using the "Sync Project with Gradle Files" button. If after restarting the application you receive the error message: "Error: the number of method references in the .dex file cannot exceed 64 KB. Find out how to solve this problem at https://developer.android.com/tools/building/ multidex.html ", as in " The number of method references in the .dex file cannot exceed 64 KB. API 17 adds the following lines to build.gradle :

 android { defaultConfig { ... // Enabling multidex support. multiDexEnabled true } ... } dependencies { implementation 'com.android.support:multidex:1.0.2' } 

UPDATE

According to https://developer.android.com/studio/build/multidex.html do the following to enable multidex support below Android 5.0. Otherwise, it will not start on these devices.

Open AndroidManifest and find the <application> . Next to android:name= is a reference to the application class. Open this class. Extend the Application class with MultiDexApplication as follows:

 public class MyApplication extends MultiDexApplication { ... } 

If the application class is not installed, write this:

 <application android:name="android.support.multidex.MultiDexApplication" > ... </application> 
+1
Feb 15 '18 at 14:55
source share

In my case, I had to remove proguard in the Build Type debug type, completely clearing the text file proguard-rules.pro and making minifyEnabled false in the build.gradle file.

  debug { debuggable true minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } 
+1
Mar 28 '18 at 7:08
source share

Here are some insults that some of them can catch: it’s quite easy to accidentally get a filter for the logcat output window (text box with a magnifying glass) and forget about it. That which potentially filters out the entire output and makes it look like it doesn't.

0
Nov 11 '16 at 6:10
source share

In my case, I had the same problem because I am trying to debug a signed apk. In my gradle configuration I made different build options and tried to debug the final build with keystore.jks production

0
Mar 21 '17 at 11:19
source share

For me, this happened when I used Proguard, so after trying all the solutions, I cleaned up my project and clicked the debug button in Android Studio, and it started debugging

0
Mar 17 '18 at 22:36
source share
 <application android:debuggable="true"> </application> 

This code is not a solution to the problem. You need to enable debugging in your build.gradle file. If you have different types of buildTypes, make sure you set "debuggable true" in one of the build types. Here is a sample code from one of my projects.

 buildTypes { debug { debuggable true } release { debuggable false } } 

** I deleted other lines inside buildTypes that are not relevant to this issue from my Gradle file here.

Also, make sure you select the correct build option in your android studio when debugging.

enter image description here

0
Sep 17 '18 at 15:33
source share

What worked for me in Android Studio 3.2.1

It was:

RUN β†’ Attach debugger to Android Process --> com.my app

0
Nov 28 '18 at 12:15
source share

Over the years, I visited this topic many times, and there was always a different answer that helped me. This time, I realized that it was my USB hub that prevented the debugger from working properly. No matter how strange this sounds, instead of connecting the phone to the computer via a USB hub, I had to connect it directly to the Mac computer, and debugging started working.

0
May 19 '19 at 16:23
source share

I had the same problem and tried almost all kinds of solutions through Google. But I could not solve it. Finally, I found a solution. This is Android Studio Bug.

Do not press Run (Alt + F10) - just press Debug (Shift + F9) .

Then Android Studio will show you a Warnning Message with ADB, then just click β€œOK.”

You can log in to the logcat console. Packages will be shown on DDMS (devices).

-3
Nov 26 '14 at 6:16
source share



All Articles