I am trying to run a Processing sketch on Android emulator. I get the following error-
debug:
Unhappy inside exists()
D:\android-sdks\tools\android.bat list avds
status: 1
375ms
stdout:
stderr:
D:\android-sdks\tools\android.bat create avd -n Processing-0215 -t android-10 -c 64M -s WVGA800
status: 1
308ms
stdout:
stderr:
at bottom of ensure proper
I tried running android.bat separately and that won't run either. But AVD Manager runs fine. I can create, run and delete emulators using AVD Manager.
Is it a problem with Android SDK installation or Processing?
How do i fix this?
Operating System: Windows 7 (64-bit)
Processing: 2.0b7
Android SDK: API level 10
EDIT:
Running android.bat gives me this-
ERROR: No suitable Java found. In order to properly use the Android Developer
Tools, you need a suitable version of Java JDK installed on your system.
We recommend that you install the JDK version of JavaSE, available here:
http://www.oracle.com/technetwork/java/javase/downloads
You can find the complete Android SDK requirements here:
http://developer.android.com/sdk/requirements.html
I'm perplexed by the fact that AVD Manager runs but android.bat doesn't.
Related
Prerequisite
Android SDK is well installed (directory : /Users/gamecube/Library/Android/sdk)
How to reproduce :
Run this command : cordova build android
Run this command to launch android emulator : cordova emulate android --verbose
Expected result
The emulator is launched.
Obtained result
Command finished with error code 0: /Users/gamecube/Desktop/geocars/platforms/android/gradlew cdvBuildDebug,-b,/Users/gamecube/Desktop/geocars/platforms/android/build.gradle
Built the following apk(s):
/Users/gamecube/Desktop/geocars/platforms/android/app/build/outputs/apk/debug/app-debug.apk
No scripts found for hook "before_deploy".
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=/Users/gamecube/Library/Android/sdk (DEPRECATED)
Running command: adb devices
Command finished with error code 0: adb devices
Could not find either `android` or `avdmanager` on your $PATH! Are you sure the Android SDK is installed and available?
CordovaError: Could not find either `android` or `avdmanager` on your $PATH! Are you sure the Android SDK is installed and available?
at /Users/gamecube/Desktop/geocars/platforms/android/cordova/lib/emulator.js:176:35
at processTicksAndRejections (internal/process/task_queues.js:97:5)
My questions
Why Android Emulator does not work?
and
Why is there this error? :
CordovaError: Could not find either `android` or `avdmanager` on your $PATH! Are you sure the Android SDK is installed and available?
I solved my problem.
How did I do it?
I opened Android Studio, and went to the SDK Manager.
I clicked on the SDK Tools tab, and in the list displayed, I checked: Android SDK Command-line Tools (latest)
I then clicked on Apply (then OK on the pop-up) to download the package in question.
I added the path of avdmanager to PATH in my .bash_profile
I have run source ~ / .bash_profile to refresh
And I launched my command: cordova emulate android --verbose successfully since the emulator has opened well.
Without Android Studio, merely with Android Command Line Tools from Android SDK. Be sure these Android Command Line Tools (such as sdkmanager or avdmanager) are in the PATH, otherwise run them using the full path (for Debian/Ubuntu see this to install Android SDK).
Install the emulador
sdkmanager --install "emulator"
Install the platforms, example for Android API 32 and 33 (Android 12 and 13 respectively):
sdkmanager --install "system-images;android-32;google_apis;x86_64"
sdkmanager --install "system-images;android-33;google_apis;x86_64"
Create the Android Virtual Device (AVD), example:
avdmanager create avd -n emulator32 -k "system-images;android-32;google_apis;x86_64"
Confirm that was installed
avdmanager list avd
Run
cordova emulate android --target=emulator32
I am trying to install and run an Android Virtual Device from the command line on Windows (without Android Studio). I have set up an Android SDK in C:\Android, and successfully created an AVD with the command:
avdmanager create avd -n test -k "system-images;android-26;google_apis_playstore;x86" --abi google_apis_playstore/x86
I have environment variable ANDROID_SDK_ROOT set to C:\Android.
When I try to start the emulator from the command line with:
emulator #test
I get errors:
emulator: ERROR: can't find SDK installation directory
emulator: could not find virtual device named 'test'
I have also tried setting environment variables ANDROID_AVD_HOME and ANDROID_EMULATOR_HOME, and also tried running the AVD specifying sysdir and datadir with the command:
emulator #test -sysdir C:\Android\system-images\android-26\google_apis_playstore\x86 -datadir C:\Android\avd
but I get the same errors.
When I run command avdmanager.bat list avd, I get:
Name: test
Path: C:\Android\avd\test.avd
Target: Google Play (Google Inc.)
Based on: Android API 26 Tag/ABI: google_apis_playstore/x86
Why on earth can't I run the AVD?
I found the problem. Because I was trying to do a minimal Android SDK install via the command line, I did not yet have a platform-tools folder. Not being able to find the platform-tools folder was causing the emulator to display the unhelpful error "can't find SDK installation directory", which really meant "can't find the platform-tools directory".
Once I installed the platform-tools folder with sdkmanager --no_https "platform-tools", the emulator worked. I need --no_https because I'm in a crippled corporate environment.
For future reference, I installed the emulator dependencies (after unzipping sdk-tools-windows-3859397.zip from here) with:
sdkmanager --no_https "system-images;android-26;google_apis_playstore;x86" "platforms;android-26" "platform-tools" "emulator"
With the package "platform-tools", it may also required to install "platforms;android-26" for your Android 26.
Using sdkmanager.bat platforms;android-30 --sdk_root=C:\your_avd_sdk_root to install it.
If still not working, try to run command below:
set PATH=%PATH%;%ANDROID_SDK_ROOT%\emulator
set PATH=%PATH%;%ANDROID_SDK_ROOT%\emulator\bin64
set PATH=%PATH%;%ANDROID_SDK_ROOT%\platform-tools
set PATH=%PATH%;%ANDROID_SDK_ROOT%\cmdline-tools\latest\bin
I'm trying to make my environment work with Cordova and Android emulator with no success. I have installed the Android Studio and I can successfully start the Android Emulator.
I have created a cordova application with the command below:
cordova create myApp
I added support for the Android platform:
cordova plataform add android
I had the following output:
Using cordova-fetch for cordova-android#~6.2.2
Adding android project...
Creating Cordova project for the Android platform:
Path: platforms\android
Package: io.cordova.hellocordova
Name: HelloCordova
Activity: MainActivity
Android target: android-25
Subproject Path: CordovaLib
Android project created with cordova-android#6.2.3
Installing "cordova-plugin-whitelist" for android
This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do *not* need this plugin since the whitelist will be built in.
--save flag or autosave detected
Saving android#~6.2.3 into config.xml file ...
Then I try to run the application:
cordova run android
The emulator starts, after a while, that I have the error below in the command prompt:
No target specified and no devices found, deploying to emulator
No emulator specified, defaulting to Nexus_5X_API_24
Waiting for emulator to start...
Error: Failed to execute shell command "getprop,dev.bootcomplete"" on device:
Error: C:\Users\username\AppData\Local\Android\sdk\platform-tools\adb.exe: Command failed with exit code 3221226356
Does anyone knows how to fix this error?
Some others environment info:
C:\>node -v
v7.4.0
C:\>cordova -v
7.0.1
C:\>java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
Edit 1
I have done those steps:
Uninstalled "Android SDK Tools"
Uninstalled "Android Studio"
Deleted files from "C:\Users\USER\AppData\Local\Android\sdk" and "C:\Program Files\Android\Android Studio" files (Because some maybe in use during the uninstallation)
Installed Android Studio
Updated Android Studio
When I execute the command below, I have more information about the error:
cordova run android --verbose
With this output:
Command finished with error code 3221226356:
C:\Users\USER\AppData\Local\Android\sdk\platform-tools\adb.exe
-s,emulator-5584,shell,cat,/proc/cpuinfo Error: Failed to execute shell command "cat,/proc/cpuinfo"" on device: Error:
C:\Users\USER\AppData\Local\Android\sdk\platform-tools\adb.exe:Command
failed with exit code 3221226356
When I execute the command below, the adb shows the emulator cpu info, after that, the process stops and the windows ask to break or debug
adb -s emulator-5584 shell cat /proc/cpuinfo
Downgrade your SDK platform-tools to rev25.0.1.
If you dev in windows, you can download it in https://dl-ssl.google.com/android/repository/platform-tools_r25.0.1-windows.zip
delete or rename your old platform-tools folder, and extract the downloaded file to it.
Works for me!
I encountered the same issue with an emulator of Nexus5 & Oreo/Nougat.
I changed my emulator to Galaxy Nexus & Lollipop and it worked fine without any modification in the Cordova directories.
It does not seem to be the right solution, but some lower combinations might be available for avoiding this issue.
The command line is:
$ cordova emulate android
The following is the success log:
No emulator specified, defaulting to Galaxy_Nexus_API_22
Waiting for emulator to start...
emulator: Requested console port 5584: Inferring adb port 5585.
emulator: WARNING: encryption is off
path /home/ximia/.android/avd/Galaxy_Nexus_API_22.avd/system.img.qcow2
Waiting for emulator to boot (this may take a while)...BOOT COMPLETE
Edit your virtual device (ADV) and go into advanced settings and uncheck Multi-Core CPU.
Work fine to me.
I have a Jeknins installation on my local PC. I'm successfully able to integrate Android application code with github and generate .apk file as an artifact.
The problem is in the test case execution. I cannot get the Android emulator to start.
It says:
\sdk/tools/android.bat" create avd -f -a -c 500M -s 480x640 -n hudson_en-US_480_480x640_android-21_armeabi-v7a -t android-21 --abi armeabi-v7a
[android] Could not create Android emulator: Failed to parse AVD config file
Recording test result.
I have already tried this:
Could not create Android emulator: Failed to parse AVD config file
Also, I ran the same create command from command line and it successfully craeted the AVD.
Not a complete answer, but it seems that the andoid Sdk update that came out recently - SDK Tools, Revision 25.3.0 (March 2017) - has made some significant changes.
The Android emulator jenkins plugin uses the android command (/home/jenkins/Android/Sdk/tools/android), but if I copy the commands from the console output and try and run that from the command line on the Jenkins machine I get:
[android] /home/jenkins/Android/Sdk/tools/android create avd -f -a -s HVGA -n hudson_en-US_120_HVGA_7.02 -t 7.02
[android] Could not create Android emulator: Failed to parse AVD config file
and try and run that from the command line on the Jenkins machine I get:
The android command is no longer available.
For manual SDK and AVD management, please use Android Studio.
For command-line tools, use tools/bin/sdkmanager and tools/bin/avdmanager
So it seems that from 25.3.0 onwards, the 'android' command is deprecated and has been removed, but the emulator plugin hasn't been updated to reflect this.
As a solution, the best bet seems to be to install an earlier version of the android Sdk that still supports the 'android' command, at least until the plugin is updated.
Try leaving the sdcard field empty.
I ran the command that the android plugin printed out via a shell script and added -v (for verbose) after android.
I then saw that the problem was that it could not create an sdcard.
When not filling in an sdcard size, it worked.
I am trying to run android emulator on my linux headless machine. I install android sdk, required platofrms and so on. I already created android avd using following command
android create avd -n TestDevice4.4.2 -t 17 ( 17 is id of from targets list )
Now i try to start emulator by following command
emulator -avd TestDevice4.4.2 -no-skin -no-window
And i got the following error on my terminal.
/home/ubuntu/sdk-android/tools/emulator64-arm: error while loading
shared libraries: libGL.so.1: cannot open shared object file: No such
file or directory
Since it is the first time setting up from termial in headless linux machine, i faced several issues. I can't figure out what's going on with this one. Appreciate your help :-)
EDITED
I've seen similar issues here. I had to install following library and create symbolink in sdk/tools/lib dir.
sudo apt-get install libgl1-mesa-dev
ln -s /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1.2.0 libGL.so
After done these steps, i start emulator again. i got following problem :-(
sh: 1: glxinfo: not found emulator:
ERROR: This AVD's configuration is
missing a kernel file!! emulator: ERROR: ANDROID_SDK_ROOT is undefined
For each version of Android you want to run, install at least:
1) Platform SDK (eg 17 for 4.2 version)
2) A system image for the emulator (eg ARM EABI v7a System Image )
bye