Android Emulator Blocks sound on VMware linux host - linux

I am using linux 10.04(32 bit) on VMWare. In this vm I have installed Eclipse and running an Android emulator. Sound normally works on the VM but as soon as I start the Android Emulator sound is disconnected, whit this error msg,
The default sound device cannot be opened:
A device ID has been used that is out of range for your system.
Failed to connect virtual device sound.
Can any one please tell how to enable sound while the emulator is running?
I started the emulator on a different port using the -port command still no luck. Any ideas?

This issue was solved after installing skype in to the vm!

Related

APK does not install and device is unauthorized and offline

I have a device running Android 6.0.1 and I'm working with Android Studio 2.3.3 on a Mac. When I try to install/run my application (hello world) I get this message.
com.android.ddmlib.AdbCommandRejectedException: device unauthorized.
This adb server's $ADB_VENDOR_KEYS is not set
Try 'adb kill-server' if that seems wrong.
Otherwise check for a confirmation dialog on your device.
Error while Installing APK
I know questions like this have been asked all over this site and I have looked though most of them and followed these suggestions
Turn everything off and on a few times
Ensure USB debugging in enabled in developer settings
Stop and start the adb server
Try a different deployment target, virtual devices work fine
My current theory is that my device is not authorized either because my device is not a phone/tablet/watch, it is just a SOM and carrier board.
My only other thought is that this is caused by the device being offline.
When I am selecting a deployment target I can see my device but it says [OFFLINE] beside it and it is slightly greyed out. I don't fully understand what this means given my device is connected the same network as my Mac they can ping each other.
So my question comes down to this
What other troubleshooting can I try?
Is it relevant that my device is offline/ what does that mean/ how can I go online?
The issue was with the .img file I used when getting the OS running on my device. I reinstalled the OS and everything worked after that.

Android Studio emulator keeps freezing, crashing, and is not responding at all

