I built the Android AOSP tree for the mako device successfully on my Ubuntu 14.04 LTS desktop with the '. build/envset.sh', 'lunch mako-userdebug', and 'make -j4' series of commands. I tried to run it in the emulator by following the Google-provided instructions (i.e. typing the 'emulator' command in a terminal right after the build is complete) but it does not work. The emulator starts up but is stuck on a black screen. I noticed the following warning/errors while the emulator starts up:
emulator: control console listening on port 5554, ADB on port 5555
emulator: can't connect to ADB server: Transport endpoint is not connected (errno = 107)
Any help in resolving this error is greatly appreciated.
Phil,
To make an image for the emulator, you will need to make one of the generic images. e.g. lunch aosp_arm-eng (you can also us userdebug, etc). It may not show up in the lunch menu, but it should be available nonetheless. The emulator was made strictly to test the changes made in the framework and to the default system properties (those that are hardware independent). Building the arm version should fix your errors!
Best!
Related
I am using AOSP emulator for testing my code.
I downloaded the android10_release source code of AOSP in my pc.
Then used the following commands
source build/envsetup.sh
set_stuff_for_environment
lunch aosp_x86_64-eng
make -j6
emulator
now after running these commands I am successfully able to run emulator in my pc
OS of my pc is Ubuntu 18.04
I also installed many libraries for working with AOSP like jdk-8, python, curl, repo, git, and other stuff as per described in AOSP website
I am abe to see my emulator running in terminal by executing following commands
$ adb devices
List of devices attached
emulator-5554 device
I am also able to install my apk in this emulator by executing following commands
$ adb install myapp.apk
and it gets installed and I can see it in emulator
Now coming to my question
Why this emulator not showing in Android studio in devices
Even when I troubleshoot the adb connections in android studio it shows my emulator running but not showing in available devices.
Or connect to it via network adb connect localhost:5555 - port number is one higher than emulated device serial (in default case emulator-5554).
Then it is visible in Android studio and it works without issues.
solution that works for me (tried on two different machines):
$ cd aosp
$ repo init -u https://android.googlesource.com/platform/manifest -b android-10.0.0_r29
...
$ repo sync
...
$ . build/envsetup.sh
$ lunch sdk_phone_x86
$ m -j16
waiting for aosp to build
$ emulator &
$ adb devices
List of devices attached
emulator-5554 device
$ adb connect localhost:5555
connected to localhost:5555
$ adb devices
List of devices attached
emulator-5554 device
localhost:5555 device
start Android Studio (tested with 3.5.3 & 3.6.0)
In the devices list I see: "unknown Android SDK build for x86" with a little green dot next to it.
When I click on Run or Debug everything works
Finally after doing a lot of research I got to know that if I want to use Emulator of AOSP in Android Studio so I need to follow this guide
Sharing AVD system images for others to use with Android Studio
Follow these instructions to share your AVD system images with others. They can use your AVD system images with Android Studio to develop and test apps.
Make additional sdk and sdk_repo packages:
$ make -j32 sdk sdk_repo
This creates two files under aosp-master/out/host/linux-x86/sdk/sdk_phone_x86:
sdk-repo-linux-system-images-eng.[username].zip
repo-sys-img.xml
Host the file sdk-repo-linux-system-images-eng.[username].zip somewhere accessible to your users, and get its URL to use as the AVD System Image URL.
Edit repo-sys-img.xml accordingly:
Update <sdk:url> to your AVD System Image URL.
See sdk-sys-img-03.xsd to learn about other updates to the file.
Host repo-sys-img.xml somewhere accessible to your users, and get its URL to use as the Custom Update Site URL.
To use a custom AVD image, do the following in the SDK Manager:
Add the Custom Update Site URL as an SDK Update Site.
This adds your custom AVD system image to the System Images page.
Create an AVD by downloading and selecting the custom AVD system image.
This link is helpful for reference
Create avd from AOSP to use in Android Studio and also share with others
I followed instructions here to build an open source android project(aosp-2.3.x).
After I finish building the project with:
. build/envsetup.sh
lunch aosp_arm-eng
make -j16
emulator
I can see a black screen emulator and two warning messages:
Could not automatically detect an ADB binary.
Some emulator functionality will not work until a custom path to ADB
is added in the extended settings page.
Running an x86 based Android Virtual Device (AVD) is 10x faster.
We strongly recommend creating a new AVD.
and in my terminal it shows:
emulator: WARNING: system partition size adjusted to match image file (2050 MB > 200 MB)
emulator: WARNING: encryption is off
when I run adb devices, it shows:
List of devices attached
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
emulator-5554 offline
The emulator works in Anroid Studio, but not from the terminal when I tried to build the open source android project, is there any suggestions on how to fix this issue?
I got the same problem like this, try to uninstall android phone driver (check on remove driver and restart pc) then go on search "universal adb driver", download and setup it, it works for me, hope for you too!
PS C:\Users\Nguyen\AppData\Local\Android\sdk\platform-tools> adb devices
List of devices attached
xxxxxxxxxxxxxxxxxx device
My OS is Windows 7 Pro, and I installed Android Studio 2.1, which is the latest version at the moment, and I followed the instruction from this video tutoril to install and setup Genymotion, I did each step exactly as the video shows, but in the end I cannot run my app on the virtual device created in Genymotion(but in the video, it works fine), what I got is:
As shown in the screenshot, the emulator on the left is started from the Geny plugin in AS, and the right dialog is what I got after I click Run button, it seems that the virtual device is not recognized by AS.
The Event Log is:
11:18:01 PM error: could not install smartsocket listener: cannot
bind to 127.0.0.1:5037: Only one usage of each socket address
(protocol/network address/port) is normally permitted. (10048)
11:18:02 PM could not read ok from ADB Server 11:18:02 PM * failed to
start daemon * 11:18:02 PM error: cannot connect to daemon 11:18:02 PM
'C:\Users\Vincent\AppData\Local\Android\Sdk\platform-tools\adb.exe,start-server'
failed -- run manually if necessary
What I have tried so far:
Firstly, I found this post: Android Studio Unable to Find Genymotion Device, which gives a link of a discussion in google forum: https://groups.google.com/forum/#!topic/genymotion-users/ov5ANqGf3DI.
From the discussion, one named Jordan said that two things need to be done: "bridged adapter" and "port forwarding". But in the setting panel of VirtualBox on my PC, what I found is:
If I set Adapter2 as bridged adapter, the 'Port Forwarding' button will be disabled. So I cannot do both things at the same time. I tried bridged adapter first, it didn't work, and then I set it back to NAT as default, added the port forwarding rule, ran the adb command as explained in that post.
BTW, the approach they told to find the ip address didnt work for me, I could not install play store into that virtual device, so I figured out the virtual device's ip address from VirtualBox.
Anyway, neither of them works so far.
Secondly, I tried the approach in this blog: http://scrumsofanarchy.com/adb-over-wi-fi-with-genymotion-android-emulator/, and ended up with nothing, coz basically I cannot install any app into the virtual device.
Thirdly, I tried the approach in this post as well: android studio - emulator doesn't work and genymotion doesn't get recognized. My Genymotion is using the SDK installed by AS now, but that doesnt fix the issue.
I am running out of options now, any help is appreciated, thanks!
Just install GPU Debugging Tools 3.1 in Android SDK Mangaer ;-)
My Phonegap app refuses to load onto my Android device (even the HellowWorld default app is refusing to load)
Everything was running just great until today.
Here's my console log:
***\>adb devices
List of devices attached
4c05609b device
***\>phonegap run --device -V android
[phonegap] detecting Android SDK environment...
[phonegap] using the local environment
[phonegap] compiling Android...
[phonegap] Generating config.xml from defaults for platform "android"
[phonegap] Compiling app on platform "android" via command "cmd" /c ***\platforms\android\cordova\build
[phonegap] Platform "android" compiled successfully.
[phonegap] successfully compiled Android app
[phonegap] installing app onto device
[phonegap] Generating config.xml from defaults for platform "android"
[phonegap] Running app on platform "android" via command "cmd" /c ***\platforms\android\cordova\run --device
It just sits there saying running... forever.
I have another terminal window open with adb logcat running and at some point (maybe 10-15 seconds into that last line getting printed) it stops logging. Termination of the process and subsequent calls to adb logcat result in more hanging (no logging at all)
So then I have to do a kill-server, start-server to break out of this endless hanging at which point the phonegap process terminates with:
[error] An error occurred while running the android project.
***\platforms\android\cordova\node_modules\q\q.js:126
throw e;
^
ERROR: Failed to launch application on device: ERROR: Failed to install apk to d
evice: Error executing "adb -s 4c05609b install -r "***\platforms\android\bin\Po
ached-debug-unaligned.apk"": protocol failure
I have tried::
deleting my .cordova folder in C:\Users\Name
running the adb install directly (without phonegap)
deploying to an emulator (same problem)
unplugging / replugging the device
rebooting all devices
toggling "developer mode" on the device and revoking USB debugging privileges
I am all out of ideas!
Would greatly appreciate any tips or leads.
ADB version 1.0.31
Galaxy S3 running Android v4.3
EDIT:
Deploying to an emulator claims to complete successfully, but the app never opens and does not appear in the app list inside the emulator. So I have no way of actually testing it on the emulator either.
Would really appreciate some assistance.
EDIT 2:
After some further tinkering I've discovered my issue can be more specifically described as ADB hangs (freezes) when I attempt to talk to my device. I've determined this because adb shell, adb install, and adb push all fail the same way as described above. No error, just finite waiting.
adb logcat, adb devices, and other read functions work perfectly fine until one of the aforementioned write functions hangs in which case I need to do a adb kill-server or TASKKILL to get adb logcat working again.
Not sure if this added information helps, but there you go. The last thing I haven't yet tried is to do a factory reset on my phone as suggested by this fellow. If I can't find a solution soon I will back up my data as best I can and attempt this...
Please save me before this becomes my last option!
In case this helps others I had a problem with similar symptoms. ADB install -r "apk path" would hang indefinitely.
I troubleshooted a myriad of things and identified that it was my USB cable length.
I have an USB extender cable as that I plug my devices into. The combined length of my device's cable and the USB extender cable caused this issue. Removing the extension cable fix the issue and eventually I replaced my USB extender cable with a shorter extension cable for the final solution.
The issues seems to resolve itself randomly. As others suggested, an arbitrary combination of ADB kill-server, restarting the device, and re-installing SDKs seems to alleviate the problem (even if only for a couple pushes).
I still have no idea what causes this hanging and, though superstitiously believe the arbitrary combination described above fixes it, am unsure how to permanently resolve it.
To future people reading this, until a solid explanation is given my only advice is to square away an hour or so to restart / rebuild your dev environment... and make sure you buy a durable stress ball.
Shot in the dark here, but some more things to try:
Are you on a work PC or something? Make sure you have USB write permissions. Also, try different USB ports and cables. You have the latest USB driver for your devices right?
Try updating the SDK tools. Or maybe something got corrupted and a re-install might do the trick.
You have free space on your devices right?
Unknown sources is checked on both devices?
What version of Android are you targeting?
Do try restart the device like other suggested. From my experience, kill the adb process, then run the cordova run command helps magically sometimes.
In my case adb seemed to hang, but in fact the data transfer from Mac to emulator was really slow:
$ adb push platforms/android/build/outputs/apk/android-debug.apk /data/local/tmp/
150 KB/s (15587200 bytes in 101.223s)
It's a lot faster on USB connected real device. Don't know why...
Had the same (original) issue (with cordova / testing on an old device) ie. hang during install.
Tried running adb install directly from cmd line ...
adb [-s <deviceID>] install <apk>
...and same issue so not cordova specific....
Opened android device monitor (ADM) ...
..sdk\tools>monitor
..and ran install from cmd line again and saw logcat message saying package was sdk 16 / device was 15...doh!
So went back to AndroidManifest.xml and changed android:minSdkVersion to 15 and all back to normal again - install worked fine.
( Issue arose because I had installed something else which had changed the minSdkVersion and then removed the something else and never reset the minSdkVersion )
So, possibly device sdk / android version is too low for your build. If not, a look at the ADM logcat output as you initiate the install from the command line might indicate what the issue is.
Unplugging and plugging device again usually helps.
This is pretty simple: I'm using NetBeans on Linux with Android emulator 1.6. I have Logcat on my android phone, but the process of getting the messages to somewhere readable isn't smooth at all.
Can someone tell me how to get Logcat running on the emulator? Is there anything I can do to see debug messages other then having to copy the apk to my phone and testing it?
Thanks in advance!
You have a few options for viewing the debug log output, assuming you have the SDK installed and your command path set up correctly:
Type adb logcat. The log output from the connected device or running emulator will appear. I usually prefer adb logcat -v time to see the time stamps.
Type ddms. This launches the stand-alone version of DDMS. It has a logcat display at the bottom.
Install the ADT extension for Eclipse, and open the logcat view. (Since you're using NetBeans I assume this isn't what you want to do, but I'm mentioning it for completeness.)
In all cases, the interaction is the same whether you're using a physical device or software emulator, because the ADB daemon conceals the details. Whatever you're doing for the device is also expected to work for the emulator.
If you have a device and emulator connected simultaneously, you can use adb -e logcat for the emulator and adb -d logcat for the device. From stand-alone DDMS or Eclipse, just pick the device or emulator from the pop-up menu.
If you have setup nbandroid you can find the adb logcat viewer in netbeans under:
Window -> Output -> ADB Log
--edit
Just followed up on the post above and started using C:\Program Files (x86)\Android\android-sdk-windows\tools\ddms which is alot better then the one in netbeans.
The SDK comes with a handy tool called ddms it should be in the tools folder of the SDK.
At the moment an Emulator is running, or a mobile phone is connected to your machine it should show up in ddms and you can see all the log output in ddms.