Eclipse (Android): When clicking 'Run'/'Debug' nothing happens - android

I have just installed (extracted) properly the ADT bundle for eclipse + android SDK and also set a new AVD which is currently working on my background and looks fine.
my problem is: once i create any app and click the 'Run' or 'Debug' button, nothing happens.
I don't see any 'launching : (nn%) ..' message at the bottom and the AVD is not effected at all - nothing happens!
I have no idea what is the problem but a while ago i installed this exactly same way and had seen this issue before. could anyone please advice me what to do?

right click you project->run as -> run configuration, check whether launce default activity is selected, and in target tab check "always prompt to pick device"

If the button works fine for the first time and doesn't work later, try this.
Open Devices view using Window > Show View > Devices.
Then, in Devices, under your emulator, find your application package name. Select it and press the red "STOP" button.
After this, the application should run properly.

In the editor MainActivity.java file should be open/in focus.Then run your app. It should work fine.
Problem occurs when some other xml file is in focus in the editor eg.styles.xml etc.

click the down arrow next to run button go to run configurations. select target on the tab menu and check always prompt to pick device is selected

Make sure the connected device is responding or if you are using emulator then make sure it's well configured, I had this problem, I changed the usb cable and it worked.

The problem is with the phone: you have to activate the developper abilities of the phone.
On the phone with Jelly Bean (4.2) and newer versions of Android:
Go to "Settings" --> "About Phone" --> tap “Build Number” until you get a popup that you have become a developer (5 or 7 times, count down will decrease ). Then go to "Settings" --> "Developer" --> "USB debugging" and enable it.
Elder versions of Android on your phone: This is usually done from "Settings" --> "Applications" --> "Development" --> "USB debugging" and enable it.
That's it !
Perhaps you will have to reboot the phone (not sure about this).
Then, retry
"adb devices" on your computer console: your phone is on the list, and ready to use with android studio or else !
Good luck now !
Reference :
https://wiki.archlinux.org/index.php/Android
here:
Connect device

Related

Cannot Open Dev Menu on Xiaomi Devices

I am using react-native-cli for making a React Native App. It is working fine, and successfully installs on my connected Device but I cannot open the Dev Menu on it.
There is no hardware Menu button, and the shake device ain't working too.
Is there any other way to open the Dev menu?
Or is this bug specific to Xiaomi devices and dev menu cannot be opened on MI?
Phone: Mi Note 3
React Native: 0.39.2
For xiaomi devices, you need to enable popup permission from security->permissions->app name -> popup
Source: https://github.com/facebook/react-native/issues/2754#issuecomment-140815500
On my Redmi 4X i need to hold the "menu" button to open The Dev Menu options.
To verify this option, you can go to:
Settings --> Additional config --> Buttons and gestures shortcuts --> Show menu
PS: As palaniraja said, you need to enable popup permission as well.
I get Xiaomi Mi 8 and, after many hours I have discovered how show the dev menu.
The problem, in this device, is that when you send the command:
adb shell input keyevent 82
is the same that perform a click "menu button" on device.
In brief, if you want to show dev menu on newest devices with miui, you must perform a "long click" on the menu button (NOT A "SIMPLE CLICK")
All the best!
While the device is connected (check adb devices -l), you can use the command:
adb shell input keyevent KEYCODE_MENU
I got strange behavior, when yesterday it worked fine, but today is not working. To fix it,- i restarted device and it helped me.
Make sure you have enable the Display pop-up window
Settings > Permissions > Permissions

How to change target emulator in Android Studio?

