Android : failed to start emulator - android

I am unable to start my android emulator in eclipse . I get hit with the following error message always
"Failed to start emulator: Cannot run program "/Users/anandmadhusoodanan/Desktop/Assignments/Spring-2012/Embedded_Systems_Programming/android-sdk-macosx//tools/emulator": error=1, Operation not permitted" where
"/Users/anandmadhusoodanan/Desktop/Assignments/Spring-2012/Embedded_Systems_Programming/android-sdk-macosx" is the path of my sdk.
I have tried re-installing the ADT plug-in, the sdk and even eclipse.
I am using Mac OS.

The # symbol indicates that there are extended attributes for the files in question. To verify the extended attributes applied to the files use:
ls -l#
You'll probably find (as I did) that there is a com.apple.quarantine attribute on the files which can be removed with:
xattr -dr com.apple.quarantine sdkFolder
Where sdkFolder should be replaced with the name of the folder you extracted the SDK to.

Check that you have execute permissions on the emulator
Try
$chmod 755 emulator

Related

adb is not recognized as an internal or exteral command error in Android studio

My application code is written and executed with no errors. However my emulator will not show up nor does my android device that's plugged in (virtualization is turned on, SDK packages are downloaded, Hyper V is not installed). I get this message from the ADB console:
adb is not recognized as an internal or exteral command, operable program or batch file.
I have tried editing the %PATH% in both system and user variables but it never works.
I am using the latest Android studio and all the tutorials and answers to my problem refer to Eclipse. At this point I am wondering if I should just abandon Android studio and take refuge in the larger Eclipse community.
Can anyone advise me how to fix it? I've been already trying a long time and I would like to finally see my application in action.
Your PATH is incorrectly setup.
For Windows :
Open up Command Prompt
and type
setx ANDROID_ADB_PATH "pathtoyoursdkplatformtools" /m
example:
setx ANDROID_ADB_PATH "C:\android-sdk-win\platform-tools" /m
Identify the exact location of your SDK. From command prompt cd to that folder and execute adb from there. if it still fails, your installation is corrupted. Delete all previous installtions of Android Studio and install fresh. If it works from adb folder , then you are making a mistake in setting up the path correctly.
set PATH=%PATH%;C:\Program Files\android-sdk-windows\platform-tools
this will only work for that particular session though.With respect to HAXM, always make sure the memory you allocate for a AVD is less than 650MB and check the Use Host GPU checkbox.
You've to set the adb.exe path location here.
You can find that, file>other setting>default project structure>{get your sdk file location}
Ex: C:\Users\Spectrum_Developer\AppData\Local\Android\Sdk
Open this path in file explorer and get into platform-tools. You can see adb.exe here.
Set this current path which is for ex. C:\Users\Spectrum_Developer\AppData\Local\Android\Sdk\platform-tools in your system environmental path variable
Restart the system.
Happy coding :-)

Failed to create sdcard in the AVD folder on Mac 10.7.5

