I'm new to android development, but I've been following the Google's tutorials on building an application. Unfortunately, I get stuck on "Running on a Real Device" because whenever I click Run as; Android Application nothing happens on my phone.
Any suggestions would be greatly appreciated.
Also:
My phone's a Motorola Razr M, running 4.1.2
USB debugging is enabled, unknown sources enabled.
Latest USB drivers are installed
My eclipse is part of the ADT bundle from Google.
Couple of things to try here (assuming your project has no errors):
Click on the arrow on the run button and then specifically select your project to run.
Check if you are able to run your project in an emulator also -- see screenshot below.
Below is how you check if your phone is recognized by Eclipse - if it is ... you will most definitely see a lot of output in LogCat. if your phone is successfully connected, you will see lots of messages scrolling in the logCat.
Related
I have a clean Android project on Android Studio (just with a "hello world' screen), and I'm trying to install the app on my Samsung Galaxy S10e.
I click the Run button, and this is what I see in the Build Output:
And the apk is generated successfully.
But it's not launched and not installed on the device (no icon, and it doesn't appear in the apps list).
When I try manually installing the apk by adb install app-debug.apk, it works. The app shortcut appears on the device, it's added to the apps list, and I can launch the app.
At first also adb install didn't work, giving out the error INSTALL_FAILED_TEST_ONLY, but I solved that by adding android.injected.testOnly=false to gradle.properties.
I tried changing Gradle version to 6.0.1 (looks like this is the latest at the moment), and it didn't help.
I also have my device selected at the top:
How can I make Android Studio install and launch the app on my device?
Android Studio version: 3.5.3
Edit:
I'm seeing the same behavior on an Emulator. I opened AVD from Android Studio and chose Pixel 3A. The emulator opens up, I run the app, nothing happens on the emulator (and I see the same Build Output messages).
The same happens to me. It is probably a bug in Android Studio. At the second compilation the app installs correctly. It is tedious.
There isn't enough information to find the cause of this issue.
But since it works with adb, it means you run adb command. There could be only one instance of adb daemon running. So if it's involved externally my guess is Android Studio won't have access to it.
Possibly try adb kill-server and running again from Android Studio and see if that helps.
I encountered the same problem, which I solved by checking the running devices. The connected phone had 2 accounts (might be personal & work) which was listed on the list of devices, so I had to select the second option, and it ran successfully on my phone. see the attached image.
One thing it might be:
Enable usb debugging
Settings
System
Developer options
Turn the setting on for usb debugging
If it does not appear go to settings about phone. Then click on build number like 7-10 times and it will enable you to have the developer options appear.
I have clicked on my Samsung Galaxy build number seven times and got a message, that I am a developer now. I connected this device to my computer via USB. I have installed Android SDK and created a sample project in IntelliJ.
But when I try to run it, the following window appears:
Troubleshoot link does not work.
What else was I to do in order to be able to run Android programs from IntelliJ?
You need to enable USB debugging in developer options. Like on image below
I'm using Android Studio 0.8.9. The issue, it is not detecting my device. I tried it with a couple of different devices. "adb devices" on the command line shows the device. adb logcat on the command line works. DDMS view (Android Device Monitor) recognizes the device and shows logcat too! But the Android Studio shell does not show it. I'm at my wit's end. I have tried restarting everything involved in the process - Android Studio, adb, my phone and even my Mac. Nothing helped. It's not a one-off problem either - I have had this 2 weeks ago, tried everything I could. Gave up and worked on something else. Now I'm back to working on Android and the issue is still there. I suspect it's something to do with my Studio config, but haven't been able to figure it out.
update: I downloaded IntelliJ and that is working fine too. So either I'm running into a weird bug in Android Studio that nobody else seems to be facing, or my Android Studio settings are wrong!
Follow the steps !
Step1> Connect your phone to computer via USB Enable USB debugging on your phone
Step2> Right click on project -> Run As -> Run Configuration
Step3> There are three tabs, Here select the second tab
Step4> In your project and check if your mobile device is detected ? If yes the click on it and Click Run button.
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 one doubt,i have created new project in eclipse with android 2.3.1 and try to debug directly from eclipse to device.and it's wokring well,it's debugg in device.now when i am converting that version of android 2.3.1 to GoogleApi 2.3.1 by right clicking project and changing android property.after that when i run my project i am getting such warrining kind of symbol as u can see in below image.
again when i am changing version to simple android 2.3.1 than it's get debugging from eclipse to device.
my device name is Sony Ericon Walk Man Live and ya one more thing Google API version working well when i copy apk to sd card directly and installed in device,but getting problem only when i am running from eclipse to device directly.
One another thing i noticed is that when i create a simple project than right clicking project and runing it's asking me to wether to run in device or emulator but in older one it's not even asking and directly running in emulator...in both's project manifest there is no tag like android:debuggable="true/false" also...
any one have idea what is a solution of this problem i have already insatlled device driver to pc as well.
please help me to short out this
Thanks in advance
Aamirkhan I.
Enabling USB debugging is key, but there's something else as well. Eclipse, by default, runs your application automatically after the first run. So, if you choose an emulator as your first run, Eclipse will default to run by emulator every run afterwards.To change this, go to your "Run Configurations".
There will be an option to run manually or automatically.
Choose "Manual" and you will prompted to choose between your emulator and device every time you decide to run. Otherwise, you can set whether to run automatically with your device or emulator.
try as in this link
If you already connected your mobile device with your computer via the USB cable, please unplug it from your phone, otherwise your device will prompt you a warning requesting to do so.