How to launch an android application in eclipse - android

So I've done the "Hello, World" tutorial on the android developer site. Instructions on how to launch the application:
1) Select Run > Run.
2) Select "Android Application".
Simple enough. Except what starts is the android default launcher, not the application. How do I get the actual application to start?
Code is a copy paste from: http://developer.android.com/resources/tutorials/hello-world.html
Edit: Haven't tried logcat yet, but the console gives me:
[2011-08-23 15:57:19 - HelloAndroid] Android Launch!
[2011-08-23 15:57:19 - HelloAndroid] adb is running normally.
[2011-08-23 15:57:19 - HelloAndroid] Performing com.example.helloandroid.HelloAndroid activity launch
[2011-08-23 15:57:19 - HelloAndroid] Automatic Target Mode: launching new emulator with compatible AVD 'MyPhone'
[2011-08-23 15:57:19 - HelloAndroid] Launching a new emulator with Virtual Device 'MyPhone'
Edit2: Apparently this is a known problem. The solution provided by google doesn't work for me, but might for someone else: http://developer.android.com/resources/faq/troubleshooting.html#eclipse
Edit3: I've found numerous people with the same problem, but no solutions so far. Workaround: use a physical device. The program runs fine on my Nexus One. I'm leaving the question for now, can't spend more time on this.

Right click to your project -> Run As -> Android Application

Right click on your project and select Run -> Run as -> Android Application.

Sometimes it doesn't start the application. You can launch the menu and you would see your application installed there. You can then manually launch the application.
Sometimes trying to run the application multiple times from Eclipse as well helps!

This may happen if another project (even a non Android project) is selected in your Eclipse workspace tree.
In that case, the Run command will be applied to this project even if a source file of HelloWord is opened on the edition screen.
Ensure that a source file of HelloWorld, or the project HelloWorld itself, is selected.
Or you may just need to unlock the Emulator that started.
When running the app from Eclipse, an emulator is started. But it appears locked. You have to unlock it to make the keyguard to disappear, as if it was an actual cellphone.

Related

Android emulator doesn't start anymore

I'm running on OSX Mountain Lion. I recently installed the latest version of Eclipse and the Android SDK from Eclipse. I updated the SDK through Eclipse as well, downloading everything in the Extras, Android 2.2 (API 8), Android 4.1.2 (API 16) and the Tools folder.
Finally I could run the emulator by creating a device but it was very slow (I have 250gb ssd hard drive + 16gb RAM), I couldn't even run the application I had. I tried to modify some options of the emulator and now apparently I can't run anything anymore. As soon as I try to run a program (Hello World) I get the following infamous Mac OSX error:
emulator-arm quit unexpectedly.
The console output for Eclipse is the following:
[2012-10-19 15:46:06 - test] Android Launch!
[2012-10-19 15:46:06 - test] adb is running normally.
[2012-10-19 15:46:06 - test] Performing com.example.test.MainActivity activity launch
[2012-10-19 15:46:06 - test] Automatic Target Mode: launching new emulator with compatible AVD 'test'
[2012-10-19 15:46:06 - test] Launching a new emulator with Virtual Device 'test'
I tried to reset things as they were before as well as creating a new emulator device. I tried to restart Eclipse and the machine itself but nothing. Apparently I can't run any Android application anymore.
Does somebody has some idea? I read on some similar thread to use adb to restart the thing, but apparently I can't get that running as well. By doing ./adb shell I get error: device not found. Do you have any idea about what can I do to solve the issue?
Thanks
The problem is essentially the AVD manager can’t re-open a virtual device that was on a second monitor on a Mac. The work around is to edit the following file
~/.android/avd/.avd/emulator-user.ini
(depending on your system, this may be at ~/.android/avd/Default.avd/emulator-user.ini too)
and change the window.x and window.y entries to
window.x=0
window.y=0
Source: http://timvoet.com/2013/01/04/avd-emulator-crashes-on-mac/
FWIW I noticed that running VirtualBox seems to get a lock on HAX which prevents android emulator window from ever opening. Closing VirtualBox seems to release the lock and everything works again.
Update your android sdk. In eclipse it should be an button next to the open avd manager button. or from command line try android update sdk --no-ui.
the following link should help scroll down to see how to update. https://wiki.appcelerator.org/display/guides/Installing+and+Updating+Android+SDK
I had the same problem but the suggested ideas didn't solve my problem, after swearing and waving my fist at the Gods, I worked backwards to when it WAS working, and decided to change my SDK Tools version back from the Android SDK Tools RC 22.6 to Android SDK Tools 22.3.
Start up emulator64-x86 4.4.2 intel atom instance and low and behold it works again.
2 valuable hours later... Gotta love working with Android. :O
Moral of the story don't use the Preview Channel Releases.

Android Beginner: Emulator not running app or updating it

