I have been trying to use my Nexus 5 as a debuggable device when working with Android Studio. I have used several different resources to get the device to display the RSA fingerprint (which I have accepted), but the device remains "unauthorized". I am currently running ubuntu 12.04 on a Dell XPS-13.
My desktop computer running Windows 7 has had no issues is instantly recognized and a valid debuggable device.
One issue I had just recognized after weeks of trying to get this to work is that in the AVD manager, under the Compatible column for this device when UNAUTHORIZED it says: No,minSDK(API8) > deviceSDK(API 1). I wonder if this could be related as the device is currently up to date.
Here are some of the things I have tried:
Updated 51-android.rules document with the following line, made executable:
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee2", MODE="0666", GROUP="john"
Series of adb kill/start-server commands
Accepted the RSA fingerprint in one single instance and permanently, deleted the key/re-accepted it.
Checked permissions of usb slot.
Changed device from media device to camera and back (this actually sometimes lets the "adb devices" command return a value of device for the phone, but then the abd process locks and crashes).
I haven't really seen anyone with the issue where they were able to accept the RSA fingerprint but the device remains unauthorized, or that the AVD manager reports deviceSDK(API 1).
Any help is greatly appreciated, thanks!
Edit: It should be noted that I'm a bit of a linux noob so keep that in mind.
I have also experienced this problem after upgrading from an earlier version of Android Studio to the latest 1.0 release.
My phone was in the "Unauthorized" state and the compatible column said
"No, minSdk(API18) > deviceSdk(API1)"
I fixed my issue with the following steps:
Firstly, when I upgraded Android Studio I inadvertently moved the SDK directory.
To make sure your SDK folder and environment variables match up, open the command prompt and run the following command:
echo %ANDROID_SDK_HOME%
If your SDK is in a different location correct the environment variable using the command:
setx ANDROID_SDK_HOME "C:\Android\sdk"
Now we know the SDK is pointing to the correct place at the command prompt navigate to the "sdk\platform-tools" directory and issue the commands
adb devices
adb kill-server
Notice in the image my device in the "unauthorized" state.
Now on the phone itself navigate to the developer options page and select "Revoke USB debugging authorization".
Now head back over to Android Studio and select "Run -> Run app" menu option.
Now, when you attempt to run your application your phone should pop up with the following dialog:
When you see this you should be home and dry. Now when you start adb it should be authorized.
Finally, if you are upgrading Android Studio from a beta make sure that your target SDK and minimum SDK are set correctly. Right-click on the app folder and select "Open Module Settings".
Hope this helps..
Related
First of all, this is my first post here and I'm a beginner so my apologies if this ends up being a stupid question or my format is wrong, but any help is appreciated.
Essentially my problem is in trying to set up Unity Remote 5 for debugging in Unity. However, I believe I've finally narrowed it down. The error I'm getting now seems clear:
CommandInvokationFailure: Unity Remote requirements check failed
C:/Program Files/Unity/Hub/Editors/2019.4.17f1/Editor/Data/PlaybackEngines/AndroidPlayer\SDK\platform-tools\adb.exe forward tcp:7201 tcp:7201
stderr[ error: device offline]
stdout[]
exit code: 1
I've looked into this error and came upon this: https://stackoverflow.com/a/39031464/14948855 which seems like it might be useful to me, however the issue is I don't know how to run the commands he suggested and stack overflow made it clear it didn't want me posting a question as a response to that question and I don't have enough prestige to comment.
I'm trying to run "sudo adb kill-server" from an ubuntu linux terminal on windows from the directory abd is in (C:\Program Files\Unity\Hub\Editors\2019.4.17f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platform-tools), but it won't run.
proof command not found
I've tried adding it to the path on my computer: I added the directory listed above to "Path" in my "Environment Variables".
My phone is plugged in, I've disabled and reenabled developer mode and usb debugging, and restarted Unity and my phone several times. Any help with running this command in ubuntu or cmd, or even the greater problem of Unity Remote 5 would be fabulous.
Thank you.
Edit: here's a better image showing my issue:
image showing how I've tried to add the folder to the path but it still can't be reached
Final Update:
All my problems have been solved, here's how I got unity remote 5 for android working for posterity:
step 1) Make sure phone is in developper mode (go to "about phone" in settings, tap build number 7 times).
step 2) Make sure "USB debugging" is turned on in developer options.
step 3) Make sure Unity is updated to the most recent supported version through Unity Hub (might not be required but I did this step).
step 3) Download android support module through Unity Hub.
note: if you downloaded current Unity version from the Unity website rather than through Unity Hub, it doesn't seem to let you add modules to it through Unity Hub.
step 4) The sdk path Unity specifies by default is wrong for some reason, so in preferences->external tools, disable the default path and paste in the right directory (should be something like: C:\Program Files\Unity\Hub\Editors\2019.4.17f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK) to be safe I did this for the JDK, NDK and Gradle too.
step 5) When you plug in phone, pull down your notifications, hit "tap to change USB options" and make sure phone is in "camera" mode or some variation. For me it was "Photo transfer".
Note: if you don't have the option to change USB options, try different usb ports/cables, if those don't work you might have debris in your charging port, clean it out with a dab of 91% or 99% rubbing alcohol and a tooth brush/tweezers (this will also make charger sit more snug in phone)
That might be enough to get it working for you, if not...
step 6) (Not sure if necessary) May need to update phone drivers in device manager on windows.
step 7) If Unity gives an adb error saying too many devices connected, it's possible you have a daemon running in the background which adb is picking up as an android emulator because it's using a port greater than 5555. It seems adb checks open ports above port 5555, and assumes anything it finds is an emulator. To check this, as indicated in my original question, and as stated here: https://stackoverflow.com/a/39031464/14948855, in cmd on windows use adb devices (if ur on linux may need to use sudo) to get a list of all devices being detected by adb. (Also use "adb kill-server" to reset it.) If there is an emulator being detected, it should include the port it's using in its name, in my case it was "emulator-5562" in port 5562, which was apparently actually NTKDaemon from Native Instuments, a random music production program I've only used once so far. I'd suggest googling the emulator port you find to try and narrow down the process taking that port. The only thing left to do is to kill the process running in the port. I found NTKDaemon in task manager and also disabled it activating on startup because that's just evil imo.
And that should be it. Hope that works for you if you're here for help.
(btw in terms of my original question, I was able to access adb.exe by changing the directory in cmd, but I still never found why adding the directory to the path didn't work, so if anyone has an answer to that I would be interested)
I know this question was asked a lot, but going through dozens of answers none have been helpful.
I'm attempting to run a simple hello world on my Huawei Mate 9 using Android Studio 2.3.1 (The APP is 4.X Jellybean API) running on Debian (Jesse).
-I have enabled debugging options on the phone (I can see developer options)
-Installed the SDK and ADB through the Android Studio.
-Device is being detected successfully on ADB devices.*
-I have tried MTP and PTP (currently it's on PTP)
Despite all different combinations I don't see my phone ready for uploading my program.
*With android studio closed:
when I check adb it usually never finds the phone the first time (adb devices) but after i do kill-server and start-server, i get the unique phone ID the second time I run adb devices. Needless to say, should I run studio after the second time around when it detects it, the phone still does not appear.
Thanks
Try this two solutions :
1) Go to setting and than in security and enable " Unknown source " to allow installation of apps from unknown source. If its still not working try second solution.
2) This problem can be due to unsupported adb driver of you mobile model. For this Download PdaNet+ a universal adb driver downloader for all devices. It will ask to remove current driver and go for it. It will fix all the adb driver related issue.
Link : http://pdanet.co/a/
So after rigorous search, I've found the reason for incapability of finding the phone in the android select deployment target menu is due to an option within a hash code menu.
You need to dial ##2846579## (works on Huawei 7 and onwards phones) in order to find a hidden window, for me it says ProjectMenu as the activity title name, then you must pick Background Settings->Background Debug->Open then restart your phone, should you have avd,android running well on your pc and debugging options activated on your phone this is all that's needed in order to deploy your app successfully.
I known there is lots of answers about this question, but still my mobile device not connected to eclipse IDE.
The following is what I already did:
1. restart adb or type command in cmd "adb kill-server/adb restart-server", eclipse find nothing in the devices.
2. execute netstat -aon|findstr "5037", finding there is only one process "adb" occupy the port
3. check the phone driver in device management, finding the phone is install correctly.
4. execute "adb devices":
List of devices attach
1f06cbba device
I thought may it's my phone's problem, so i remove it, and create a virtual device avd, the eclipse still don't work.
My Operating System is Windows 7 and Eclipse IDE Kepler.
can any body help me to successful run my first android helloworld?
Thanks a lot!!
additional explanation
debug mode is in phone is ON
adb is in the variable %path%(maybe some should answered)
try the latest adt-bunble in adroid website, it still don't work.
Try turning "developer options" on in your device. (Option you haven't tried).
To access these settings, open the Developer options in the system Settings. On Android 4.2 and higher, the Developer options screen 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.
Have you added adb in your class path variables? If not , you should append the class path with following paths :
path-to-sdk/android-sdk/platform-tools
path-to-sdk/android-sdk/tools
Try re-installing ADT Plugin. Worked for me last time.
Install your current mobile Adb USB driver and update Google USB driver
Check the MTP/PTP mode for your device:
http://lh3.ggpht.com/-8UMNs7Vg_dY/UVC6_6PnbDI/AAAAAAAAAIg/NjKOvAp9cDs/02-select-camera-ptp-mode_thumb%25255B1%25255D.png%3Fimgmax%3D800
In some devices you can find this under Settings->Storage->Menu Options(three vertical bullet squares).
When you say->the phone debug mode is open, i assume your developer options usb debugging is already enabled
I have read a few articles that BlueStacks App Player can be used to debug android apps via Eclipse, instead of the default android emulator.
Example article
But I think this refers to the Windows version, I was unable to get to it work on MacOS. Does anyone know how to debug using BlueStacks/eclipse on MAC?
adb connect localhost:10001
should do the trick.
Well, you can try another way:
1) First, open the DDMS via Window->Open Perspective->DDMS under Eclipse.
2) Then open BlueStacks App Player.(leave it opens)
3) After that switch back to Eclipse and you should notice there're two emulator under the Device tab.
Then click Reset adb under the small triangle at the Device tab.
After a few seconds, the another one emulator will disappear and you can proceed to the next step.
4) Then return back through Window->Open Perspective->Java under Eclipse.
5) Select your project and right click on it, choose Debug As->Debug Configurations
6) Under Android Application select your configuration or create a new one. On the Target tab choose Always prompt to pick deviceAfter this, select Apply then Debug.
7) Then select BlueStacks emulator in the prompt window, and finally select OK.
Alternatively, you can also open the BlueStacks App Player before Eclipse using the above steps(with minor changes).
For more info, visit the below links.(However, in Chinese...)
http://www.cnblogs.com/hbbbs/archive/2012/10/30/2746950.html
http://www.cnblogs.com/hbbbs/archive/2012/10/30/2746979.html
Hopefully this will help you.
C:\>cd Program Files (x86)\Android\android-sdk\platform-tools
C:\Program Files (x86)\Android\android-sdk\platform-tools>adb connect 127.0.0.1:5555
connected to 127.0.0.1:5555
C:\Program Files (x86)\Android\android-sdk\platform-tools>
Run Bluestacks.
open Command Prompt in Windows.
Go to Platform-tools using following command.
cd C:\Users\<username>\AppData\Local\Android\sdk\platform-tools
then write:
adb devices
With SDK tools 27 and later!
You get a list of devices detected by adb .. if BlueStacks-4 is installed you should see the device listed (emulator-555x).
For Mac users: localhost:5037 worked for me
BlueStacks bundles its own copy of adb, %PROGRAMFILES(x86)%\BlueStacks\HD-adb.exe. You can connect localhost with it, or any other command. BlueStacks 3 uses the default port 5555.
I made an Android Hello world app and I'm trying to load it onto my HTC Incredible. I believe it has 2.2 (how do I confirm that?)
Anyway, Eclipse gives me this message and then brings up the window in the screenshot below.
Automatic Target Mode: Unable to
detect device compatibility. Please
select a target device.
I'm on Ubuntu 64bit if that matters. I did turn on USB debugging on the phone. I told the phone to connect as a disk drive.
Any ideas how to get my app onto the phone?
Update: Do I need to perform these steps since I'm on Ubuntu? I doesn't mention what to do for Ubuntu 8.10 though.
Ok, it turns out I did have to follow all the instructions from this page. (The sudo stuff mentioned in other answers above didn't help.)
Here are the exact commands I ran for Ubuntu 8.10
You need to run the adb server in superuser mode (i.e. sudo adb start-server).
Try what EboMike said, run sudu adb start-server.
To answer your question "how do I confirm my phone is V2.2?" Press your phone's menu key, then settings, about phone, software information. The Android version is the number you're looking for. This shouldn't be important though for your hello world example.
Also, it's not important that you have the phone connect as a disk drive; this causes the SD card to be dismounted. It will actually cause problems if you run or debug an application that tries to access the SD card. You can just select charge only and use ADB/Eclipse's DDMS perspective to move files to and from the phone.
Here's an update answer in case anyone finds this thread from Google.
http://dimitar.me/how-to-connect-your-android-phone-to-ubuntu-to-do-developmenttestinginstallations-or-tethering/
The easiest way to this: Go to www.dropbox.com and sign up for a free account. Copy your .apk file from your project's /bin directory to your Dropbox. Download and install the free Dropbox app from the Android Market. Navigate to your .apk file on the Dropbox app and click it to download and install on your phone.
These are the steps I took on Arch Linux to resolve the same problem:
As mentioned in some of the other replies you will need a udev rule for the device. In this example I am using an HTC Desire.
(for HTC you'll need to use "0bb4")
Get the correct Vendor and Product IDs
run lsusb with the handset plugged in and you should see something like Bus 001 Device 004: ID 0bb4:0c87 High Tech Computer Corp. Desire (debug)
'0bb4' is the Vender ID: HTC
'0c87' is the Product ID
Make a udev rule using the values you've just retrieved
Now make a udev rule as root using:
$ sudo vim /etc/udev/rules.d/51-android.rules
Add the following (this is for HTC Desire - edit accordingly):
## Rule for an HTC Desire Android Phone
SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", ATTRS{idProduct}=="0c87", MODE="0666", GROUP="users", NAME="HTC Desire"
GROUP defines which Unix group owns the device node.
At this point I rebooted and found that my handset was detected. Supposedly you can reload udev rules using the following but if this doesn't work try rebooting.
$ sudo udevadm control --reload-rules
in eclipse: go to Run menu -> Run configuration. Right click on android application on the right side and click new. Fill the corresponding details like project name under the android tab. Then under the target tab. Select launch on all compatible devices and then select active devices from the drop down list. Save the configuration and run it by either clicking run on the run button on the bottom right side of the window or close the window and run again
Cheers !