I have several genymotion emulators for different API levels. The problem is this:
I run the app on a single emulator with the option 'same device for future launches' checked.
I open another emulator.
I run the the app again.
After this, the app only runs on the first emulator and I can't figure out how do I show the dialog (select target) again to run the app on both emulators.
Click Run → Edit Configurations...
Then uncheck Use same device for future launches
As mentioned by #B-GangsteR, you can also launch your app on multiple devices at the same time. To do this, select targets using ctrl key.
Note that even if "Use same device for future launches" is unchecked, you can't launch app on other device while it is still running on first device. So you've got to
terminate app on first device before running on another device,
or kill adb process (it will restart),
or run your app on multiple devices at the same time from the start (when choosing target, select multiple targets using 'ctrl' button or 'ctrl' + A)
In Android Studio 3.5 or above, the "Deployment Target" part of the configurations dialog has moved into the main toolbar.
Click Edit config beside run app.
Close the existing running app in all emulators to have this option even if the problem persist after doing configuration changes
You can change profiles by going to "Run" -> "Run..." -> "1.app" (click on the arrow) -> "Profile", then choosing which device (virtual or physical) you'd like to run on. This took me a while to find and I couldn't find anything like it in the answers above, so hopefully, I help someone out.
You can hold ctrl to select multiple devices (mentioned by #B-GangsteR).
In Android Studio 3.5, need to click on the Emulator name which is the left option of Run 'app' button.
You can select specific Emulator of your choice or multiple Emulator as well.

Logcat doesn't work in android studio

I use android studio 0.4.2 and logcat does not work (its just empty). USB debugging is enabled, filters are disabled and log level is verbose. Any ideas?
In logcat, try going to the bottom right corner where there is a ">>" and select that. It restarts it.
Click on the "Debug App" Icon next to the "Run App" Icon or press SHIFT + F9. That seems to do the trick for me.
Try going to developer settings on the phone, and scrolling to the "Monitoring" then "Enable OpenGL Traces" and select LogCat.
I tried everything. I unintentionally found that empty tags never show. If you are using empty tags, like me, try filling with some letter (blank spaces didn't work for me).
On your android monitor:
Restart your LogCat.
Set no filters because Android studio 2.2 has Firebase.
Clear your searching filter.
Select your running device.
If not work clear Android studio caches. File->invalidate caches/restart
When apply all way but still not working then use Android device monitor. Tools -> Android -> Android device monitor.
In my case, restarting Android Studio works for me.
Go to "Window -> Preferences"
From the left panel, expand "Android" and select "Logcat". Check if "Show logcat view if message priority is atleast:" is equal to "VERBOSE". If needed, select "VERBOSE" and apply.
Now you can see your device events in LogCat.
In my case, it usually takes 20 or more seconds for my logcat to display anything. After it does, I see "debugger waiting to settle" messages. This happens every single time.
Try waiting a while to see if it ends up showing up.
Old question, but the issue seems to occur frequently while running Android Studio 1.1.0. This often happens after I clear all existing log.
When it does, I tap the restart icon (green curved arrow on top of a grey square) and it start working again.
I had the same problem and solved it in the device developer options by disabling and enabling Usb debugging.
To add to this thread of solutions,
Check for if you have multiple devices connected. Than select the device that you want logs from (upper left corner on logcat window). Sometimes, different device is selected rather than one you are debugging your app on. Hope this helps.
In my case, I had two Android phones plugged in for debugging. Switching phones, using the drop down box, didn't do a thing, so I:
-unplugged both
-restarted Android Studio (and the project)
-plugged in the (one) device for which I wanted to see the logs
That did it for me. Logs were back ... now just to fix the code.
In case you make it down here, #Maarten's comment above worked for me. Close Android Studio then adb devices at Ubuntu terminal:
ewan#xxxx:~/AndroidStudioProjects/projectx$ adb devices
List of devices attached
adb server version (41) doesn't match this client (39); killing...
* daemon started successfully
FA7Bxxxxxx2 device
Restarted Android Studio and logcat window worked again.
UPDATE: d'oh I found that I was inadvertently using version 39 from the terminal window whereas Android Studio was using 41

Cannot see debug output when running android emulator

I've setup android in eclipse according to this tutorial. I downloaded the android sdk zip file from here and unzipped it to my c drive. Android sdk 2.3.3 api level 10 is installed and I have setup an android virtual device in the android SDK and AVG manager. The settings are as follows
In Eclipse, when I go to - 'Window -> Show View -> Android -> LogCat', the logcat view opens up. When I start the emulator however, I see absolutely nothing in the logcat window. Any ideas why this might be happening?
==============================================================================
Update Unfortunately none of the suggestions are working. I don't see anything
in my devices tab at all. It's empty. See image below.
In that case try to reset adb.
Go to the Devices view in the DDMS perspective.
Click on the View Menu button that looks like a down arrow.
Select Reset adb.
Of course you'll have to select an application on that device first.
Try opening the DDMS perspective (in Eclipse, Windows -> Open Perspective -> DDMS), then select the device in the Devices tab (by default in the upper left hand corner). Also make sure the LogCat window is showing too.
I've noticed that sometimes the LogCat window stops updating, but changing the filter (Verbose-Debug-etc) by clicking the round white buttons with letters inside fixes it.
Probably device is not selected for your logcat.
try 'Window -> Show View -> device and then select the emulator
May be because your device is not is not selected
In your Devices tab (where all the running emulators and devices are shown), select your desired emulator
If your eclipse didn't shows Devices, then Window -> Show View -> Android -> Devices
Close the logcat window completely ... kill it ... it's stuck ... then Window-> Show View -> Other -> LogCat

Why doesn't logcat show anything in my Android?

Why doesn't logcat show anything in my Android (while developing apps with Eclipse)?
It just doesn't print anything. It's empty.
I had this same issue but my fix was much more basic:
If the LogCat panel is empty in Eclipse the emulator doesn't have the focus. Go to the DDMS perspective and try clicking on the 'emulator' entry in the Devices panel (top-left screen).
Dial
*#*#2846579#*#*
and you will see a hidden menu. Go to the Project Menu > Background Setting > Log setting and define the log availability (log switch) and level (log level setting).
Please note this may apply to Huawei phones only as is stated for an Ideos X3 (here) and is tested at a Honor U8860.
If clicking in Devices panel doesn't bring the spam, use reset adb in dropout menu from triangle on the right of the snapshot button.
I have the same problem on/off and the way I solved is by menu File → Restart (restart Eclipse).
Maybe you have Mylyn installed?
http://code.google.com/p/android/issues/detail?id=1808
While the answer provided by MoMo will resolve the problem temporarily it will most likely reoccur the next time you launch Eclipse, or launch on a different Emulator/Device.
Instead of always having to select my device in the devices view I've found a better solution is to go into your Eclipse preferences and navigate to Android -> LogCat in the list on the left and then enable "Monitor logcat for messages from applications in workspace".
This way no matter what device you are using logcat will automatically start showing output from it as soon as the application launches.
It will also setup a filter that ensures that only output from your application is displayed, which you can reuse / disable as needed.
Maybe the log is not enabled in your device.
Try to run the following command.
adb shell
echo 1 > /sys/kernel/logger/log_main/enable
OK. This is how I got it to work. I first followed MoMo's advice, that is...
If the LogCat panel is empty in Eclipse the emulator doesn't have the
focus. Go to the DDMS perspective and try clicking on the 'emulator'
entry in the Devices panel (top-left screen).
But to no avail.
I then attempted to reset adb (Android Debug Bridge) as suggested by fyodorananiev.
How? Menu Window → Devices → upside down triangle menu button → Reset adb.
It also didn't work, but I did get the following message:
Android hierarchyviewer: Unable to get the focused window from device
This meant that MoMo was right in that my Android device or emulator didn't have focus. However, the solution I did in my case is different.
What worked for me:
Replugged my Android device, which was connected to my computer via USB.
Restarted Eclipse, as mentioned by Abu Hamzah (although since I didn't know I can do menu File → Restart, I manually closed down Eclipse, and then restarted the application again.)
I can now see logs in my logcat.
Go to Developer settings and check that for Debugging\Select App for Debugging is empty
If you are using a device, the simplest check is to restart Eclipse.
You don't have to shutdown Eclipse
Use menu File → Restart
In a quick second or two you should see your LogCat return.
The simplest solution worked for me: Shutdown and restart my phone and Eclipse alike.
I had faced the same issue but in my case logs are shown when other devices are connected and not shown when my device is connected.
It took me days and finally, the issue resolved when I restarted my phone.
Below: Really dumb answer, but it happens!
My cat stepped on the space button while I was away and [SPACE]xN was typed in the search bar.
That resulted in an empty Log Cat. I tried restarting and wasted like 1 hour before I realized I should clear my search bar.
TLDR; CLEAR YOUR LOG CAT SEARCH BAR!
I think you haven't selected the device or emulator, on which running your application.
In Eclipse, go to DDMS Perspective and select the device or emulator on which you are running your application.
(Note: No need to restart Eclipse)
In case if you are using CyanogenMod in your mobile, it will disable logging by default. Try this method:
In your device, open "/system/etc/init.d/" folder
If there are many files, try opening each file and find for this line:
rm /dev/log/main
Now, comment this line like this: # rm /dev/log/main
Save the file and reboot.
It gets interesting when you find out that none of all the answers in for this question were helpful.
And then you find out that in your version of ADT 22.6.3.v201404151837-1123206 if you add two filters with the same package name (application name) then the log will not appear.
It was weird, because the log was there two seconds ago, and launching the app in debug mode adds a default filter for the app which collides with the filter I've setup manually, and then ADT magically removes all the logs, and none of the filter worked including the all messages (no filters)!
But it was masking another issue...
I'm working with dual screens. The second one is connected via VGA/RGB - (not really sure what it's called) and what can I do. I'm a ton more comfortable with the logcat away from my code editors, so I've placed it in another window, and as it turns out that is the main reason for the disappearing logs for me.
If using the DDMS to refocus doesn't work, try closing and restarting LogCat. That helped me.
I've had this happen occasionally. Closing and re-opening Eclipse seems to fix it.
If you tried all of the others, and still got losing on an empty logcat. I got another simple way.
Download an old version of ADB, and try again. It might be working, at least working for me with Android 7.0 phone (vendor stopped updating).
Here is the useful link for old versions.
I had the same issue. No need to restart Eclipse or clean your project. You may follow:
Click on LogCat icon on bottom right corner of eclipse.
In Saved Filter Pane (Left side), double click package of your project (in my case it's com.apps..*).
In Logcate Message Filter Settings popup, select desired option of "by Log Level". You can select verbose, info, error etc.
Click Ok.
Run/Debug your project.
This is simple.
Just close the Logcat from eclipse.
Then reopen it by following steps in Eclipse.
Window - Show View - Other - Android - LogCat - ok
Hope this solves your problem.
Many times when I switched to a new Android device, I do see no more logcat messages. Unfortunately, none of the above suggestions worked for me (Eclipse Photon 4.8.0).
I am now using this . It seems to work for different devices.
Check if the Console is telling you something. Usually this happens when the project could not be installed in the device, and just shows the previous one.
The most common case I have seen this is when there are different signatures in the project, and is not running at all.
Please, read all the red letters you see. If the LogCat does not show anything, take for sure that the Console will do.
For OnePlus devices and Ubuntu OS:
Install Wine on Ubuntu
Install ADB tools on Ubuntu
sudo apt-get install android-tools-adb
Now, attach your device to PC with USB.
Open mounted "One Plus Drivers". A disc like icon
Right click on OnePlus_USB_Drivers_setup.exe and run with Wine
Then open the terminal in the present drive where your "OnePlus_USB_Drivers_setup.exe" and other driver files exists. And run
./adb_config_Linux_OSX.sh or sh adb_config_Linux_OSX.sh
Close this terminal
Open a new terminal and run
adb server-start
Your OnePlus device should prompt you to recognise your PC as a debugging agent.
Now, run on the terminal. It should show your device.
adb devices
Reference: [SOLVED] Android Studio does not recognise my One Plus Two in Linux
Set the same date and time in your Android phone and in your laptop.
I had a similar problem of logs not showing, and when I set the correct date in the phone I started seeing the logs (I restarted the phone and the hour was completely wrong!).
What worked for me besides restarting Eclipse was:
Remove custom filters
After removing all filters, logcat was filled with text again
Close logcat and then reopen it from Window → Show View → Others.
If you're using Eclipse v4.5 (Mars) (at least, Mars.1 or Mars.2), try the solution described here: Logcat show invisible messages in Eclipse Mars.
It helped in my case.
In my case (after trying all the answers provided here to no avail), the problem (and solution) has to do with port 8700:
What I needed to do is:
Exit "Android Device Monitor" (monitor.bat)
Exit all instances of Eclipse.
C:\adt-bundle-windows-x86_64\sdk\tools>..\platform-tools\adb.exe kill-server
C:\adt-bundle-windows-x86_64\sdk\tools>..\platform-tools\adb.exe start-server
C:\adt-bundle-windows-x86_64\sdk\tools> monitor.bat
Also, the Scroll Lock button, needs to be "pressed/active":
Not the other way:

Categories

Resources