I'm a starting Android development and have recently ran into some problems. I don't know whether it is my hardware or if it's Android Studio but the emulator keeps freezing or is not responding.
The first 2 days Android Studio was running fine. However, after that it cannot run my apps. I reinstalled Android Studio and it worked for one day, but now even if I reinstall it, it won't run any apps and even Android Studio itself would occasionally freeze and I will have to restart it.
The emulator either does this or does not even turn on:
it won't even respond when I click on anything on the emulator
Here is a break down of what's been happening.
Day 1: works fine.
Day 2: Android Studio freezes multiple times when I launch the emulator. Emulator unresponsive to clicks. I uninstall Android Studio thrn install it again. After reinstallation it works 100% again with the same app
Day 3: emulator unresponsive, freezes. Menu bottons such as rotate screen, back etc. unresponsive.
Day 4: same as day 3. Uninstall Android, reinstall. Unresponsive.
You can try changing this line of code System.out.println(userinput1); to Log.d(MainActivity.class.getSimpleName(), userinput1) because on emulator system.out.println() automatically redirects to logcat but sometimes not.
This problem may arise due to low ram size, android studio works fine with 8GB Ram.Or try to config emulator properly. Let me know if problem continues.
I would suggest that import just specific address of class not the whole package or as bundle.
With
import java.util.*;
all classes of java.util package is imported.
The problem might be that, your hardware might be overwhelmed.
I don't think anything is wrong with your code. What is your system configuration? Does other applications work on emulator work? Can you post you
post your logcat?
PS: I know it should have been a comment. But I don't have permissions, sorry.
Problem and solution
Same problem, unusable for serious testing, whole system locking up regularly (Linux Mint Vera | 16GB-RAM | Nvidia GP106 [GeForce GTX 1060 3GB] -- worked fine on Windows 7, exact same hardware (although hard drive config has changed slightly, might need to double-check the OS drive is connected port0 on motherboard in case of performance impact).
It's ironic that Android being Linux based, struggles to run in a Linux env xD.
Tried different:
Linux APIs
Emulator Phone Models
Phone RAM specs, processor specs, etc
( All different graphics modes (both in native A-Studio emulator and using the apt install-google-emulator option for vanilla standalone (old school) version. Old school version runs better (standalone version).
Checked all microcode updates and drivers are in order. (Using Nvidia GP106 [GeForce GTX 1060 3GB]
System is up to date (apt)
Found the best options:
Performance Better: Restart Android Emulated Device with 'Cold Boot' option specified
or
Use Diff Emulator: Virtual Machine Manager / Virsh (KVM-QEMU)
or
Use Physical Device: With Android 11+ you can wifi pair.
With devices APIs lower than 11, there is no Wi-Fi pair feature so I found solution was to install termux on the handset I wanted to use for app testing, which gave me a standardish shell with apt pkg manager -- then I could install sshd and connect to dev-PC with portforward i.e
$ SSH from Phone to PC with: ssh -R 4444:127.0.0.1:5555 ubuntu#192.168.1.20
$ SSH from PC to Phone with: ssh -L 4444:127.0.0.1:5555 ubuntu#192.168.1.20
(The exact command may vary, written from memory as quick guide to get you moving right direction thought ports are correct, syntax may need adjusting and of course, the username#hostIP needs setting to your you-login#your-computers--LAN-IP).
Once an SSH connection has been established, which you can check using something like
$ ss -tulpan | grep 4444
or
$ netstat -tulpan | grep 4444
Once confirmed established, you need to fire up adb to connect to the now available Android adb service that we forwarded from the handset into the dev-PC by running the command (also make sure you have USB debugging enabled on the handset before doing this);
On dev-PC run;
$ adb connect 127.0.0.1:4444
It should say 'CONNECTED'.
Then to double check, run:
$ adb devices
Emulator should show up in Android Studio Device Manager. Give it a few minutes and Android Studio will pick it up!
I can't remember the specific reason I needed to do it this way as opposed to just connecting with a USB cable. I think I was doing some mad routed setup. But there we have it!
I found using a physical device to be the ultimate performance solution but is of course a bulky arrangement.
Update
Increasing memory available to Android Studio and the VM made big difference (I have 16gb RAM).
Android Studio > Help > Change Memory Settings (2048 -> 4096)
Android Studio > Help > Edit Custom VM Options > add/replace-->
(-Xmx4096m
(-Xmx4096m
(Then finally added extra config to Gradle script to allow extra memory but I don't think that would have an impact on the slow running issue as was entire emulator crumbling not just the app.)
In gradle.properties, replace order.gradle.jvmargs.... (with)
org.gradle.jvmargs=-Xmx4096m -XX:MaxPermSize=1024m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
Finally, restart Android / Emulator and remember to do a COLD BOOT on your emulator device.

Android Studio - Device is connected but 'offline'

This is quite a common question, but none of the solutions appear to work for me. First time asker, so apologies if I get the conventions wrong.
I am trying to connect my Galaxy S5 to my computer running Ubuntu 14.04 so I can do some android development. I have recently downloaded and installed Android Studio and the SDK and my device is detected when it's connected via USB but the device either appears as 'unauthorized' or 'offline'. I know I should be expecting the RSA key prompt but this never appears.
I have tried:
Checking debugging was enabled
Running adb kill-server and adb devices
Restarting (the device, developer options, the machine)
Simple unplugging and replugging the USB cable
Checking my adb version (it is 1.0.31)
Trying different USB ports
Revoking USB debugging authorizations
Toggling enabling ADB Integration from within Android Studio
Connecting as PTP device and MTP device
I have tried it on a separate machine that runs fedora and this works fine with no issues, the promopt appears right away. Therefore I imagine it is not the USB cable that is faulty.
Any ideas?
Try these:
Unplug and replug the USB cable.
If it still doesn't work, unplug the USB cable, disable then enable USB debugging in the device settings.
If the above two methods fail, reboot the device.
If rebooting the device also fails, reboot Android Studio too.
If reboot Android Studio still fail, try adb kill-server then adb start-server.
Try killing adb adb kill-serverthen disable usb debugging and then start adb by adb start-server then enable usb debugging and plug phone again and huh don't let phone sleep between process
EDIT
There turned out to be a problem with my laptop's ADB RSA key. I'm assuming my G3 was rejecting a bad key and disallowing my laptop to connect to it via ADB.
ADB saves a key file in one of multiple places on a Windows computer, the first is in the location where adb.exe is (C:\android), the second is in the user's >profile (C:\Users*username*.android), the third place is in the Windows system files (C:\Windows\System32\config\systemprofile.android), the file is >simply named "adbkey" with no extension. If there is no key file when ADB runs, it will generate one automatically.
Mine was located in my user folder (C:\Users*username*.android). All I had to do was delete the adbkey file (there was also a file named "adbkey.pub" which >I deleted as well), restart the adb server in command prompt (adb start-server) and plug my phone in. I instantly received the RSA Fingerprint Key window on my >G3 allowing connection between the two devices. Then typing "adb devices" returned my phone's serial number followed by "device" showing it was available. >I went back to the C:\Users*username*.android\ folder and sure enought there were new "adbkey" and "adbkey.pub" files.
got from XDA
EDIT 2
TRY this steps too
Navigate to where .android is stored
open .android and delete file named as adbkey and adbkey.pub
Start ADB then typeadb kill-serverand adb start-server
My fix to this issue:
Android settings
Developer options
Revoke USB debugging authorizations
Replug in device and accept authorization as usual.
Profit
Step 1: Turn off USB DEBUGGING in Developer Options
Step 2: Remove USB Cable
Step 3: Turn on USB Debugging(This rests USB Configurations)
Step 4: on Command Prompt enter adb kill-server and then adb start-server
Step 5: Connect the USB Cable
Step 6: Check Devices connected in Run in Android Studio(you should be able to see your device listed)
Step 7: If you want to continue running using the cable this would be good enough
(If you want to do Wireless Debugging continue with below step)
Step 8: type adb tcpip 5555. If no error is displayed remove USB Cable
Step 9: Look up IP Address of your phone from About abd then type adb connect xxx.vvv.b.n(your phone's IP)
Step 10: Check in Devices in Android Studio again and you shud see you r device in List of devices. If yes,
If you are on windows and you encountered the same problem, try killing the adb.exe process from task manager and then rerun your app.
Change the USB cable !!!!
I can't explain this technically, however after a lot of trial and error, this what have worked for me.
Could not get Samsung Note II (N7100) to connect.
Step 1. Follow answer from user4847410 above. Next time you connect your phone it will come up with an authorisation message and you're in.
Step 2. I also swapped my cable.
Step 3. Check USB port as if you install on one particular port then another port may not be ok for you.
Note: made two batch files
adb-fix.bat
adb kill server
adb start server
pause
adb-devices.bat
adb devices
pause
-- voted for that correct answer but I don't have enough kudos so it was removed! --
To fix this, use USB2 instead of USB3
A shorter cable did the trick.
It turns out that the wire thickness used inside the cable impacts on the resistance of the cable assembly – this resistance causes energy loss inside the cable when an attached load draws a current, and causes a voltage drop which can reduce the voltage to the end device to a point where it is not possible to charge quickly or completely.
http://goughlui.com/2014/10/01/usb-cable-resistance-why-your-phonetablet-might-be-charging-slow/
Change your USB Preferences to File Transfer if you use your smartphone to debug.
There are several option :
File Transfer /* Choose this one */
USB Tethering
MIDI
PTP
No Data Transfer
I had a long white cable. Just wouldnt stay connected. Switched to another, shorter, black cable and it works 100% of the time.
Disabling and Enabling the Developer options and debug mode on the Android phone settings fixed the issue.
Earlier for almost 3hrs I did:
I tried everything given in several sites and my android device never came online.
when I was running adb kill-server and then adb-startserver the "Device File Explorer" on the right bottom of the android studio showed "Device is not online (DISCONNECTED)".
Here is how solve this:
Revoked all USB debugging authorization on the device under "Develop options"
And I added sudo to command "sudo adb kill-server" and then " sudo adb start-server".
After this the message in "Device File Explorer" in android studio changed to "device is pending authentication please accept debugging session on the device". But no message appeared on the device. Tried stopping-restarting adb, connect reconnet usb cable, stop-start usb debugging but nothing worked.
Went back to device and changed the device usb settings from usb charging to "PTP", and, restarted the Android studio. And, boom, the message appeared on the phone to accept the debugging session on device.
use this command
-> adb disconnect
-> adb connect <ip address for your mobile:port number>
Eg : adb connect 192.168.2.58:5555
You can try this:
Go to tools/enable adb integration and uncheck it.
now check it and run again. Next time, android studio will restart adb and it may find your device.
Restart adb by issuing these commands in cmd
adb kill-server to kill existing adb session followed by adb start-server to start a new adb session
Disable and re-enable USB debugging on the phone and accept RSA fingerprints if asked by phone
Rebooting the phone if it still doesn't work.
If all above don't solve your problem, you may try delete environment variable named "ANDROID_SDK_HOME".
It really solved my problem. Hope it Help you!
This fixed for me
uncheck launch in tool windo
Source
https://github.com/google/android-emulator-m1-preview/issues/76#issuecomment-1023563846
This problem is because you have used an old adb version and not support on your device. or you have more than one adb
The key is:
make sure you have a latest adb executable on your SDK
Make sure to run adb command from "SDK_DIR/platform-tools/" because this should be the latest version (type command "which adb" to check) if u have more than one adb file, you can rename another one.
in my case, on my Windows 7 i have one more adb on "C:\Windows\adb.exe" and its an old version, so my adb command always run from that file. I fixed the problem by running adb form my sdk directory "SDK_DIR/platform-tools/adb.exe"
On windows--> Launch your terminal from the platform-tools folder inside android sdk.
Then use the following commands
adb kill server
adb start server
it should work
Try upgrade your Android SDK Platform as below steps:
Run the SDK Manager
Execute "Install packages…"
Restart the SDK Manager
I tried and it's ok for me.
ref: link
You maybe having an older version of the ADB, Update the tools package and that should bring down the latest ADB.
I also recently had this problem and I solved it by rebooting Android Studio. But my friend had to have the original cable for his device, no other cables worked.
In my case (same problem - that Nexus 5 is connected but with "offline" status) the problem was solved by "Invalidate caches and Restart" in Android Studio.
Suppose that problem was in adb and restarting Android Studio causes to adb restart.
Download and Install your device driver manually through visiting manufacturer website like :Samsung,micromax,intex etc.
In my case the problem was that I used a USB extension cable. As soon as I plug the microUSB cable right into the PC the device has detected.
In my case, turned out that you need to be logged as owner of device to properly accept the USB debugging.
Tried the "Disable and re-enable USB debugging on the phone" step but didn't get the RSA prompt on "normal" user, switched to owner and tried again and got it.
I had this issue on a device with USB-C using a microUSB cable with a USB-C adapter. After switching to a USB-C cable without any adapter it worked. I only saw this issue on a LeEco.
I tried most of the things on this page and none of them worked for my Samsung S5. However, when I switched the cable to a USB-C type the problem seemed to be solved...until next time.
Besides the solution mentioned above, try to download Samsung's Android USB Driver for your platform. Here is a link to the Windows one:
https://developer.samsung.com/galaxy/others/android-usb-driver-for-windows
If your app doesn't manipulate WiFi connections - another slightly different solution, which bypasses USB issues entirely - enabling a wireless debugging connection - ADB over WiFi/TCP/IP.

Flash Keon with firefox OS 1.2

I am having problems trying to flash my device with 1.2 in order for me to start using the device for dev.
I have Android SDK installed.
When I run the following command in Terminal -
./flash_mac.sh
I get this message back -
adb server is out of date. killing...
* daemon started successfully *
error: device not found
If I run this command -
adb devices
I get the following back -
List of devices attached
full_keon device
Can anyone help me sort this?
Thnaks
Rory
I have managed to flash the device, I simply re-connected the USB cable while Daemon was being started again.
Obviously anyone else finding this issue, I imagine they will need to update ADB Server.
Not sure how to. As I literally just installed it via Android SDK.
Thanks
Rory

Genymotion on VMWare

I'm on Xubuntu running with VMWare on Windows 7. I'm developing an android app' and use genymotion to run virtual android device. But from few days, when I try to run my virtual device genymotion show me this error :
(translated from French)
Impossible to run the Genymotion virtual terminal.
The Genymotion virtual terminal haven't obtained IP address.
For an unknown reason, the VirtualBox's DHCP server haven't assigned IP address to the virtual terminal. Please run VirtualBox to find a solution for the issue.
For further help, please go to :
https://cloud.genymotion.com/page/faq/#collapse-nostart
So, I followed the link and see that I should have the same IP address for the adapter and the DHCP server and explain how to modify. I change the IP of the DHCP server to be the same as the adapter. But looks like it doesn't fix the issue because the same message appear after the modification.
A friend of mine told me to download the latest version of Genymotion. I did but there's still the same issue.
For the reason why I'm on such virtual device is because I had lot of problem have a stable installation with dual boot windows/linux so I choose a virtualisation of linux instead. And I can't work on windows because it's a team work and work on windows have some conflict with work on linux.
I hope I've been understandable and excuse me for the language fault.
EDIT :
I've try creating a new virtualisation of Xubuntu and install genymotion to see if it was an update I mad or an other mistake I could have done that broke genymotion.
But the same problem appear. I think the problem come from the double virtualisation but I don't know how to fix it.
Actually I just found what my problem was (or look's like). In the settings of the virtual device, in the CD/DVD (SATA) section I choose "use ISO image file" instead of "use physical drive".
I don't know why the issue was related with the CD/DVD. But now I can run the genymotion virtual device. It's slow as hell but it work.
I also found a way to run Android Emulator on MAC (running with VMWare on Windows):
First open VirtualBox and start your Android device. Then start the same device in Genymotion.
To have a relative smooth reaction time - set video memory to 128MB and Motherboard memory to 1024MB in VirtualBox.
You cannot really do virtualisation from a virtualized guest.
You must install Genymotion on the host OS.
You can see an entry on this subject on the Genymotion FAQ here: https://cloud.genymotion.com/page/faq/#genymotion-from-virtualized-host
To run the android apps on genymotion or your device from vm, you can follow these instructions:
Install genymotion on your local os
Install arm translation app on your genymotion
Reboot genymotion
Install google play service on genymotion
Reboot again
Download & install adb wireless app from play store on genymotion
Run adb wireless then get allocated ip address that generated by
this app
Run this command on vm
adb connect <IpAddressGeneratedByAdbWireless>
enjoy!

Resources