Related
Android Studio Not Showing My Phone for Run Application:
I want to run my developed application directly on my phone but I'm unable to run this. Because It's not showing in android studio. It also not working on emulator also. I already ready Google Development Guidelines(https://developer.android.com/studio/run/oem-usb.html). But these are not working for my system.
Have you enabled Developer mode on your phone?
If you haven't done yet follow these steps:
Go to settings -> About phone.
Tap on Build number 7 times and the developer option will be on.
If you have already enabled it then:
Go to Settings and find Developer options.
Check whether it is enabled or not.
Swipe down and find USB debugging. This option should be enabled. (Also enable Wireless ADB debugging if you're running app wirelessly)
Sorry for the late answer
I am also facing this issue couple of month ago, I had checked that I had enabled the USB debugging in developer but there is an issue with the Redmi phones that along with the USB debugging you will need to do the following
Go To Settings > Additional Settings > Developer Options
Enable USB debugging
Enable Install via USB
Disable Turn on MIUI optimization
On Select USB configuration select MIDI or File transfer (this is
what solved the problem for me)
also, keep in mind to give an RSA permission
you also check the link https://developer.android.com/studio/run/device?hl=ro
I have solved my problem on my own. The problem was in Android SDK. I'm using 2 windows in my same pc so I just used android studio on my another window then it's was working perfectly so I thought i have to try with changes that windows Android/Sdk folder in other windows which one I had problem. So I just copy (C:\Users{MyUserName}\AppData\Local\Android\Sdk) in getting the problem window and try again the android studio & Wawu... It's starting working. I hope it's will be helpful for you also.
i just made a simple android app with 6 buttons. Each button on click opens a new activity. I installed the app on my device via USB cable from Android studio and it runs fine on my device.
But here rises the problem, when I installed the app on my friends device after sharing via SHAREit the app installed on his device but did not run.
What could be the reason for this? And how can I solve this?
Please help. Thank you
You dont need to create a signed APK if you only want to test it on your friends device and not to run it in a production progress. Android Studio creates an apk automatically which is signed for 365 days. Just open your project in your explorer and go to [ProjectName]\app\build\outputs\apk and select the app-debug.apk.
Make sure instance run in android studio is disabled.
Because if Instance run is enabled when you debug the app on real device through usb debugging it will work properly . but if u share the apk from your device to other device it will not work. It might show an error . App Name Unfortunately Stoped.
If Instance run is enable. you must disable the instance run first. If you don't know how to disable it just google it. After disable the instance run, you must clean project and Build new apk. It will work on all the other devices without generating signed apk.
Hope it may help you.
While building the app what MinSDK version you defined? Do both devices satisfy that criteria?
If you suspect that installing through sharing app is a problem then try attaching your friend device to your laptop and try running the app.
Or
Send the apk through email and let your friend download the apk and install the apk through apkInstaller app.
I have a solution for you:
Install Bluestacks Android Emulator.
Go to Tools, Android and click on Enable Adb Integration to disable it.
In android studios one Android Device for Bluestacks will appear while installation.
Share the installed app through shareit.
It will work on other device.
Hope it helps
Here is the link, where you will find your solution. https://developer.android.com/studio/publish/ check the point 'publish your app', In left column.
Simply follow these steps:
Double click on shift and search for build apk and click on it.
Locate that apk file.
Copy to your physical device or your friend's device... whatever, it will work.
There is very awkward thing I am facing. Logcat is shown in debugging application, but while running (not debugging) application, it is not showing Logcat.
I tried restarting it but nothing is happening.
In my case in Android 2.2, for some reason, Firebase was selected by default in the dropdown box marked above. So logs didn't drop. I just needed to change it to No Filters. Then it worked.
I even tried restarting the logcat, that didn't work too. No Filters did the magic.
Hope this helps someone.
Edit:
You can as well select Show only selected application for logcat to show only the current debugging process, i.e your app.
You may be hiding it, try pressing Alt + 6 to open Log tab.
Look at the log level:- it must be verbose.
Restart adb.
If that doesn't works restart the android studio.
In Logcat window reselect your device then reselect your app
if it didn't appear restart adb using two commands:
adb kill-server
adb start-server
Besides what other guys said, look if you have written something in the search box that causes this problem(it was my case).
Note: Even in case of a restart, what you have written in search box won't delete and you need to delete it yourself.
Try the following Steps:-
Step 1.
Goto File > Invalidate Caches and Restart > Invalidate and Restart.
Android Studio will restart automatically and logcat will work as expected.
Refer screenshots :
Step 2.
If Step(1) didn't worked then try this :
Goto Terminal > cd till your platform-tools directory (eg. in Windows default location is C:\Users\\AppData\Local\Android\Sdk\platform-tools).
Now type following command :
adb kill-server
adb start-server
Step 3:
If Step(1)&(2) both didn't worked then simply try clicking on Re-Start Logging button available in Logcat option. Refer screenshot - (Green colour curved arrow with grey box)
For real device, not for the emulator:
The only thing that I did was unplug the USB cable then plugged it in again. And it worked.
First, my problem: I was testing an app on a Samsung Galaxy A3 attached via usb cable. I was getting the usual logCat messages, including the filtered ones then all of a sudden the logCat stopped displaying filtered messages. Setting it to Verbose displayed a continues stream of messages with a message at the top left corner of the logCat stating "too much output to display".
I tried restarting Android Studio (with and without clearing the cache) but no luck. I then rebooted my phone and everything was back to normal. So it appeared that the attached phone was the problem, sending too much info to the logCat.
on The top left of logcat there is an option to choose the emulator. may it's not selected the current emulator by default. try to changing it to current emulator and it will fix.
Restart both the emulator and Android Studio.
I have solved this issue by enabling "Use libusb backend" option in Android Studio -> Preferences -> Debugger -> Android Debug Bridge (adb).
Helped restart the device (HTC)
I fixed the issue by changing the USB Options of my phone from "Charging only" to "Transfer files (MTP)"
You need to press Alt+6 twice to restart the logcat window. That way it'll show the log outputs.
Go to your sdk Folder --> Platform tools --> adb click 2 times
using this adb server restart again
Please check your Sdk Location My Location is d drive Please See This
In my case when select No Filters, I see
logcat: Unexpected EOF!
then I fixed it by:
adb logcat -G 100M
See Logcat crashes with error: unexpected EOF
I had this code:
Log.e(getMyName(),message);
The problem with this was, the variable that the getter method was accessing was null. Android Studio did not give me any error about it! Seems this was silently not letting the Log.e statement to work. I checked many blogs but couldn't find the solution. This small miss wasted my complete one hour. Hope this helps someone.
I tried to switch "Extended log" in my device settings from "Selectivly" to "Allowed" and it helped. Now debug info appears in LogCat.
I had the same issue, and I resolved it by the following actions:
First, open the terminal in android studio and navigate to the following path:
C:\Users\user_name\AppData\Local\Android\Sdk\platform-tools
Second, enter the command: adb reboot.
It takes about 2 minutes, but now logcat is functioning again and showing every logcat.
This problem appeared after reinstalling (changing) GitHub in Android Studio.
it happened when I connected the GitHub Desktop (git.exe) to the Android Studio. And right after that logcat fell.
Solution: commit + push = fixed logcat))
I did not understand how it works, but it is a fact
I had the same problem. I tried killing and restarting the adb-server, but it didn't help. I deleted the debug apk of the app in the path:
<your_app>/<your_app>_app/build/outputs/apk/debug/
And run the project again. It solved the problem for me.
If your app has crashed, there is a dropdown that has 2 process, you have to select the other process that is dead, so you can see the error message:
A better approach (for ADB wifi and USB both )and it Always works Magically!
First, run the app:
Then stop before it launch the app:
You have to stop as soon as the red stop button becomes red from gray (which happens after Gradle build complete). In this way, you will start seeing logs, errors everything in the run tab. There is no need to unplug and plug USB. No need to restart ADB server.
Make sure you repeat this process until you see the logs (usually takes 1 or 2 repeats) (One request - Please upvote)
Second Master Approach:
In your emulator or android device, launch the app manually and close it manually. Then launch it from android studio.
I had the kind of issue the way which got me the logcat to work was that I was not choosing the right filter. as I was using SQLite (Database) and in filters I had chosen Firebase.so that's why my logcat was not working.
Check you don't have something in the logcat search that returns no matches, for example a non existent package name.
I had renamed my packages, but left an old name in the logcat search field.
Result: No logcat output visible
Cleaning and then Rebuilding fixed it for me. Apparently when I ran, it wasn't actually rebuilding the APK, just running the one that had already been made.
I tried all steps and debugging just to find out that I had accidently typed a space in the filter.
Make sure that in your Logcat Windows a space is not chosen as a Filter.
There will be a search bar, keep it empty. It worked in my case.
Don't do anything, if you run app in emulator or device just uninstall and reinstall the app. Done.
Try restarting ADB using the below commands:
adb kill-server
adb start-server
I feel silly asking this and even more silly to have this problem. I have a android project that has been executing fine until now.
but a couple of days ago, without me doing anything particular that I know of, my project has been always launching itself in debug no matter what I try (clicking on the debug or run gives me the same result). I try looking in the project settings and the build configuration but can't see anything justifying this.
so right now each time I launch the app I have to go to go to debug tab and click on disconnect...
Any ideas
Restart the device
I was experiencing the same problem where my app was always being run in debug mode. Restarting the device did the trick for me.
Have you checked your run configurations menu? You might have some extraneous configurations in there that Eclipse is defaulting to when you choose to launch the project.
Failing that, there is an option called "Launch in debug mode whenever the workspace contains breakpoints" in the Run/Debug -> Launching preference page. You might want to check to make sure that this option is not enabled.
As a last resort when facing these kinds of quirks I will sometimes create a new project and copy over my source files (provided the project is not very large). Closing and re-launching Eclipse sometimes works wonders for me as well.
As said above, the problem is with the device not eclipse.
Restarting the device will work, but also killing the application thread/process in the DDMS will do the same job.
On the emulator, go to App Drawer, launch application "Dev Tools". Inside there, pick "Development Settings". Make sure that the field "Debug App" has value "(none)".
Ok, I know I am a bit late with this one but I found a solution. It might be not acceptable for someone, but than again, it solved the problem.
I just reset my phone to factory settings. After that I was able to install the app without getting "waiting debugger to attach" message always.
I ran into the same problem these days, but none of the solutions above worked for me(except for factory reset, don't wanna do that for now).
As Kennifer stated, problem is with the device since this happens only on my Zync Z5 phone (I have several other devices with Android on which app start in Run mode, not Debug mode).
The only trick that worked for me was to delete the launch configuration every time wanted to run app after a debug, but it's annoying to do this every time I need a debug.
I'd tried everything on here and was surprised by the overwhelming acceptance of the top answer
Restart the device
then I realised, "this is a development phone, stop treating it like a business's server", and proceeded to restart.
Worth risking an answer to endorse this solution as a last resort.
My outcome- the app quickly, but quietly died. Result ! :(
My Eclipse version:
Luna.
My case:
The option Launch in debug mode when workspace contains breakpoints is Never, but eclipse launches in debug mode.
My Solution:
Go to Window->Preferences->Run/Debug->Launching.
Mark Prompt in option Launch in debug mode when workspace contains breakpoints.
Launch.
A dialog will popup: There are breakpoints enabled in the workspace. Would you rather launch in debug mode?
Check Remember my decision, then press No button,
and problem resolved.
I have seen this problem off and on while running the Eclipse (Galileo) under Fedora 11-13, whether the target is my device or an emulator. But now with my new device, the HTC T-Mobile G2 (Android 2.2), I see it much more frequently: I successfully download the app (complete with lots of Log.d() calls), the system successfully launches it, but the LogCat pane in the DDMS perspective is completely blank.
Sometimes, only sometimes, I seem to be able to kick it into action by clicking on the tool for Debug (the little bug one). But that doesn't even work all the time. Worse yet, it forces me to restart the whole program, which is very cumbersome.
And yes, I did remember to connect the device and make sure the device shows up under "adb devices", AND make sure that is the device the ADT downloaded to. I can even hit breakpoints in the code.
I suppose I could try relying only on the debugger, but I put a lot of work into writing those Log.d statements in the right place, it would be a giant leap backwards to do without them now. So any suggestions concerning what the problem might be, workarounds, or how to find relevant bugs logged against either ADT, SDK or the G2, would be welcome.
TIA
PS: Google searches such as "android ddms logcat" have not helped so far.
PS: I have also considered running ddms from the commandline, but the instructions on how to do this wtihout conflicting with the port already chosen by ADT for running DDMS are not clear enough to inspire confidence: so I always quit Eclipse before running the command line version of ddms. But then I lose the handy ability (provided by Eclipse) of navigating my source code while reading the log, so this too, is an inferior solution. Perhaps if someone can connect a few more of the dots in Google's instructions on this by explaining how to get the device and command-line DDMS to agree on a port while still running Eclipse, that would be a good solution.
Just to suggest the basics, when you click on the DDMS tab, is the device listed on the devices tab? (If devices isn't there, click Window->Show View->Devices) If it is listed, have you clicked on the device (on the name column). Sometimes if the device isn't clicked on it will not show the logcat.
If it is and you have selected the device - try clearing the log (the icon of a page with a red cross at the bottom right corener of it - located at the top right of the logcat panel) I find if I have had it running for a long time it sometimes fills up and stops displaying the log, although normally one line is shown.
It seems that ADT looses the connection with the device or is not re-connected when you reboot the device or emulator.
I've found that if you have more than one device or emulator you can click on the other one, click on the empty log window and the logs for this other device appear, then click the device that lost connection and will be re-connected.
Yes, sounds like black magic, but it's all we have...
It worked for me when I did following.
Remove the connection to the device (i.e. unplug the USB cable), then restart Eclipse. Next time it starts, you can see the LogCat is back on action writing logs.
Hope this helps.
I have experienced the same problem on and off.
Basically the logs were coming on console using "adb logcat" but not in the logcat view of eclipse. I've noticed that restarting the emulator , then restarting the eclipse and then relaunching the emulator from eclipse gets rid of this problem.