I have added a second Virtual Device to test a different screen resolution (QVGA), but now I wanna switch back to the first AVD (HVGA) again. How can I set the virtual device in Eclipse to be used by default or even specifically for my project? In the properties I can only set the API level.
I also couldn't find any information in the command line tool documentation to set this manually.
In Eclipse, click on Run in the toolbar then Run Configurations. Select your application and click on the Target tag. You can then select which AVD to use or set it to manual so it asks you each time you run the app.
Note that if the AVD's Android version is lower than the Minimum API level set in the Manifest, the AVD will not appear in the list.
In AndroidManifest.xml, see that your minSdkVersion and targetSdkVersion match your device.
In new Eclipse Kepler version, right click your project, then click Run as->Run Configurations->"Target" tab, you will see all AVDs in the list, select one as a preferred one, then "Apply" and "Run"
Related
I've followed all the instructions at http://developer.android.com/training/basics/firstapp/running-app.html to make a "hello world" app, but despite everything I try, nothing is happening on my device.
I've installed Samsung Kies for what it's worth, and my phone is detected by the OS for file transfer... but when I "Run As - Android Application" in Eclipse, nothing happens at all.
USB debugging is on for my phone.
Edit (June 7, 2013):
I've removed my old installation of Eclipse and the android SDK and downloaded the bundle from http://developer.android.com/sdk/index.html. Still nothing will happen when I try to run as Android Aplication.
I've run adb devices and I get the following output, so I guess my phone is detected:
List of devices attached
42f78b1517259fe5 device
I managed to find a way to add a device to Eclipse, as Galaxy Note 2 wasn't in the dropdown box... but that doesn't seem to do anything other than change the preview image in the activity editor.
I'm not sure if I did it right, but here's the logcat -d dump as suggested
http://pastebin.com/fmrPn3UU
My phone is running 4.1.2. I don't know what else to try, and I can't seem to find out anything else online.
Try forcing Eclipse to prompt you for a device to choose. See if it still does nothing, or if it actually runs.
To allow Eclipse to prompt you:
Open the Run menu > Run configurations
Within the new window, under the Android Application
If you have any configuration, delete the configuration
Create a new configuration by double clicking Android Application or clicking the New button.
Under the Android tab
Select your Android app project within the Project box
Launch action should be Launch Default Activity
Next, open the Target tab
Select Always prompt to pick device
Click Apply
Click Close
Now the next time you run your application, it will ask you to start your application in your phone or an emulator.
If you want to use the same one for the duration of your eclipse session, or until you've unplugged your phone, check the Use same device for future launches box.
This also has the added benefit of allowing you to choose different AVD versions to test your app on different devices or emulators easier.
Update from comments
To force stop your app if completely necessary
Go to the DDMS perspective within Eclipse
Window > Open Perspective > DDMS (it's it not listed, click Other...)
Click your process such as com.example.testapp
Click the Stop button (red stop sign)
I think your question is
Q: "Should I be able to run and debug my Android application on a physical handset, not just the emulator?"
A: Yes, absolutely. Including your Galaxy Note 2
Look here:
http://developer.android.com/tools/device.html
This is basically exactly the same, except it gives details specifically for the Galaxy Note:
http://www.technipages.com/samsung-galaxy-note2-how-to-enable-usb-debugging.html
BOTTOM LINE:
You should be able to debug using either/both an emulator and/or a physical handset, all from your Eclipse IDE.
'Hope that helps..
Try using the Galaxy Note 2 toolkit from XDA and installing the drivers that way, then manually set up your device in Eclipse.
Try looking at your AndroidManifest.xml file in your Android project. I believe your note 2 is running Android 4.1.2 (which is revision 16).
If your Hello World application has the minimum SDK version requirement set to be 17 or higher, your device will not be recognized on the available devices. Change android:minSdkVersion attribute in uses-sdk tag to android:minSdkVersion="16" and it will be displayed.
In 'USB PC connection' in the floating menu there are two options. In my cell was labeled 'Media Device' and I switched to 'Camera' and started to work.
I got the same problem. I am using MAC. I downloaded Eclipse(Java Standard 4.4) first and then installed ADT from eclipse manually. My code works and it can only run in emulator. It cannot find the Note2. I install Android Studio and it works with my Note2. Tried many methods but my eclipse cannot find my Note2. so I download the Android ADT from android.com directly and it works with my Note2. Since we can have two Eclipse on one computer, so it you can keep both Eclipse like me. One for PHP and one for Android. If you have the same problem, please try it.
I have installed Android SDK on my Ubuntu 11.04. I have run a common ./android to install. It was expected to see some options like "Available packages" to install android packages. But I haven't seen any options. After that have configured SDK Location path in Preferences in Eclipse I didn't get any SDK targets. When I open AVD Manager in Eclipse, it says "no AVD available". Could you please let me know how can I configure AVDs in my Eclipse?
To configure a basic Android Virtual Device (AVD)
Open Eclipse and select Window > Android SDK and AVD Manager.
In the resulting window, select Virtual Devices in the left panel and click the New button on the right. This launches a new window to configure an AVD.In the first blank of this new window, give the device a name of your choice. Let's choose Simple2.2, indicating that this will be a relatively minimal device running Android 2.2.
Under the Target dropdown, select Android 2.2 - API Level 8.
Under SD Card enter 1024 for Size and be sure that the MiB dropdown is selected.
For Skin select Built-In and Default (HGVA).
Leave everything else as is and click Create AVD.
After a while (be patient, it may take a minute or so) this should create a new AVD with the characteristics specified that will appear in the list if Virtual Devices is selected in the left panel.
You might prefer a different configuration, but the one described above is considered optimal.
I've upgraded the SDK tools to revision 20 (from 18) and since the upgrade, the emulator doesn't seem to accept input from laptop's keyboard. But only using the emulator's own 'soft' keyboard (that appears when an input field is focused).
I've tried reinstalling the SDK tools (and the whole SDK for that matter), uninstalled and reinstalled Eclipse Android plugins, re-created emulator devices. But none of that seem to help and its driving me mad. Its hopeless to key-in using a laptop's trackpad.
Has anyone encountered this problem?
Update
As of SDK rev 21 the Android Virtual Device Manager has an improved UI which resolves this issue. I have highlighted some of the more important configuration settings below:
If you notice that the soft (screen-based) main keys Back, Home, etc. are missing from your emulator you can set hw.mainKeys=no to enable them.
Original answer
Even though the developer documentation says keyboard support is enabled by default it doesn't seem to be that way in SDK rev 20. I explicitly enabled keyboard support in my emulator's config.ini file and that worked!
Add: hw.keyboard=yes
To: ~/.android/avd/<emulator-device-name>.avd/config.ini
Similarly, add hw.dPad=yes if you wish to use the arrow-keys to navigate the application list.
Reference: http://developer.android.com/tools/devices/managing-avds-cmdline.html#hardwareopts
On Mac OS and Linux you can edit all of your emulator configurations with one Terminal command:
for f in ~/.android/avd/*.avd/config.ini; do echo 'hw.keyboard=yes' >> "$f"; done
On a related note, if your tablet emulator is missing the BACK/HOME buttons, try selecting WXGA800 as the Built-in skin in the AVD editor:
Or by manually setting the skin in config.ini:
skin.name=WXGA800
skin.path=platforms/android-16/skins/WXGA800
(example is for API 16)
Confirmed. I had the same problem after upgrading to Tools version 20. I had to Edit the AVD to add an option as follows:
From Eclipse, Go to AVD Mananger.
Select the particular AVD and click on Edit
Go to the Hardware section, click on New.
Select the Property Name : Keyboard Support
By default, it is added with a value of 'no'. Just click on the value column and change it to 'yes'.
Click on Edit AVD again.
This will add a property hw.keyboard=yes in config.ini file for the AVD.
You also have to set hw.mainKeys = yes
In Android Studio, open AVD Manager (Tools > Android > AVD Manager).
Tap the Edit button of the emulator:
Select "Show Advanced Settings"
Check "Enable keyboard input"
Click Finish and start the emulator to enjoy the keyboard input.
Look in AVD Manager, select the AVD and click in Edit. In Hardware section: click in "New" and search for "Keyboard support" and add with OK button and set the value to "yes" and save changes with "Edit AVD"
Google wanted to give some more headache to the developers.
So, what you have to do now is edit your AVD and add "Keyboard Support" for it in the Hardware section and change the value to "Yes"
Add the following line
hw.keyboard=yes
to your AVD config file
~/.android/avd/<avd_folder>/config.ini
Restarting the emulator helps sometimes when typing is unavailable - despite keyboard input being enabled for your Android Virtual Device.
Just in case somebody finds it usefull.
I had a problem with the KEYCODE_DPAD_UP it belongs to the trackBall. to solve this change your avdfolder/config.ini hw.trackBall=yes and push DEL or F6
Here is some workaround that actually worked for me, it is the same solution as in the most popular answer - just
add hw.keyboard=yes to config.ini
but since this didn't work for me I additionally
renamed config.ini (any name will do) to something like consssssfig.ini
restarted emulator (obviously it didn't start)
renamed config.ini back again
(I am not sure if relevant) I added this new parameter (hw.keyboard=yes) at the beggining of config.ini file
Sometimes computer keyboard stops working on android emulator. Today I've noticed, that after pushing this button (that I marked with red arrow), keyboard starts working again (seems to be some issues with emulator window focus)
Look for the hidden .android folder in your user home folder. You might rename or delete this folder, recreate your AVD, and restart the emulator. It could be there is a .ini file in that folder that has that setting munged.
Recreating an AVD with the Hardware Keyboard + setting the boolean to true was the only solution that worked for me; the other two main solutions (terminal or editing an existing AVD via GUI) both resulted in software/emulator crashes on my Mac. Making a new AVD resulted in the keyboard working just fine.
I have used an emulator for API Level 23, which does not take keyboard input for installed apk.
So I have created new emulator for API Level 29, and then it works.
Following is the step to install new emulator.
Open "Android Virtual Device Manager"
Create new Virtual Device.
When you select a system image, please choose and download the last version(API Level29) on "Virtual Device Configuration" window
I'm trying to test an app in an AVD with Android 3.1 as the target but it is running terribly slow and doesn't seem to respond. I created a new AVD with Android 2.1 as the target but this AVD does not show up in the run configurations in Eclipse even when refreshed and restarted.
Does anyone know why I cannot run older versions of Android?
I've found that the targetSdkVersion in the manifest file affects what shows up in the run configuration. Setting the target selection mode to Manual in the run configuration should open a popup when you run it that lets you select any AVD, not just ones that meet the targetSdkVersion.
Try to increase the emulator RAM to 1024Mb.
Go go to AVD Manager click on the emulator and then edit.
You should find Device ram size and set the new value and then "Edit AVD".
I have installed the SDKs(1.5,1.6,2.1,2.2) from AVD manager, and created a new emulator device with version 1.5. However, I cannot find this device in run configuration target. It only displays the devices created with version 2.2.
What's the minimumSdkVersion/targetSdkVersion version in your XML ?
It looks like this is a bug. "Run Configurations"/"Debug Configurations" filter out all emulators that have API Level lower than what is specified in target property in default.properties file of Android project.
There is one workaround.
In your "Run Configurations"/"Debug Configurations" select your configuration, go to "Target" tab and click on "Manual" radio button. This will show you list of running emulators when you want to start/debug you app.
Start Android 1.5 emulator manually (from AVD Manager), wait until eclipse sees this emulator as "online" in "Devices" view.
Start you application and select the Android 1.5 emulator to run on.