I know this question was asked before but I tried all the suggested solutions and nothing solved my problem yet.
I can't debug Any Android studio (1.5 preview 2) application using Mac Yosemite.
the error I get is:
Unable to open debugger port (localhost:8600): java.net.ConnectException "Connection refused":
on the debug console I can see error
"Debug port is busy"
I've tried the following with no success:
reinstall jdk 6+7
make sure ports 8600+ are open with with kill .
reinstall Android studio and make sure SDK location configured.
add debuggable true on debug build types.
restart the phone with usb debugging enable.
restart Android studio and my mac.
tried with Build variant debug and release.
on emulator I have the same problem.
with eclipse I dont have any issues with debugging my app.
did I miss something?
This happens to me after updating to AS 1.4 all the time.
I always kill the server and restart it with following commands.
# /path/to/android-sdk/platform-tools/adb.exe
adb.exe kill-server
adb.exe devices
>>> * daemon not running. starting it now on port 5037*
>>> * daemon started successfully*
>>> * 2100000020000001 device
Afterwards I can reconnect with the debugger.
If you add adb.exe to the PATH-variable you can run the commands from the built in terminal in Android-Studio.
For me nothing helped except - Reinstall Android studio and don't choose the option to import your properties from latest Android studio installation. solved the problem.
when I installed and pick the option to import my last installation properties i had the same error again.
Related
I am trying to do some remote debugging in Android Studio.
Recently I've had an issue where an extra device will pop-up named Unknown Device so when i run adb tcpip 5555 I get the error message: error: more than one device/emulator
So I need to get rid of this Unknown Device
So far here is what I've tried:
adb kill-server
Invalidate Android Studio Cache and restart
Restart my computer
Looked for anything in ~/.android/avd/ which may cause it (There was nothing)
Ran Android Studios troubleshooter which restarted adb
None of the above worked, does anyone have any idea what this Unknown Device may be, and how I can get rid of it?
Alright, so I did a check for updates in android studio, and there was a minor update available. After installing the minor update, the problem went away - It must've been some bug in whatever Android Studio version I had.
I have searched the internet and tried everything I have come across, but I cannot figure out what I am doing wrong. I cannot attach the debugger to my Android process in Android Studio.
I have built an app in Android Studio 2.3.3 on a virtual machine using VirtualBox and running Ubuntu 16.04.2. I have installed the app on my device, a Getac Data Logger, and have noticed that my app opens for a couple of seconds, displaying a blank white screen, and then crashes. So, I have attempted to debug the app on my device to find the problem. When I click on the "Attach debugger to Android process" icon, I can see my device as an option, however, when I select my device the OK button is grayed out. There is no way for me to move forward with this process. Sometimes the warning "debug info can be unavailable, please close other application using ADB: Monitor, DDMS, Eclipse" pops up, but not every time.
Does anyone have any ideas as to what I am missing? Does it have something to do with the limitations of working on a virtual machine?
Things I have tried:
Making sure I have allowed USB debugging on my device
Selecting all kinds of combinations of show all processes/auto/java/etc
Commands: adb kill-server, then adb start-server; adb kill-server, then adb -P 5038 start-server
Waiting to plug in my device until I launch the debugger attachment
Building debug variant
Adding android: debuggable="true" to my application in my AndroidManifest.xml, then noticing it was not necessary after building the debug variant and taking it back out
Disabling and re-enabling the ADB integration through Tools/Android/Enable ADB integration
Closing Android Studio and then opening it again
Changing the adb port
Invalidating cache/restart
Uninstalling the app, clean build, reinstalling the app
Installing the MTP using the command: apt-get install mtpfs. It says that mtpfs is already the newest version, but the Ubuntu error "Unable to open MTP device '[usb:001,021]'" does persist, just not always.
Revoking USB debugging authorizations, exiting out of Android Studio and my VirtualBox, rebooting everything, and setting it all up again.
PLEASE NOTE:
I am brand new to development (a little over a year experience in web development), brand new to app development (this is the very first app I am creating), brand new to Android Studio (again, very first app).
My device is showing up in the debugger as an option. It is just that the OK button is grayed out, no way to move forward.
I do NOT have Eclipse or Monitor (and therefore not DDMS either) running.
EDIT: I have noticed that "#com.android.ddmlib - Adb rejected connection to client '[numbers]': closed" is showing up in my terminal several times with several different number combinations. Not sure what this means. Perhaps I am running DDMS? I thought that was something that runs through Monitor?
Unplug your phone from your PC. Then plug it back in. On the pop-up, make sure you set it to “Media Sync (MTP)”.
I had intellij Idea IDE and Android Studio 4 Canary were open with Android projects at the same time, after closing both the IDEs and opening only android studio, I was able to attach the debugger to the app process.
I cannot attach the debugger in Android Studio while running debug on a phone.
I’m currently using a Samsung S4, running Android 4.4.4 (but have tried an S5, S6, S7, and Moto E phone on various Android versions). It times out when I try to run it with either of the following errors:
I/System.out: Sending WAIT chunk
W/ActivityThread: Application is waiting for the debugger on port 8100...
Or
failed to open debugger port localhost:8600 java.net.ConnectException "connection refused"
and the App says:
Waiting For Debugger
Application (process ) is waiting for the debugger to attach.
Force Close
Android Studio version:
Android Studio 2.2.2
Build #AI-145.3360264, built on October 18, 2016
JRE: 1.8.0_112-release-b05 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac version:
10.11.6 (15G1004)
I can successfully connect and run the application, I just can’t get the debugger to attach when I do Run > Debug App > select the connected phone > OK.
I have been able to run the app in debug on other computers (both Windows and Mac) with the same phones.
Various approaches I have tried from hours of debugging and online searching:
Invalidate Caches/Restart Android studio
Check for anything else running on ports 8100, 8600, 8601, etc., nothing comes back when I run the following from bash:
$ # while Android studio is trying to attach the debugger
$ lsof -i :8100
$ lsof -i :8600
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
studio 6282 peter 125u IPv4 0x973c7e31bda641ab 0t0 TCP 192.168.1.16:64022->ip-166-62-27-181.ip.secureserver.net:asterix (SYN_SENT)
$ lsof -i :8601
$
$ # after Android studio fails to attach the debugger
$ lsof -i :8100
$ lsof -i :8600
$ lsof -i :8601
$
Run Tools > Android > Android Device Monitor - it shows my device, but I can’t run Android Device Monitor while I’m trying to debug the app, it says, “Monitor will be closed to enable ADB integration. Continue?” I haven’t found anything useful here.
Searching for and killing adb processes
ps aux | egrep '(adb|java)'
... then doing `kill <pid>` or `kill -9 <pid>` if necessary for the found ones
Restart Android studio
Restart my computer
Update Java JDK from the Oracle website—however, I’m not sure why Android Studio still says, “JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o”
Completely uninstall and reinstall android studio - e.g., https://stackoverflow.com/a/18458893/376489 - weirdly, I think this worked for one run of the debugger and then not again…
Tried Run > Attach debugger to Android Process - this didn’t help
Tried running:
~/Library/Android/sdk/platform-tools/adb kill-server &&
~/Library/Android/sdk/platform-tools/adb start-server
Tried unchecking Run > Edit Configurations > Run/Debug Configurations > Skip installation if APK has not changed
Check System Preferences > Security & Privacy > Firewall - this is turned off
Update 1: tried revoking permissions on the phone as well as restarting it
Update 1: muted all breakpoints Android Studio
Are there any other ideas for what might be going wrong or anything meaningful in the details I added above?
Quite embarrassing, but it looks like some time ago I had entered an ip address into my /etc/hosts file to test something as localhost and never removed it. I found a comment on another post saying to check that the following is in your /etc/hosts:
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
Upon commenting out that spurious line, the debugger is now working. Given I have a dozen or so other IPs in that file (so I can more easily test remote hosts with a friendly name), I must have not noticed this one at the bottom. I think a more foolproof approach to verifying if this is the problem or not is to ping localhost and verify that it resolves to the ip address of 127.0.0.1, e.g.,
$ ping localhost
PING localhost (127.0.0.1): 56 data bytes
Great comments and suggestions from other folks here too, thanks!
I just experienced the same issue. It seems, as if Android Studio Version 2.2 has some issues with a non-attaching debugger as you can see for example here and here.
In my case the following helped:
Remove the launch profile for your app by going to Run -> Edit Configurations... and removing the profile there. Don't forget to hit the OK button after you have removed the profile. :)
Create a new launch profile from scratch by again going to Run -> Edit Configurations..., hitting the + button, selecting an Android App launch profile and selecting your start module. The other default values of the profile were just fine.
Hope this helps you as well.
I am using a real device. Simply deleting the app on the device, and then running from Android Studio solved this issue.
It seems Android Studio had trouble with overwriting the file that was already on the phone.
1.try cleaning project Build->clean project
2.do file->Invalidate/cache restart
if above not helps you..
3.try to change the data cable you are using to connect your phone.
if nothing above helps, install Android wifi ADB plugin and try to do debug over wifi.
Support for a true debug build. Developers no longer need to add the android:debuggable attribute to the tag in the manifest — the build tools add the attribute automatically. In Eclipse/ADT, all incremental builds are assumed to be debug builds, so the tools insert android:debuggable="true". When exporting a signed release build, the tools do not add the attribute. In Ant, a ant debug command automatically inserts the android:debuggable="true" attribute, while ant release does not. If android:debuggable="true" is manually set, then ant release will actually do a debug build, rather than a release build.
In my case i struggling this issue with 5 hour and found that the
minifyEnabled true is the main culprit so change
minifyEnabled false work for me
My app build.gradle file look like
buildTypes {
debug {
signingConfig signingConfigs.debug
minifyEnabled false
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
I also got same error and this thing worked for me
1. Open Android Studio -> Terminal
2. Change directory to $Android SDK Path$\platform-tools
3. Write command adb get-state and hit enter.
Then you will get this output
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
I have the opposite problem with Android Studio 3.3, trying to debug a wi-fi-connected phone.
After selecting the device in Android Studio, I receive the following message:
Error running 'app': Unable to open debugger port (localhost:8600):
java.net.ConnectException "Connection refused: connect"
I also have IPV-6 enabled on my network.
The issue is that "localhost" resolves to ::1 on my machine by default, but ADB studiously binds explicitly to 127.0.0.1. I happen to know this because I spent the day trying to make ADB connect to emulators running on a remote machine (not since Android 4.4 unfortunately.
To solve the problem, add the following line to \windows\system32\drivers\etc\hosts:
127.0.0.1 localhost
This problem was driving me crazy for about 2 weeks. What finally fixed it for me was changing "auto" to "java" in the debugger process selection window like this:
Try using below commands on terminal-
adb kill-server
adb start-server
It works well.
Simply not using my google pixel 1st gen and using my new Nokia 7 plus fixed this issue :).
There is a known issue with Android Studio 4.2.1 on Ubuntu 20.04 when debugging native code.
There is an easy way to check if you are concerned, just run the following command line that should not finish with an error:
${android-studio-dir}/bin/lldb/bin/LLDBFrontend
At first i tried all the above ways, did not help.
I have two computers with same settings.
But at one worked at other error.
It's given me an idea that it can be "hardware" problem.
I switched USB to other slot with USB3.0 and used short cable and
WOW it began work.
I suggest there some delay in USB2.0 (polling), therefore process begin out of synch.
I am getting this type of error
error: could not install smartsocket listener: cannot bind to
127.0.0.1:5037: Only one usage of each socket address (protocol/network address/port) is normally permitted. (10048) 1:34:26
PM could not read ok from ADB Server 1:34:26 PM * failed to start
daemon * 1:34:26 PM error: cannot connect to daemon 1:34:26 PM
'C:\Users\MITESH
SUTHAR\AppData\Local\Android\Sdk\platform-tools\adb.exe,start-server'
failed -- run manually if necessary 1:38:14 PM Unable to obtain result
of 'adb version'
my genymotion device is running but it shows me that no device
I came across the same error. I provided the below command and the issue got solved.
COMMAND :- taskkill /f /im adb.exe
Close Eclipse or Android Studio if either is running (Optional).
Open Command Prompt.
Go to the Android SDK platform-tools directory.
Type adb kill-server.
Type adb start-server.
If no error message is thrown while starting ADB server, then adb is started successfully.
OR
Go to Task Manager, open the Processes tab, and end the adb.exe process.
Then restart Android Studio.
This may work if there is any problem with adb.
In my case, none of the above solution worked. I solved it strangely maybe it can be a bug.
Do not run Genymotion emulator before Android Studio. Firstly, I opened android studio then I clicked run project and select deployment target windows appeared. Then I run genymotion emulator and now the emulator is shown in the select deployment target windows in Android Studio. Then deployed to the emulator without errors. Done!
As another way, you can try to set Genymotion sdk to the same as Android studio sdk. To do this, first find your sdk location. You can find it by right clicking the Android Studio project -> Open Module Settings-> Select SDK location -> under Android SDK location, it is shown. Then open Genymotion -> Settings -> ADB tab -> Click Use custom Android SDK tools radio button -> navigate to SDK folder used by Android studio -> Restart Genymotion virtual device
If none of the above worked for you, just make sure that you have closed Genymotion emulator as it caused this issue with me.
Easiest Way! I just ran into this issue trying to connect a React-Native App to an Android Studio emulator. If you read the error message it tells you that "Only one usage of each socket address (protocol/network address/port) is normally permitted." So you can assume that something other than React-Native is also attempting to connect to the emulator.
Terminate The Connections:
Leave the emulator running.
Close out of and uninstall any Android Studio/Eclipse Apps you have on the emulator. This terminates apps trying to connect.
Close Eclipse or Android Studio if either are running. Android Studio doesn't have to be open in order for the emulator to work (This is important). This terminates software trying to connect.
After doing so I went back into my React-Native App and connected to Expo no problem.
All you have to do is terminate all connections. However you so choose.
I came across the same error, it worked simply after restarting the AS on windows, of course, it asked for SDK update.
Android Studio 4.1.3 with API 30 installation has this error
01-04-2021
09:56 'C:\Users\ranja\Android\Sdk\platform-tools\adb.exe start-server' failed -- run manually if necessary
Tried C:\Users\ranja>adb start-server
daemon not running; starting now at tcp:5037
**could not read ok from ADB Server
failed to start daemon
error: cannot connect to daemon**
Note: I have added 'C:\Users\ranja\Android\Sdk\platform-tools' in %PATH% environment variable on Windows 10
i've encountered same error in my ionic 2. i just uninstall and reinstall ionic. and it works fine again..
npm uninstall -g ionic
npm install -g ionic
I'm following some tutorials about building apps in Android Studio, but for some reason it's not launching/installing the latest version of my app when I click 'run'. I have to manually uninstall the app on the phone and then click run after making changes in Android Studio for the app to get updated. Any ideas?
Here is the console output:
Waiting for device.
Target device: htc-htc_one_m8
Uploading file
local path: /home/brandon/AndroidStudioProjects/JustJava/app/build/outputs/apk/app-debug.apk
remote path: /data/local/tmp/com.example.android.justjava
No apk changes detected. Skipping file upload, force stopping package instead.
DEVICE SHELL COMMAND: am force-stop com.example.android.justjava
Launching application: com.example.android.justjava/com.example.android.justjava.MainActivity.
DEVICE SHELL COMMAND: am start -D -n "com.example.android.justjava/com.example.android.justjava.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.android.justjava/.MainActivity }
Waiting for process: com.example.android.justjava
Connected to the target VM, address: 'localhost:8638', transport: 'socket'
Disconnected from the target VM, address: 'localhost:8638', transport: 'socket'
No apk changes detected. Skipping file upload, force stopping package instead.
Android Studio thinks that there are no changes and doesn't install the new APK. A workaround is to disable the "Skip installation if APK has not changed" option in Run > Edit Configurations.
I'm using Android Studio 1.4
Source: https://code.google.com/p/android/issues/detail?id=160901
Android Studio thinks that there are no changes and doesn't install the new APK. A workaround is to disable the "Skip installation if APK has not changed" option in Run > Edit Configurations >Android Application > app >Miscellaneous .
Then uncheck "Skip installation if APK has not changed".
Another problem like this is instant Run you can manage it by :- Just go to "File -> Settings -> Build, Execution, Deployement -> Instant Run" and just disable it. With this Android Studio builds from scratch each time but it's better than not building it right.
This is actually a bug
you can find more info Android Open Source Project - Issue Tracker
Disabling instant run option in edit configuration and adding -r flag to the install flags is best work around for now.!
option in Run > Edit Configurations >Android Application > app >Miscellaneous . Then uncheck "Skip installation if APK has not changed".
THEN --> option in Build > clean project and rebuild project
and reinstall APK in your device.
THIS WORKS FINE FOR ME, HOPE THIS HELP OTHER ALSO
Another reason why the app might fail to install/start is if you've set up a "work profile".
The app might still be installed in your "work" profile and thus won't be re-installed nor uninstalled when starting through Android Studio. The "main"-profile portion of the app is "disabled" though and thus the activity can't be started.
Solution: manually uninstall the work-app, then redeploy from Android Studio.
Sometimes when I get this I just kill the app on the device, then run it. Throw in a log statement to clarify you're on the right build, just something that you know you changed for this build.
I have tried all of above solution but didn't work for me.
I solved by Opening a new project or some other existing project (being in current project) in a new window and then I closed the previous one..
I opened again the previous one and clicked on run and it worked for me like a charm..:)
Run on a Phone
Set up your device as follows:
Connect your device to your development machine with a USB cable. If you're developing on Windows, you might need to install the appropriate USB driver for your device. For help installing drivers, see the OEM USB Drivers document.
Enable USB debugging on your device by going to Settings > Developer options.
Note: On Android 4.2 and newer, Developer options is hidden by default. To make it available, go to Settings > About phone and tap Build number seven times. Return to the previous screen to find Developer options.
Run the app from Android Studio as follows:
In Android Studio, click the app module in the Project window and then select Run > Run (or click Run in the toolbar).
In the Select Deployment Target window, select your device, and click OK.
Please refer the link