开发者

Android application doesn't start from Eclipse

开发者 https://www.devze.com 2023-01-03 14:59 出处:网络
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, t

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 wor开发者_运维问答k. 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号