I am the beginner for android development. I followed the procedure as specified in developer.google.com . for installing I Tried to create AVD(Android virtual device) through command path. I executed at command prompt.
android create avd --target 2 --name my_avd
But the Error is coming "Error: Target id is not valid. Use 'android.bat list targets' to get the target ids."
After executing android.bat list targets is showing blank. I am not able to figure out the problem as I have already set the path also.
THe problem is resolved. windows by default is not loading api for android virtual device. we need to manually start the downloading of those. follow this procedure:
go to android List item sdk folder which u have extracted. to the tools folder
un android batch file a api would be loaded. Here go to settings and mark "Force https to fetch from http".
Then go to availabe packages and amrk the link provided and install it.
after following this procedure all the above specified errors would be resolved.
I think you use "android create avd -n xxx -t 2" to create AVD, and use "android.bat list targets" to find the creation result.
You should use "android list avds" to list AVD. Targets is different from virtual devices.
You may have no targets installed. Check available packages in sdk manager and install some.
As per dtmilano, install some packages [images of the different Android OS versions]. This is an easy step to miss.
FYI: here are the end-to-end steps for installing an app on the emulator using the cmd line tools on MacOS (I assume win64 is equivalent):
http://richardboardman.com/2011/07/100-days-of-tech-day-1-android-dev-tools/
Related
While trying to test the android app am creating with React native, I run into this error
info Launching emulator...
error Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`.
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
I have the emulator(the AMD version) installed in the android studio.
How can I solve this problem
In your scenario before running react native application you need to create emulator using Android Studio. You can view official documentation about running application on device by here
Before running your project make sure you have installed adb drivers - More
First of all create AVD using Android Studio.
Open your project android folder using Android Studio.
1. Click AVD Manager from Android Studio
2. Click Create Virtual Device
3. Select your device from device list and click Next
4. Select the android os version from the available version list and click Next
5. On last keep default settings on device and click Finish
After that you can see your available android emulator device list from AVD Manager window.
* Before run your react native application make sure you have turn on and run the android emulator from android studio
After that run your project using react-native run-android
You can run the command adb devices to check if there is any device attached. It should list atleast one device for it to work
This also may be there is not enough space to run avd, make sure enoug space in hard disk. in my case freed atlest 9gb.
My answer is, If you have changed the directory of avds, you should set ANDROID_SDK_HOME environment variable to the parent directory of .android.
Here is the detail:
It seems like when you run "emulator -list-avds" in cmd, the result is empty. (be sure to first add "ANDROID_HOME" with value of your sdk directory to your user environment variable, and "%ANDROID_HOME%\emulator" in the Path too.)
After checking the official documents:
https://developer.android.com/studio/run/emulator-commandline#starting
It said:
"$ emulator -list-avds
When you use this option, it displays a list of AVD names from your Android home directory. Note that you can override the default home directory by setting the ANDROID_SDK_HOME environment variable: the root of the user-specific directory where all configuration and AVD content is stored. You could set the environment variable in the terminal window before launching a virtual device, or you could set it through your user settings in the operating system."
and in another page:
https://developer.android.com/studio/command-line/variables#envar
it said:
"Some older tools, such as Android Studio 4.3 and below, do not read ANDROID_USER_HOME. To override the user preferences location for those older tools set ANDROID_SDK_HOME to the parent directory you would like the .android directory to be created under."
So I guess the reason is "npx react-native run-android" will invoke "emulator -list-avds" to find the emulator. And "emulator" is really an older tools, so ANDROID_SDK_HOME environment variable is necessay.
And if all goes well, you really don't need to run android studio before run "npx reactive-native run-android".
How do you install an apk on the emulator in Android Studio from the terminal?
In Eclipse we did
/home/pcname/android-sdks/platform-tools/adb -s emulator-5554 install /home/pcname/Downloads/apkname.apk
Now how about in Android Studio?
Run simulator -> drag and drop yourApp.apk into simulator screen.
Thats all.
No commands.
EDIT: Even though this answer is marked as the correct answer (in 2013), currently, as answered by #user2511630 below, you can drag-n-drop apk files directly into the emulator to install them.
Original Answer:
You can install .apk files to emulator regardless of what you are using (Eclipse or Android Studio)
here's what I always do: (For full beginners)
1- Run the emulator, and wait until it's completely started.
2- Go to your sdk installation folder then go to platform-tools (you should see an executable called adb.exe)
3- create a new file and call it run.bat, edit the file with notepad and write CMD in it and save it.
4- copy your desired apk to the same folder
5- now open run.bat and write adb install "your_apk_file.apk"
6- wait until the installation is complete
7- voila your apk is installed to your emulator.
Note: to re-install the application if it already existe use adb install -r "your_apk_file.apk"
sorry for the detailed instruction as I said for full beginners
Hope this help.
Regards,
Tarek
For those using Mac and you get a command not found error, what you need to do is
type
./adb install "yourapk.apk"
Start your Emulator from Android Studio Tools->Android-> AVD Manager then select an emulator image and start it.
After emulator is started just drag and drop the APK Very simple.
Just drag APK file to android emulator it will install automatically.
In android studio emulator to run an apk file just drag the apk into the emulator.The emulator will install the apk
Much easier is just to start your emulator, then go to sdk/platform-tools and use adb from there to install apk. Like:
adb install xxx.apk
It will install it on running emulator.
Drag and drop apk if the emulator is launched from Android Studio. If the emulator is started from command line, drag and drop doesn't work, but #Tarek K. Ajaj instructions (above) work.
Note: Installed app won't automatically appear on the home screen, it is in the apps container - the dotted grid icon. It can be dragged from there to the home screen.
For Linux: once emulator is running, the following worked for me.
Because I installed the Android SDK on my home directory, I have the following file structure:
home/Android/Sdk/platform-tools/adb
home/AndroidStudioProjects/Metronome.adk
AndroidStudioProjects is a file folder I made for my Android projects. "Metronome.adk" is the file I want to run.
So, using Terminal from the home directory...
./Android/Sdk/platform-tools/adb install ./AndroidStudioProjects/Metronome.adk
Being a Linux novice, I often forget the need to put the "./" in when trying to locate a file or run a command.
After the command achieves "Success", the app is in the Apps area of the emulator and can be run.
When you start Android studio Look for Profile or Debug apk.
After clicking you get the option to browse for the saved apk and you will be able to later run it using emulator
If Android Studio is already open:
Click on File you can find Profile or Debug apk in this menu too
Just download the apk from talkback website
Drag the downloaded apk to the started emulator, Go to settings on emulator > Search for talkback, you will now find it there
1.Install Android studio.
2.Launch AVD Manager
3.Verify environment variable in set properly based on OS(.bash_profile in mac and environment Variable in windows)
4. launch emulator
5. verify via adb devices command.
6.use adb install apkFileName.apk
Upload your apk file on the cloud , then make a direct download link for downloading and then copy that link and paste it on the emulator browser for download it :) ;
In Android Studio: View - Tool Windows - Gradle
In the Gradle tool window navigate to your :app - Tasks - install
and then execute (by double-clicking): any of your install*tasks: e.g. installDebug, installRelease
Note: the apk will also automatically installed when you Run your application
I've tried every possible way I can think of and followed every forum list I can find, still to no avail. I'm trying to get the Android SDK to be recognized by TitaniumStudio. I installed in by going through the folders and running it that way, I've tried the command line option, I've installed it through Eclipse (which it works in) but TitaniumStudio STILL will not recognize it. I've reinstalled TitaniumStudio, that didn't work.
Key Points:
Everything is up to date
I'm working on Mac OSX 10.6.8
I know of Terminal and what it can do, but don't know Unix commands
The above is probably significant because somewhere in a forum someone mentioned changing the PATH for the sdk to read the /tools and /platform-tools folders using the /.bash_profile (I think that's what it's called, correct me if I'm wrong there) but when I tried to run the command via terminal to create an AVD (android create avd -n android_sdk -t 2 (android_sdk being the AVD name and 2 to point to the android-4 platform)), i get the following error:
-bash: android: command not found
Please help me with some insight into this "-bash" and what that is and how to fix this annoying problem! >.<
EDIT: I've gotten it to a point where I now get the following error when I try to send (android create avd -n android_sdk -t 2) through terminal:
Valid ABIs: no ABIs.
Error: This platform has more than one ABI. Please specify one using --abi.
What the heck does that mean and what's an ABI?? o.O
Run tools/android, It'll fire up a "Android SDK Manager" where you would see various platforms listed and the ABI's for those platforms underneath them. For example when I fire up my "Android SDK Manager", I see Android 4.0 (API 14) and then underneath it is "ARM EABI v7a System Image". Check this package and install it. Confirm that ABI's are indeed listed by running the command "android list targets".
Remember to start a new terminal when you are making changes to .bash_profile or .bashrc files. Failing to do so, would lead to errors like you are experiencing because the changes isn't loaded in, and the new PATHs and all the programs there isn't available to you.
With that being said, you need to add the folder with binary programs to your path, you can verify that the path is loaded in with the following command:
echo $PATH
Which gives me this on Snow Leopard:
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
Setting a path can be difficult in OSX because it seems like they have changed this behavior quite a bit between releases.
Look here for a more detailed answer about setting path variables: https://superuser.com/questions/69130/where-does-path-get-set-in-os-x-10-6-snow-leopard
There is also a description here on how to get Snow Leopard to read the user supplied .bashrc in the home-dir: http://kaspergrubbe.dk/2011/enable-bashrc-on-osx-snow-leopard-and-lion/
I've just installed Eclipse with fresh Android SDK and ADT on Windows 7 x64 Professional. I've created an emulator and tried to start it, but starting fails with this message:
invalid command-line parameter: Files.
Hint: use '#foo' to launch a virtual device named 'foo'.
please use -help for more information
When I create another emulator, it also fails to start with the same message. Can anyone provide a solution? Thanks in advance.
Change the path of Android SDK to make sure it has no spaces, for example use Progra~1 instead of Program Files.
Don't use a path that contains withespace for the SDK installation.
You can also try from command line:
emulator #foo
considering that your PATH includes the SDK installation directory.
I have installed Android SDK on my MAC OS X 10.6 and facing lots of problem while creating AVD.
When I tried to create it for ECLIPSE (3.5 Gallelio) then after clicking the 'new' button, when I try to type a name there comes a message bellow saying 'a target must be selected in order to create an AVD'. But the problem is, the Target field is deactivated.
If I'm trying to create AVD from terminal with the command './android avd --target 2 --name my_avd' it shows an error saying 'Error: Expected verb after global parameters but found 'avd' instead.'
I don't understand what to do right now. Can anybody help me in this regard please??
Thanks
First you have to specify the Android SDK installation folder to the Eclipse Android plugin. Go to Preferences -> Android and set it. After that you have to install the target versions you want to develop against.
Go to AVD Manager -> Available Packages and download the targets that you need. After that you should be able to create your AVD. If you still have problems, try restarting Eclipse because that solved some issues for me a number of times.
If you still have problems try reading the Troubleshooting Tips.
You have the command line wrong. You need to add create to it. Try the following:
android create avd --target 2 --name my_avd