I'm using Mac OSX 10.7.5 and I recently re-install the newest ADT 23 which version named "adt-bundle-mac-x86_64-20140624".
I removed the older version of ADT which only support to API 18 (I don't remember what the version code is it...) before install the new one.
While I completed installation, update API to 19 by SDK Manager, but I haven't updated 4.4W and API 20.
I tried to create a new emulator with the setting value on SD Card field, and then press OK.
The console panel would occurred error message:
[2014-07-09 02:44:13 - SDK Manager] Failed to create the SD card.
[2014-07-09 02:44:13 - SDK Manager] Failed to create sdcard in the AVD folder.
With the same creating steps, the problem above haven't displayed in the older version of ADT that I used before.
I tried if I don't set SD card value to create a new emulator, that can be created successfully!
I also tried to install Eclipse 4.4 Luna and the newest SDK package separately, it still has the same problem...
I'm not sure if there's any problem on my OSX or have I missed any steps of settings during installation.
Please kindly give me some suggestions to fix my problem, appreciate!
It's been 2 months since you've opened this case, so I hope that you've reached a resolution by now. I've actually experienced the same issue with creating an SD Card on my Mac 10.7.5 OS using the Eclipse ADT Bundle. When I couldn't rely on the GUI, I moved over to using the CLI for creating the sdcard using the mksdcard command located in the sdk/tools folder (ex: mksdcard 64M /tmp/sdcard.img). In doing so, I noticed that I was receiving an Illegal Instruction: 4 error. When tracking this error down further (ex: What is the "Illegal Instruction: 4" error and why does "-mmacosx-version-min=10.x" fix it?) I noticed that it's an issue with the way that the mksdcard command was compiled and that my 10.7.5 OS was not capable of executing this command.
Resolution (at least for my case):
Backup the mksdcard command in the tools folder. Example cp
mksdcard mksdcard.bak
Download a previous version of the tools that were known to work on the 10.7.5 OS (http://dl-ssl.google.com/android/repository/tools_r22.6.2-macosx.zip)
Extract the tool and copy the mksdcard command from the newly extracted folder to your Eclipse/sdk/tools folder (essentially replacing the mksdcard command that we know doesn't work).
Restart Eclipse
Create a new AVD using the AVD manager and assign a value (ex: 32M) for the sdcard
You should no longer see the failed to create sdcard error.
Resolution 2:
Update your Mac to a later version (10.8.x or above). I've tested this and have confirmed that mksdcard is working on later versions of Mac OS X without this issue.
Let me know if this resolves your issue as well.
You can try run this in shell
cd /Users/MyUserName/Library/Android/sdk/tools/
chmod +x mksdcard
Android Studio IDE on Mac os:error=13, Permission denied
in my case , i just update android Emulator.
SDK Manager -> android sdk -> sdk tools.
update Android Emulator
I think there's a bug in the GUI that's not letting you past the SD card step. You could try skipping the GUI by using the 'android' command directly. After experiencing this problem, I was able to create an AVD using this command:
$ android create avd -t 3 -n TestAVD
This uses a lot of defaults. To see options for '-t', use 'android list targets'. Take a look at the options for 'create avd' with this command:
$ android --help create avd
Hope that helps.

Eclipse throwing Permission denied Exception in Ubuntu 12.04 LTS

I am facing a problem with Ubuntu as I am new to Ubuntu.
What I have done is, Installed Eclipse Kepler and android-sdks in /home and set SDK location to /home/android/android-sdks in Eclipse (Window -> Preferences -> Android). everything is working fine. later I understood that SDK is taking too much hard disk space (nearly 6 GB) so I have copied android-sdks to /media/Softwares/android folder and deleted from /home/android.
now When updating SDK location in Eclipse to /media/Softwares/android/android-sdks, I am getting below Exception
[2013-12-11 22:38:05 - adb] Unexpected exception 'Cannot run program "/media/Softwares/android/android-sdks/platform-tools/adb": error=13, Permission denied' while attempting to get adb version from '/media/Softwares/android/android-sdks/platform-tools/adb'
please help me to solve this issue...
thanks in Advance...
You should not have put your stuff into media directory. This is where the system mounts drives. I believe '/usr' would be a more suitable place for your sdk.
if you have problems with access to some directory, navigate to it from the terminal and use 'chmod' command.
chmod 777 -R xxx (where xxx is a name of the directory you want to change access rights to) will give all possible access rights to all users

How to start Android AOSP emulator on MAC

I have downloaded and compiled Android source code per instructions on Android source website (http://source.android.com/source/building.html)
I chose
$ lunch full-eng
an emulator engineering build and everything has compiled just fine.
Then it says to launch the image inside an emulator just type:
The emulator is added to your path automatically by the build process. To run the emulator, type
$ emulator
Well, not sure it is added to the path. Typing emulator does not do anything.
However if I go to
out/host/darwin-x86/bin/emulator
emulator: ERROR: You did not specify a virtual device name, and the system
directory could not be found.
If you are an Android SDK user, please use '#<name>' or '-avd <name>'
to start a given virtual device (see -help-avd for details).
So I am confused ... at this point do I have to create an AVD ?
How do I create an AVD for this image exactly ?
Has anyone done this on MAC can they supply me with some instructions ?
Thanks
I'm not sure if there is any difference on osx, but it is a common error on Linux. After you build the whole AOSP, the building process will add the <AndroidBase>/out/host/<host-arch>/bin/emulator into the PATH, but after you restart your computer or open another session, emulator will no longer be in the path.
To fix the "You did not specify a virtual device name, and the system
directory could not be found" error, you can explicitly set ANDROID_PRODUCT_OUT to point to your disk image directory. In general, the disk image directory would be <AndroidBase>/out/target/product/generic. So
$export ANDROID_PRODUCT_OUT=<ANDROID BASEDIR>/out/target/product/generic/
would help.
Actually, you can run
. build/envsetup.sh
setpaths
It will do a similar work for you.
I build with aosp_x86_64-eng and have verified that the following will launch the emulator in a new terminal window:
cd /[your AOSP WORKING_DIRECTORY]
source build/envsetup.sh
lunch aosp_x86_64-eng
cd $ANDROID_PRODUCT_OUT
emulator

Unable to run Android Virtual Device Manager "android avd" getting NullPointerException

Getting NullPointerException when trying to start avd. I just downloaded the ADT bundle for Mac and ran android avd. Anyone know why it would fail?
$ ./android avd
java.lang.NullPointerException
at com.android.sdklib.internal.avd.AvdInfo.getDeviceName(AvdInfo.java:158)
at com.android.sdkuilib.internal.repository.ui.DeviceManagerPage.fillDevices(DeviceManagerPage.java:497)
at com.android.sdkuilib.internal.repository.ui.DeviceManagerPage.fillTable(DeviceManagerPage.java:357)
at com.android.sdkuilib.internal.repository.ui.DeviceManagerPage.createContents(DeviceManagerPage.java:259)
at com.android.sdkuilib.internal.repository.ui.DeviceManagerPage.<init>(DeviceManagerPage.java:130)
at com.android.sdkuilib.internal.repository.ui.AvdManagerWindowImpl1.createDeviceTab(AvdManagerWindowImpl1.java:210)
at com.android.sdkuilib.internal.repository.ui.AvdManagerWindowImpl1.createContents(AvdManagerWindowImpl1.java:193)
at com.android.sdkuilib.internal.repository.ui.AvdManagerWindowImpl1.open(AvdManagerWindowImpl1.java:133)
at com.android.sdkuilib.repository.AvdManagerWindow.open(AvdManagerWindow.java:94)
at com.android.sdkmanager.Main.showAvdManagerWindow(Main.java:369)
at com.android.sdkmanager.Main.doAction(Main.java:311)
at com.android.sdkmanager.Main.run(Main.java:119)
at com.android.sdkmanager.Main.main(Main.java:102)
The following worked for me:
From the command line I navigated to the tools folder of the Android-SDK folder. From there I ran this command:
android list avd
This produced a list of all of my virtual devices but one of them showed itself to be the problem. The exact output was as follows:
The following Android Virtual Devices could not be loaded:
Name: Tab31
Path: /Users/User/.android/avd/Tab31.avd
Error: Failed to parse properties from /Users/User/.android/avd/Tab31.avd/config.iniere
If you see this then make note of the "Name" property ("Tab31" in my situation) and run the following command (obviously replacing the name of my AVD with yours):
android delete avd -n Tab31
After that I was able to start the AVD Manager without any problem.
I had this exact same problem last night and finally found the ways to get the emulator to start working:
List the available targets with: android list targets
android create avd -n {name} -t {targetID}
(for {name} I chose Tablet - believe its arbitrary)
== Still wasn't working but then I discovered =>
I right-clicked above the manifest.xml file, selected option Run As ->
Run Configurations -> on a tab Target, and selected AVD created.
(from Eclipse launch error when trying to run an Android app)
If nothing of the above solutions work, deleting the .android folder in the home directory will work
I had this same problem after moving around my Android SDK and changing the base directory by setting the environment variable ANDROID_SDK_HOME. Turns out there is a path inside of the following file (path below ANDROID_SDK_HOME).
.android/avd/nameofphone.ini
The "path=" setting in that file is absolute, so if you move around your files it will not be correct anymore. Changing that to the correct absolute path to the avd-file in the same directory fixed my issue.
It's usually because creation of a new AVD failed or the configs for one of your AVDs is corrupted.
Go to ~/.android/avd
Check the list of AVDs. If you think one of those AVDs is causing the problems, sudo rm -r (UNIQUE PART OF AVD NAME)*
This removes that AVD. Then re-try android avd
#BreakingBad's solution works fine except when the config is corrupted
It looks like this issue has been fixed in version 21.0.1 preview 1 of the SDK Tools.
http://code.google.com/p/android/issues/detail?id=40400
The most likely cause is an invalid properties file that could not be parsed by the AVD Manager. Updating to the Preview Channel of the SDK Tools should fix this, or you can just wait for the official release.
Once I updated, the AVD Manager started and showed an invalid AVD in my list, which I was able to delete.

Categories

Resources