adb error in android studio - android

I've tried every proposed solution on the internet and nothing is working. Android studio was working fine then one day out of nowhere it kept giving me this error on every project
unable to locate adb
I tried navigating to my adb.exe and kill-sever and restart it but the adb.exe directory is not in my platform-tools folder under sdk.
I've tried uninstalling android studio and reinstalling it. A post suggested that it could be my AVG security but that was not the issue. I've tried updating the platform-tools and it freezes here

Close android studio.
open a command window.
type adb devices
no devices?
trouble shoot connection and drivers and device developer option
see a device?
type adb shell
type ls -l
type su
su not found? download or activate your superuser app
no problems with any step?
open android studio and try again with it's terminal emulator

Related

Error while trying to push/install .apk using adb

I've recently started encountering problems while trying to run my application from Android Studio on my MacOS machine. I tried to run the command from adb myself but I still can't get it to work, although the error appears different.
The errors I get are as follows;
Android Studio
10/02 09:54:53: Launching app $ adb push /Users/{username}/{path-to-apk}.apk /data/local/tmp/{package}
java.io.IOException: Broken pipe
Error while Installing APK
adb (via Terminal.app)
$ adb push /Users/{username}/{path-to-apk}.apk /data/local/tmp/{package}
adb: error: 65536-byte write failed:
Undefined error: 0
Now I've tried a lot of different things, some of which are just stretches because the problem appears to lie in something adb related, but none of this seems to change anything;
Different applications/apks
Different Android devices (total of 5)
Different USB-ports (all 4,
with and without USB-hub).
Different (or no) USB-dongles (USB-C to USB-A)
Restart/Invalidate Caches (Android Studio)
Reinstall Android Studio
Reinstall Android SDK
New (separate) install of Android SDK through homebrew
Reset NVRAM/PRAM
Reset SCM
Update to MacOS Mojave (and retry all of the above).
At this point I am at a loss. Has anyone encountered these errors before without having any of the above solutions fix it? Next thing on my list is a reinstall of the OS, but that feels like a bit of overkill.
I am running on MacOS Mojave on a 2016 Macbook Pro, but everything appeared to have the same effect on High Sierra.
Edit
Weird update on the behaviour, I can get the installing to work continuously after a restart by doing the following steps;
Login
Start Terminal.app
Manually repeat adb push command
(Command executes successfully)
Start Android Studio
Everything works fine...
However, if I start Android Studio without first manually doing the adb push in Terminal, everything is broken as described above.
Edit 2
Even calling adb start-server in Terminal before starting Android Studio makes everything work. So something appears to be faulty when Android Studio is responsible for starting the adb server..
I got the same error. I have no idea but start-server before starting Android-studio
Restart adb with the following command,
adb kill-server && adb start-server
Not really an answer but my issue appears to be solved with the latest release of Android Studio.

ADB is not working after android studio update

I have updated android studio to Android Studio v2.3.3 (June 2017) and adb stopped showing logs when I launch app on android studio emulator
The log shows:
07/11 13:08:17: Launching app
$ adb push C:\Users\1\AndroidStudioProjects\Don'tWakeMeApp4\app\build\outputs\apk\app-debug.apk /data/local/tmp/oleksandr.ivanets.dontwakemeapp
$ adb shell pm install -r "/data/local/tmp/oleksandr.ivanets.dontwakemeapp"
Success
$ adb shell am start -n "oleksandr.ivanets.dontwakemeapp/oleksandr.ivanets.dontwakemeapp.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Client not ready yet..Waiting for process to come online
Connected to process 4429 on device Nexus_5X_API_26 [emulator-5554]
Click on below link
http://adbshell.com/downloads
and download the first link with name ADB Kits ( contains adb.exe and necessary .dll files).
After downloading replace these files with the ones in the path
Android/Sdk/platform-tools/
Now click on adb.exe and it will open cmd and will start the adb server.
Now it will detect the device and no problem. OOOOOllllaaaaa.....
If the Problem persists again then do the same... save the folder
somewhere.... just replace files... it will detect the device
automatically then
Preface: Although my answer focuses on Android Studio's perspective of ADB errors, I'm sure it is helpful for Windows ADB debugging in general!
#sHaRkBoY 's answer helped me look in the right direction. I used to get "Unable to detect adb version, adb output:" on Android Studio while trying to "run" the app onto the phone... and no devices showed up when phone was connected to PC.
I had tried all these (from different SO answers) but none of them worked!!!:
"Invalidate cache and restart" from File toolbar.
Turn off and turn on USB debugging on phone multiple times
Experimented with "MTP", "PTP", "Midi" and "Charging" modes to see if ADB detects something...
Checked my anti-virus software to see if adding exceptions to the adb directory works...
Installed various unnecessary C++ re-distributables
Tried a different USB cable (and USB port)
Restarted Android Studio and PC
and even uninstalled and re-installed Android studio!
The problem finally was that the platform_tools\adb.exe file downloaded by the official SDK tool manager was corrupted! So I used to get windows error code 0xc0000142 on launching adb.exe from command prompt! :(
SOLUTION:
For future readers (and victims xD) of the above ADB problem, please do the following:
Firstly, add the platform_tools\ directory into the system path environment variable.
Go ahead and replace the following 3 files in your platform_tools (C:\Users\{YourAccount}\AppData\Local\Android\Sdk\platform-tools) directory. (Please backup the same folder before, just in case.)
ADB kit (internal version number: 32)
Note: Please prefer this ADB kit (exe and dll files), compared to #sHaRkBoY 's ADB kit (2.0.0.0), since it has an updated version of AdbWinUsbApi.dll (2.0.0.1), where a race condition issue has been fixed!
I hope my answer saves your from the traumatic experience I went through while troubleshooting magical ADB for an entire day! :)

