Android application doesn't start from Eclipse - android

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.

Related

Android Studio not detecting Microsoft Android Emulator

I installed Microsoft's Android Emulator from here which can now work without disabling Hyper-V on Windows 10. I was following the instructions in this post and everything was working smooth until yesterday. I was successfully able to debug my app in MS android emulator.
Today morning I closed the emulator and started it again. Now, When I start running the app to test it then the MS Android emulator is not showing up in Select Deployment Target window of Android Studio as below. Nexus 5X API 28 emulator visible under Available Virtual Devices is Google's Android emulator which doesn't work with Hyper-V enabled due to reasons mentioned here.
I've already launched the MS Android simulator and it is up and running:
I can see it running in Hyper-V as well as shown below:
Not sure what happened suddenly and it stopped working altogether. Can anyone suggest me the reason behind it or I'm missing something?
If it didn't detected by IDE, try to rerun the emulator and check if it is detecting again or not.
Also, you can try this too:
Tools -> Android -> Enable ADB Integration
If it is already enabled, try to disable and re enable it, seems like this works most of the times.
EDIT: You may want to check:
https://stackoverflow.com/a/38788436/4409113
Changing the value Path then running following commands:
adb kill-server
adb start-server
Might help.
I happened to resolve it by chance. Sharing my experience in case it helps someone in future.
Initially what I was doing is as below:
Start Visual Studio Emulator for Android application which contains the list all the device profiles.
Choose an appropriate device profile and install it.
Run the installed profile and launch the emulator.
Start Android studio, open the project and launch the app.
I simply reversed the above steps to resolve my issue. First close everything including Android Studio, emulators, device profile window etc.:
At first, start Android studio, open the project and hit Run app button to show Select Deployment Target window.
Now, start Visual Studio Emulator for Android application which contains the list of all the device profiles.
Choose an appropriate device profile and install it.
Run the installed profile and launch the emulator. Wait for the Android operating system to get started fully.
The Connected Devices section in Select Deployment Target window would refresh on its own to start showing Microsoft's Android Emulator.
The adb.exe can be seen as an infected file by antivirius software. So need to exclude once reinstated.

waiting for device to come online

A couple of days ago (15th April 2017) I updated Android Studio with all the latest updates. Now when I try to run an app, the emulator window opens but I just get a message "waiting for device to come online". Eventually this times out and I get a message "installing APK", where it just seems to get stuck. I have searched the site and tried various advice including:
Deleting all the emulators and re-creating
Turning off the emulator in SDK manager, re-starting Android Studio and turning the emulator on again
turning off instant run
re-booting my PC, in case some update needed a re-start
The emulator I have is Nexus5X API23.5554
I have also deleted my app and created a completely new "hello World" app that does nothing but display one line of text, but I still get the same problem.
Has anyone any other ideas?
I ran into this issue too. It seems to be a bug with recent changes to the Android emulator. There is a workaround:
Launch the emulator independently from the Android Virtual Device (AVD) manager (there's an icon in the main Android Studio window)
Run your app. You'll notice the device name has changed from whatever the emulator is called to some generic name like 'Android x86 API 25'.
The app will run correctly on the emulator. You'll notice in logcat that the device name is 'emulator unknown'.
Hopefully Google will fix this over the next few days.
I couldn't get any emulator going at all, with no error messages, just 'waiting for device to come online'.
When tried to stop and start adb.exe in terminal:
adb kill-server
adb start-server
it said that adb is outdated. I had latest adb version downloded but Android Studio was trying to use some other file which was older version.
Finally, I checked environment variables and removed paths to:
C:\NVPACK\android-sdk-windows\platform-tools
and
C:\NVPACK\android-sdk-windows
as the newest version of SDK platform-tools I had on drive E: not C:, and is all working now.
Enzokie - Thanks. Nothing there seems to work, though. As a novice, I always assume that if something is wrong, it's my fault, but maybe not this time! I shall do as you suggest and raise it with Android unless anyone else suggests something that works.
My work around was to use a Nexus 5 instead of Nexus 5X.
If you don't know how to make an new emulator its tools>android>AVD manager> create new virtual device. Then just pick a new emulator and hit next until you're finished or customize it.
Resetting the ADB did the trick for me.
For Mac, In Android Studio -> Tools -> Android -> Android Device Monitor -> Under devices -> Down arrow there will be reset ADB option.
What worked for me was to wipe the emulator data. You can do this from AVD manager:
Tools -> AVD Manager -> Right click on virtual device - > Wipe Data
Hi I had the same Problem...so I did this:
Start your emulator, you will get the "wating for device to come online" error msg.
Wait till the emulator boots, then stop the process.
Now, on the emulator go to settings and make your "device" (emulator) to a developer device.
Check this, if you dont know how to do it -> https://www.digitaltrends.com/mobile/how-to-get-developer-options-on-android/
Then go on "Developer options" (in settings) and switch on the "usb-debugging" option. Remeber you PCs fingerprint.
Hope this was helpfull....

Not able to install .apks via adb

I have been working on a particular Android application for sometime and have been able to run these apps via Android Studio quite fine before but since applying a recent update I have not been able to run the app via Android studio because of the following error:
android.os.TransactionTooLargeException
Error: Could not access the Package Manager. Is the system running?
I have tried to troubleshoot this issue by connecting via a different TCP/IP instead of through USB (thinking it was a cable fault of sorts), reinstalling ADB, removing the ADB driver and restarting Android Studio, and all of the above yielded the same error when trying to run the app from Android Studio.
The update that was applied was the addition of the YouTube Android Player to a fragment. The fragment that contains YouTube Player was added to FragmentManager of the parent Activity during the onCreate method of this fragment. Could this be the problem? Or am I looking in the wrong place
Any insight would be appreciated.
You may have gotten this error while attempting to run an Android application on an emulator or device using Android Studio. The most common cause of this error is simple as stated in this link: You have to manually unlock your Android Virtual Device by swiping the "lock" icon on the screen. Security measures prevent the emulator from letting you connect the debugger before doing this. Make sure also that you are running Android Studio version above 0.3.2 or the latest version. There was some issue reported in AS 0.3.2. You can update it from Help >Check for update.
Found this thread which states that it might be an issue with your emulator not with Android Studio. Maybe you are trying to install application before even the emulator started properly. Wait till the home screen appears in the emulator before trying to install any application.
Also try to install any apk in Emulator from command line
Steps to install
Go to $Android_SDK_DIR\platform-tools, right click there keeping shift key pressed and Chose "Open Command Window here".
Run command adb devices to make sure yout emulator is running properly. It will show all your running emulators.
Now if emulators are showing properly, type the command adb install YOUR_FULL_APK_PATH , YOUR_FULL_APK_PATH is of any .apk
file path in your system.
You need to wait for the emulator to full start which may take a few minutes. Once it is fully started (UI on the emulator will change), it should work. You will need to restart the app after the emulator is running and choose the running emulator when prompted. You can check on this bug report the full details.
Hope this helps!
I'm not sure, but check if this works.
menu>> tools>>Android>>Enable ADB integration check it

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!

How to launch an android application in eclipse

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.

Categories

Resources