Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio: Client not ready yet

While launching an app, I am getting a message " Client not ready yet". Also, my device is showing" Waiting for debugger to attach ", followed by "Unfortunately, android app has stopped working". I have tried every possible solution available on discussion forums, but no solution is applying here.I also tried running a simple HELLO WORLD app to know whether there is some issue with my app code, but the same message is been shown. I tried the following things:

  1. Reinstalling the deice drivers
  2. Reinstalling the android studio
  3. Installing LLDB
  4. Using different device, different cable and port
  5. adding android.os.Debug.waitForDebugger(); to the manifest file
  6. Changing setting to MTP only
  7. Removing all breakpoints

But nothing worked. What could be the root cause of this problem??

like image 716
Aashi Avatar asked Dec 30 '15 08:12

Aashi


3 Answers

The activity has to be exported to be accessible from adb. If the Activity has an intent-filter it is exported by default. Otherwise add the exported flag:

<activity
    android:name=".my.MyActivity"
    android:exported="true"/>

This is the error you get when the activity is not exported and you run

adb shell am start -n "com.example/com.example.my.MyActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER

Error:

Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.example/.my.MyActiviy } from null (pid=26721, uid=2000) not exported from uid 10304
    at android.os.Parcel.readException(Parcel.java:1620)
    at android.os.Parcel.readException(Parcel.java:1573)
    at android.app.ActivityManagerProxy.startActivityAsUser(ActivityManagerNative.java:2694)
    at com.android.commands.am.Am.runStart(Am.java:875)
    at com.android.commands.am.Am.onRun(Am.java:359)
    at com.android.internal.os.BaseCommand.run(BaseCommand.java:47)
    at com.android.commands.am.Am.main(Am.java:100)
    at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
    at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:251)
like image 81
passsy Avatar answered Nov 15 '22 05:11

passsy


[This answer is obsolete for latest versions of Android Studio]

This worked for me :

Tools > Android > Enable ADB Integration

You need to tick Enable ADB Integration

like image 3
partho Avatar answered Nov 15 '22 03:11

partho


If this is a transient issue then in most cases I have found restarting Android Studio fixed the issue.

In one case a Windows restart seemed to fix the problem. A reboot of the device did not.

It was a transient issue which happened just occasionally for a few days but eventually started happening every time and therefore stopped all work.

I was working with two different Android Studio projects open at the same time, both running (different) apps on the same device (but not at the same time).

I may have opened the Device File Explorer on both projects.

like image 1
OldCurmudgeon Avatar answered Nov 15 '22 04:11

OldCurmudgeon