Error when launching .apk on android studio emulator

I am building an app with ai2 but I have spend hours trying to get their emulator to work, so I have exported myapp.apk and I am trying to launch it on android studio emulator.
I have followed several tuto included the answer proposed by Tarek on that thread But I am getting and error on cmd.
Here is what I tried:
run android studio as administrator, run the emulator via the AVD manager, waited until it's started.
move myapp.apk in the sdk/platform-tools folder
created a run.bat file in this folder and wrote CMD in it5. copy your desired apk to the same folder
double click on run.bat and wrote: adb install r- "myapp.apk"
Here I am getting an error on CMD: error device not found -waiting for device-. I don't understand because my emulator is running.
I have also tried to launch the emulator without starting android studio with this command emulator -avd <avd_name> [<options>] but I get this message "the system cannot find the file specified".
The error message appears because adb cannot connect to the device although it is running. This is not supposed to happen, but it does from time to time.
You can always check if adb can see the emulator by running adb devices, which should result in a list of devices it can see. If this list is empty, the device is not found. You can resolve this by adb kill-server, waiting a couple of seconds and then running adb start-server. Try running adb devices again, and the device should be listed, and the installation should succeed.
Starting an emulator can be done by running emulator #<device-name> [options]. The device name can be found by running android list avd. This will result in a list of devices of which the <device-name> will also be listed.

IntelliJ - "ADB not responding"

I work with:
IntelliJ IDEA Community Edition 12.1.6
on Windows 7
When i try to Run new project (simple auto created Hello World) InteliJ display window with comunicate "Waiting for ADB" and then "ADB not responding. You can wait more, or kill "adb.exe" process manually and click 'Restart'".
So 'Wait more' effects the same communicates, same as killing ADB and 'Restart'.
I tryed to "adb kill-server" and "adb start-server" in console but it dont fixed my problem.
My device is connected to adb.
Does it work with ADT?
I don't have much experience with InteliJ, but in ADT you have to specify a path to Android SDK so it can find and run adb. If there are no such settings, try adding path to android sdk tools ( the folder where adb.exe is located ) to your system PATH.

Eclipse Android Virtual Device Manager doesn't launch

I am using Eclipse 4.2.1 (Juno).
My Android Virtual Device Manager does not launch. I press on the button and literally nothing happens (no error message).
I've tried reinstalling the Android SDK, ADT and Eclipse but nothing helps to fix this issue.
Any ideas on how to fix this issue?
I ran into the same problem when relocating my entire developement directory. Deleting the folder and relaunching Eclipse resolved it.
Had the same problem. After several reinstalls, restarts and what not, I finally figured it out:
open cmd, run android avd from sdk\tools folder. You'll probably get an exception that you can google, which is already better than no response at all...
This is what I got:
java.lang.NullPointerException
at com.android.sdklib.internal.avd.AvdInfo.getDeviceName(AvdInfo.java:158)
What did the trick for me was deleting the folder C:\Users\<User>\.android\avd.
In this case reinstalling will help
get the android development package from developers site.....
and you can try by running in a new User Account in your PC
some times it workss!!!
all the best!
Close Eclipse
Kill adb through command line with command adb kill-server
Now start task manager and kill adb process also from there if running from the process tab
Now start your adb again from command line with adb start-server
-Now start your Eclipse again and run your application
Try!!
In my case this was a problem with old /tmp/android-username/emulator-* files.
I found it out by running manually my predefined arm AVD named "Test"
$ cd adt-bundle-linux-x86_64-20130522/sdk/tools
$ ./emulator64-arm -avd Test
NAND: could not write file /tmp/android-username/emulator-gKbQ19, File exists
Removing old emulator files from /tmp/android-username resolved the problem.
rm /tmp/android-username/emulator-*

Categories

Resources