During learning Android in Android Studio, I click on Window->Reset Perspective in android device monitor.
After that it gives me this error.
My android virtual device is running successfully.
Help me solve this issue.
Few solutions i tried and which worked for me in different times :
Go in devices view, delete the device and create a new one.
Kill the adb through command line
Before you execute the commands in CMD make sure that you added the adb tool to your Environment Variables path.
Killing adb
adb kill-server
Starting adb
adb start-server
other way of killing adb is Go to task manager->processes and kill the adb.exe process.
Even after doing all these if it prevails, the final thing i did is restarted my whole machine so that adb process is removed from RAM.
Hope it helped :)
I'm running tests for my app, and I want to validate that it works in various time zones.
I'm trying solutions suggested here running adb shell setprop persist.sys.timezone "Pacific/Honolulu", but the timezone (and time) on emulator is not changing- can this work without restarting the device?
If you mean UI tests, I can not change android Date & Time settings on emulator via adb shell.
The only solution I found is to set the timezone during the creation of the emulator with -timezone option.
For example, you can create android emulator with a command like $ emulator #Nexus_5X_API_23 -timezone Europe/Paris.
See more emulator command line options here
I have installed Android Studio.
Then I have updated the Android SDK.
Now when I start Android Studio, this message pops up:
ADB not responding. You can wait more,or kill "adb.exe" process manually and click 'Restart'
The dialog has 3 options: Wait more, Restart and Cancel.
But all of them
gives me the same result, i.e. a message Waiting for ADB appears and I can't do anything with Android Studio.
I have to kill the program using windows task manager! I'm using windows 7.
Can anyone help me on this?
Go to
Tools > Android > (Uncheck) Enable ADB Integration
(if studio hangs/gets stuck end adb process manually)
then,
Tools > Android > (Check) Enable ADB Integration
On my macbook pro, i was occasionally getting this in Android Studio. The following resolved it for me:
Open up a Terminal and, instead of using 'adb kill-server', use this:
$ killall adb
wait a minute and it looks like Android Studio automatically restarts adb on it's own.
From the command prompt run the command adb kill-server. This will shutdown ADB and android studio or Eclipse if you were to use that, would show Waiting for ADB as you said.
Once ADB has shutdown down run adb start-server or run adb devices which will automatically start the adb service and show that your android emulator or development devices has successfully connected.
If you are suffering from "ADB not responding. If you’d like to retry, then please manually kill ‘adb’ and click ‘Restart’ or terminal appear Syntax error: “)” unexpected"
then perhaps you are using 32bit OS and platform-tools has updated up 23.1.
The solution is to go back to the platform-tools 23.0.1.
You can download the platform-tools 23.0.1 for Linux here , for windowns here and Mac here
After the download, go to your sdk location > platform-tools folder to delete old platform-tools in sdk and paste down into the downloaded one.
Woohooo ... it should work.
This is a bug with latest ADT.
For me, on Windows 7, killing the ADB server and restarting it via command line did not help. It would not start up successfully.
>adb kill-server
>adb start-server
* daemon not running. starting it now on port 5037 *
ADB server didn't ACK
* failed to start daemon *
So killing the adb.exe process via Task Manager was actually the easiest solution that case.
Check if any service is listening on port 5037, and kill it. You can use lsof for this:
$ lsof -i :5037
$ kill <PID Process>
Then try
$ adb start-server
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
This solved my problem.
I ran into this problem and tried a number of solutions on my Mac without any success. I finally got to work with the commands below:
$ rm -rf ~/.android
$ killall adb
$ adb devices
Note that rm -rf ~/.android will remove any AVDs that you have configured, so don't take this step lightly. Personally I had to though and I'm not sure why. Hopefully this helps someone.
This issue could be because adb incompatibility with the newest version of the platform SDK.
Try the following:
If you are using Genymotion, manually set the Android SDK within Genymotion settings to your sdk path. Go to Genymotion -> settings -> ADB -> Use custom SDK Tools -> Browse and ender your local SDK path.
If you haverecently updated your platform-tools plugin version, revert back to 23.0.1.
Its a bug within ADB, one of the above must most likely be your solution.
I run netstat -nao | findstr 5037 in cmd.
As you see there is a process with id 3888. I kill it with taskkill /f /pid 3888
if you have more than one, kill all.
after that run adb with adb start-server, my adb run sucessfully.
1.if your phone system is over 4.2.2 , there will be
2.disconnect the USB and try again or restart your phone
3.After after all try , it didn't work. It may be a shortage power supply so try other usb interface on your computer.
I solved the problem doing the first step . anyway have try.
If you need to kill all adb processes on windows with one command, you can do it as follows:
taskkill /F /IM adb*
I had this problem and solved it by this way...
I had a app in my pc that used adb...
I tried to disable it but still my android studio's adb had problem
after unistall that application and problem solved.
I had the same problem. I have restarted ADB in any possible way, I have killed the process and restarted the PC with no results.
Then I found this plugin. Just download and install it in your Android Studio IDE. Under Tools -> Android you have a menu ADB Idea. Here you can kill, start, restart, clean ADB.
None of the above helped me completely. Although Oventoaster made me think. I had a couple of adb on my system. Removed them almost all.
I am running android studio on ubuntu 14.04 64 bit.
So I checked manually /home/xxxxx/Android/Sdk/platform-tools/adb
where xxxxx was my linux username
this gave
/home/xxxxx/Android/Sdk/platform-tools/adb: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
https://stackoverflow.com/a/27415749/4453157
solved it for me.
If the above CMD command option is not working and you cannot make it work in any other way then follow this below.
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
I had this problem on Windows 8, but I solved the problem by updating all of Android Studio's plugins with the SDK Manager, then restarting the computer.
An another one: you might want to avoid running Eclipse and Android Studio together, it helped me.
I had this problem on Windows 7. My situation is this through SDK Manager. I only download API 19 but I had not downloaded related Android SDK build-tools. So it occur this problem.
I went through SDK Manager download build-tools 19 to fix it. Hope to give you help.
Faced this issue on Mac:
I have tried different solution, But below works for me -
Uninstall "Vysor" plugin if you have installed for Chrome
Under Home folder > find .Android folder and move to trash
Goto, Android sdk > delete/move to trash platform-tools folder
Again install/download from Android SDK Manager
Open terminal -
adb kill-server
adb start-server
Check adb devices, It will work and display you all connected devices.
Hope it helps !
there seems to be about a million reasons this bug happens, but for me (running on ubuntu), it was openvpn running in the background that caused it.
I killed the openvpn service and no more issues.
If I do a fresh boot on the emulated device, it gets the correct current time from the host OS; however, if I reload the device from a snapshot, it gets the time/date from the moment the snapshot was created (e.g. When I shut down the emulator). The time/date does not re-sync after any amount of time. The only way around it that I've found is to manually update the time after restoring from a snapshot.
The Android Virtual Device has default properties:
Target = Android 4.0.3 - API Level 15
CPU/ABI = ARM (armeabi-v7a)
SD Card = N/A
Snapshot = Enabled
Abstract LCD density = 240
Max VM application heap size = 48
Device RAM size = 512
I've tried the emulator on OS X Snow Leopard and Windows 7, both show the same problem. Is there any way to get the emulator to automatically sync time after restoring from snapshot?
I have been running into the same problem, and there does not seem to be a standard way of doing this. However, an emulator's date and time can be updated using the date command of the ADB shell, which can be used in conjunction with standard commands for displaying date and time on your OS to update the emulator date and time to the current date and time.
To set a date and time of the emulator, you need to execute the following command in your OS:
adb shell date -s YYYYmmdd.HHMMSS
where YYYYmmdd is the date and HHMMSS is the time.
Linux
Setting the emulator date and time to the current date and time is relatively straightforward from a UNIX-style shell, so the following command will work on Linux:
adb shell date -s `date +"%Y%m%d.%H%M%S"`
macOS
adb -e shell su root date `date +"%m%d%H%M%y"`
Windows
On Windows (which I am using), the easiest way to do it is through Windows PowerShell:
adb shell date -s $(get-date -format yyyyMMdd.HHmmss)
In Command Prompt, it is a bit more tricky because there is no way to specify a custom format to display date and time. The best way I found to get it in locale-independent format is by using the command wmic os get LocalDateTime (line 2). Its date-time format can be parsed to adapt to the format needed by the ADB shell: the symbols :~ can be used to print a substring of an environment variable contents, with the format %var:~<start-index>,<number-of-chars>%. We also need to ignore everything except line 2, so the full command that you need to run is as follows:
for /f "skip=1 delims=" %A in ('wmic os get localDateTime') do #for /f "delims=" %B in ("%A") do #cmd /v /c "set wmicdate=%B & adb shell date -s !wmicdate:~0,8!.!wmicdate:~8,6!"
For the curious: this first saves the date-time into the %wmicdate% variable and then passes it to ADB by parsing it appropriately. The ! are used instead of % to read the variable on-the-fly. This is all done in a child cmd process launched with the /v option that enables this on-the-fly variable reading.
EDIT: Fixed the command for macOS (thanks #user836003).
I opened a bug report.
I have the same kind of issues, and found out the hard way because my app that uses SSL, kept giving very weird errors. This was due to wrong date and time.
Apparently it's not yet reported.
On a newer Android emulator running version 6 API 23, the following powershell command worked for me.
Windows Powershell
adb shell date $(get-date -format MMddHHmmyyyy.ss)
On Android emulator version 7 API 24:
adb shell su root date $(get-date -format MMddHHmmyyyy.ss)
I have searched many times before for a solution to this and i searched again when i saw your question but i couldn't find anyone else even complaining about this except you and me, maybe others don't create apps that time is critical or they test on a real device.
Conclusion: no there is not fix, you have to set it manually or not use snapshots.
Voted Arthon's answer up.
It seems that the emulator get loose to sync when the host machine get sleep.
I'm, personally, using following program for this.
public class AdbShellDateNow {
public static void main(final String[] args)
throws java.io.IOException, InterruptedException {
final long now = System.currentTimeMillis() / 1000L;
final ProcessBuilder builder =
new ProcessBuilder("adb", "shell", "date", Long.toString(now));
builder.redirectErrorStream(true);
builder.redirectOutput(ProcessBuilder.Redirect.INHERIT);
final Process process = builder.start();
process.waitFor();
}
}
This one from macOS works best for me since it takes the time of the host to sync:
adb shell su root date -u #$(date -u +%s)
When I want to test an android application, I create a new AVD, start it in the emulator, wait for the emulator to finish booting, and then use ADB to install the application, and when I'm done delete the AVD. Are there any tools that automate all of those steps? I tried writing my own but I couldn't find a way to tell if the emulator was completely booted, as the Android SDK website says not to use "adb wait-for-device install file.apk".
You're right not to use wait-for-device. It does not wait for the package manager to be available, which is what you need. I'm not sure how eclipse does it but you can poll the emulator until the package manager is available using the command adb shell pm path android. The command should return 'package: something'. Check out this python script that uses the technique: www.netmite.com/android/mydroid/1.6/.../adb_interface.py. It's pretty big but if you search for the command above you'll find the relevant piece of the script.
Why do you want to delete the AVD every time?
If you are deleting it every time because the install command throws an error due to the app already existing on the AVD, you can do this: adb install -r file.apk. The -r part is used for reinstalling the app. Here is the full usage instructions for adb.
Are you deleting it to remove the application you are testing and revert to a 'clean' emulator? If so it's not necessary to delete the AVD every time. You can specify the -wipe-data option when starting the emulator. This effectively resets the AVD to how it was when you created it. Here is the emulator documentation.
Hopefully that helps simplify your script.