[2012-02-14 11:57:59 - HarshaBoston] Android Launch!
[2012-02-14 11:57:59 - HarshaBoston] adb is running normally.
[2012-02-14 11:57:59 - HarshaBoston] Performing com.boston.harsha.startPoint activity launch
[2012-02-14 11:57:59 - HarshaBoston] Automatic Target Mode: launching new emulator with compatible AVD 'Droid8'
[2012-02-14 11:57:59 - HarshaBoston] Launching a new emulator with Virtual Device 'Droid8'
[2012-02-14 11:58:05 - Emulator] emulator: WARNING: Unable to create sensors port: Unknown error
Ok so this is what the console is showing. My emulator was working fine until a couple of days ago, then my projects were not updating the changes made to the main.xml file even though the changes were saved.
Now, I wanted to see if a new project would work, but no dice. The emulator runs fine, but my app is not loaded, I have no idea what to do to rectify this.
I'm using API Level 8, with ADT plugin Android SDK on eclipse on Windows XP.
Android beginner here. I was making a Hello World program, which ran fine a couple of days ago, but now nothing runs, and existing projects don't show the changes made to them. Please help!
Now when I run the emulator, the emulator runs fine but my app isn't even loaded!
I've already tried reinstalling the ADT, reinstalled the Android SDK,etc. nothing happpened
Also, the emulator doesn't seem to be showing up on the DDMS.
FIXED IT!! SOLUTION FOR ANYONE FACING THIS PROBLEM
Apparently a lot of people in here seem to have this problem and only one of the threads had a good solution.
Firstly if this is happening to you, check the DDMS to see if the emulator is shown. This is the a red flag. Apparently the adb server does not refresh or restart every time you restart eclipse.
Run the emulator. Chances are your app may not run on the emulator. Now, while the emulator is still running go the DDMS tab and next to the Screen Capture icon there is a dropdown menu with 'Reset ADB', click on it. Now your emulated device should be shown in the DDMS devices.
Run your app now. hopefully this solved your problem. Mine did!
FIXED IT!! SOLUTION FOR ANYONE FACING THIS PROBLEM Apparently a lot of people in here seem to have this problem and only one of the threads had a good solution.
Firstly if this is happening to you, check the DDMS to see if the emulator is shown. This is the a red flag. Apparently the adb server does not refresh or restart every time you restart eclipse.
Run the emulator. Chances are your app may not run on the emulator. Now, while the emulator is still running go the DDMS tab and next to the Screen Capture icon there is a dropdown menu with 'Reset ADB', click on it. Now your emulated device should be shown in the DDMS devices.
Run your app now. hopefully this solved your problem. Mine did!
I had the same problem with developing my android app on an emulator. I would rebuild and install my application and it would keep installing an older version of my app (reinstalling app, and the answer above didn't help). Turns out running ant clean and rebuilding the project fixed it!

Android ".apk" deployment from Eclipse

I use Eclipse IDE for developing Android applications. I have done pretty much the same things what is written on Internet to download and setup Android SDK on Eclipse. I allowed installation of non market apps also checked USB debugging option.
I am trying to run my very basic Android application on Galaxy Tab 10.1. When I start the application and press Run button on Eclipse.
on the console of Eclipse the following is written:
[2011-12-04 20:14:09 - dene] Android Launch!
[2011-12-04 20:14:09 - dene] adb is running normally.
[2011-12-04 20:14:09 - dene] Performing com.berkay.dene.DeneActivity activity launch
[2011-12-04 20:14:13 - dene] Uploading dene.apk onto device '4289143415F3397'
[2011-12-04 20:14:13 - dene] Installing dene.apk...
but it stops here and does not proceed.
On the other hand, when I use the adb tool and use command line
adb install
it successfully installs my program to my device.
but this way is quite time consuming. what can be the problem?

Eclipse: does not launch the app after installing .apk (android)

Recently after having updated lots of stuff on android SDK something happened to Eclipse.
I'm running the apps on an actual device instead of an emulator. Before the updates, after I used to click 'Run' and select my device, it would upload the .apk to the phone and immediately launch the app. For some reason, it doesn't do that anymore and simply stops after installing:
[2011-11-09 18:17:18 - helloworld] Android Launch!
[2011-11-09 18:17:18 - helloworld] adb is running normally.
[2011-11-09 18:17:18 - helloworld] Performing com.example.helloandroid.HelloAndroid activity launch
[2011-11-09 18:17:26 - helloworld] Device API version is 10 (Android 2.3.6)
[2011-11-09 18:17:26 - helloworld] Uploading helloworld.apk onto device '363294A87A1000EC'
[2011-11-09 18:17:26 - helloworld] Installing helloworld.apk...
The phone is on debugging mode and I generally haven't changed anything on Eclipse's settings - it literally stopped working after the SDK updates. Any idea how to make it automatically run the apps again?
Thanks
sorry for my bad english. I had the same problem after sdk updates. To solve this problem you have to update also "Android DDMS", "ADT" and all other components on eclipse. To do this open eclipse and click on "Help -> Check for updates". All android parts in eclipse will update automatically to the latest version (the version of SDK). I hope that this will work also for you. Bye.
Matteo
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
Make sure these are in your manifest in the intent filter for your activity.
In Eclipse, Right click on Project > Runs As > Run Configurations > select Launch Default Activity under Android Tab.
Look in your "Run Configurations under the project context menu. Right click on your project and choose "Run As -> Run Configurations". Choose target tab and choose "Manual" for deployment Target Selection Mode. This will allow you to see what Eclipse should see when it is looking for a target. If your phone doesn't show, then you may have to configure something else.
You did not mention phone type.
Also verify your original Virtual Devices are still in AVD.

Android application doesn't start from Eclipse

Before u start: I searched the google and stackoverflow, none of them gave clear answer.
Situation: I'm using Eclipse on Windows to develop Android application. So when I'm trying to run the app, the system outputs to console
[2010-06-14 17:04:39 - HelloLinearLayout] ------------------------------
[2010-06-14 17:04:39 - HelloLinearLayout] Android Launch!
[2010-06-14 17:04:39 - HelloLinearLayout] adb is running normally.
[2010-06-14 17:04:39 - HelloLinearLayout] Performing com.example.HelloLinearLayout.HelloLinearLayout activity launch
[2010-06-14 17:04:39 - HelloLinearLayout] Automatic Target Mode: launching new emulator with compatible AVD 'Default_2.1'
[2010-06-14 17:04:39 - HelloLinearLayout] Launching a new emulator with Virtual Device 'Default_2.1'
starts the emulator, but doesn't upload the .apk and doesn't start the activity. So, app is not started anyway.
I found a "solution" here, but it's unclear and seems to not work. For example, I don't know, which "emulator processed" are meant to be killed. I found adb.exe only. And that's the main point: sometimes I'm lucky enough to kill all that they wanted and start the app. But it's undetermined.
Please help, I'm completely stuck with this trouble.
I've run into this situation many times and have had to do several things to resolve the issue.
1) If DDMS is running, close it (it seems to interfere with debugging sometimes).
2) Start the emulator, try connecting with DDMS, then disconnect, then go back to eclipse and start the debuggerer.
3) Kill the emulator, kill the adb process in task manager, restart eclipse, then try debugging letting Eclipse launch the emulator, sometimes the first load of the emulator times out so when it's fully started up, start debugging again.
Overall though, I've found it is much easier to not use the emulator and use an actual device, for me it's a much faster process.
I've tried a bunch of things for Eclipse on Windows and this set-up finally worked for me. Now I can repeatedly run the emulator and deploy the app successfully:
In Run Configurations ->Select the Deployment Target Selection Mode as "Manual"
Then Hit Run. The "Android Device Chooser" shows up
Select the "Launch a new Android Virtual Device" option (this should show the AVD that you had already pre-configured)
Select the AVD there and hit Start
Check only the "Wipe User Data" and un-check the other checkboxes
Hit Launch. This should launch the emulator. Give it sometime to run. Ensure that the home screen with the Android icon (and Google search bar) shows up. It's important to wait till this shows up. Otherwise, the app won't load. Depending on how fast your CPU is, the time taken for the home screen to load will vary.
Once the emulator home screen shows, go back to Eclipse, select this emulator in the Android Device Chooser (the state should be online)
Click OK once you have selected this emulator
The app will be loaded on to the emulator (give it sometime) and you should see your app running on the emulator
This setup seemed to work for me every time. I can't fully comprehend why this works, while the other "normal" way doesn't. But I'm glad, I could get the emulator and the app working finally.
I was experiencing this issue in Linux (Mint 12, Eclipse Juno Java EE for Web Developers, Android API20, Sun Java 1.6). I could launch the emulator from the command line just fine (i.e., "emulator-arm -avd InsertYourVirtualDeviceNameHere -verbose"), but not from within Eclipse. It just hung like the original poster mentioned. The way I fixed it was to make a backup of the original "emulator" for safe keeping and then I made a copy of "emulator-arm" and renamed it "emulator". These emulators are located within the "tools" directory of your Android SDK installation. I'm still trying to figure out how to get Eclipse to correctly point to "emulator-arm" on its own without this hack.
It happened to me as well. It seemed that for me the issue was that the app was already running on the device I installed the apk to. When I closed it, it worked.
If You Running In Eclipse, Check Your Settings.
Run Configurations - Common - Select File In Standard Input And Output - Click
Workspace And Choose Your Project.

Categories

Resources