2

I'm using Linux Mint Sylvia on a pretty old laptop that do not support the emulators. Therefore I try to connect my Sony XA2 (pretty new with Oreo, 8.0)

I'm trying to detect my device but I seems to have some problem with Android Studio and the ADB-service.

In the log I get:

9:39 PM Unable to detect adb version, adb output: /home/fredrik/Android/Sdk/platform-tools/adb: 1: /home/fredrik/Android/Sdk/platform-tools/adb: Syntax error: "(" unexpected

If I run the lsusb I can find the device:

Bus 002 Device 011: ID 0fce:51f7 Sony Ericsson Mobile Communications AB

I tried to run the adb devices, but first I got this:

adb devices
The program 'adb' can be found in the following packages:
 * adb
 * android-tools-adb
Try: sudo apt install <selected package>

So I installed the adb with:

sudo apt install android-tools-adb

Then I could run the adb like:

adb devices
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached 
CQ3000KKV4  unauthorized

But still I got the error above in Android Studio.

Do you guys got any clue? Best regards Fredrik

Alex P.
  • 30,437
  • 17
  • 118
  • 169
user2902165
  • 303
  • 2
  • 14

2 Answers2

1

Adb after installation seems to run correct.

Your device is listed as unauthorized so I guess you did not turn on developer tools on your device, or on your device you did not accept debuging with connected computer.

To turn on developer options on device:

  1. Open Settings on your Android O running device.
  2. Select System » About phone.
  3. Scroll down and tap seven times on the Build number entry.
  4. Now go back to Settings » System » and select Developer options from there.

In these options you should allow usb debuging if it’s not on by default.

After connecting usb cable to your device and conputer you should see prompt on your device asking for permissions to allow debuging. If you accept that you should be able to run adb tools, logcat etc on your connected device.


EDIT

Looking at the error you described in comments, it looks like it is error specific for 32-bit version systems. So I see there two possible solutions:

  1. reinstall your system for 64-bit version

or more likely:

  1. downgrade your adb platform tools

How to downgrade adb platform tools:

Hope it will be your case. Please keep in mind that updates of Android Studio will probably restore that error again.

deevee
  • 1,550
  • 15
  • 21
  • Hello! Thanks for your answer. I actually did some progress. My device is in developer mode and usb-debugging mode. How ever, you wrote "...or on your device you did not accept debuging with connected computer.", this time I did like: 1) Plugged in device, 2) Started computer. 3) Selected file-transfer-mode on device. 4) started adb service, got:adb devices * daemon not running. starting it now on port 5037 * * daemon started successfully * List of devices attached CQ3000KKV4 unauthorized – user2902165 Apr 27 '18 at 05:51
  • 6) Run it again, got: adb devices List of devices attached CQ3000KKV4 device ...But still not showing up in android studio. All help is app appreciated. – user2902165 Apr 27 '18 at 05:54
  • 5) I got a new popup question asking for usb-debugging (even though it is already configured) and I marked it always for this computer. – user2902165 Apr 27 '18 at 07:01
  • Yes, this popup is what I written in my answer (prompt on your device asking for permissions to allow debuging) - ok, now you accepted that and adb is working, your Android Studio should list your device. If not try restarting Android Studio and/or reconnecting your device – deevee Apr 27 '18 at 07:04
  • I will try it out asap, thanks! I'll be back! – user2902165 Apr 27 '18 at 07:05
  • How do you check it that your AS doesn't see your device? Is Logcat working? What happens when you run adb commands from within Android Studio terminal? You can try restarting/updating your Android Studio or try connecting with another device. If adb is working and connecting with device AS should see it as well – deevee Apr 27 '18 at 07:11
  • Hello! I got this error in the Device file explorer: https://snag.gy/2dEXLr.jpg – user2902165 Apr 27 '18 at 15:07
  • I also got this message from AS when I entered Logcat: https://snag.gy/QVxprI.jpg – user2902165 Apr 27 '18 at 15:10
  • If I understand you correct you mean that I should run adb commands from the embedded terminal, looks like AS-ADB finds the device but not AS: https://snag.gy/g8O3W4.jpg – user2902165 Apr 27 '18 at 15:14
  • In my first post, in the log it says "Syntax error: "(" unexpected" that sounds really bad to me, what do you think? – user2902165 Apr 27 '18 at 15:15
  • All right, so I finally see what error you are dealing with. You have a bug in adb platform tools related with **32-bit systems**, you can try **downgrading adb platform tools - I updated my original answer with steps to downgrade them**, please give it a try – deevee Apr 27 '18 at 21:16
  • Hello, some progress after I followed your instructions. Now the The device is detected https://snag.gy/J3RlAH.jpg, but I needed to install plackages for 26, https://snag.gy/XR7KsA.jpg. How ever my app does not show up in device when I go forward. In the Logcat I get a lot of logging. I will try to see if I can find any error message, else I think you should consider this issue as solved. Perhaps I better create a new question. Best regards Fredrik – user2902165 Apr 30 '18 at 14:39
  • I get a lot of this exception i my log: 04-30 16:41:56.851 3194-4856/? E/WakeLock: CMWakeLock was already released! java.lang.RuntimeException: WakeLock under-locked CMWakeLock at android.os.PowerManager$WakeLock.release(PowerManager.java:1407) at android.os.PowerManager$WakeLock.release(PowerManager.java:1369) at ajqh.b(:com.google.android.gms@12529023@12.5.29 (040408-192802242):21) at ajqh.b(:com.google.android.gms@12529023@12.5.29 (040408-192802242):31) at dhi.handleMessage(:com.google.android.gms@12529023@12.5.29 (040408-192802242):8) – user2902165 Apr 30 '18 at 14:43
  • Ok great, so if the answer helped to solve original issue, please consider marking it as accepted answer. About further app developing and debuging creating new question will surely be cleaner – deevee Apr 30 '18 at 14:45
  • Hello, yes I think that is a good idea. Thanks alot for all help amigo! – user2902165 May 02 '18 at 05:46
0

There are other problems that manifest as showing unauthorized even when developer mode is on to allow usb access. Sometimes in Linux you may be running adb in user mode which may not allow usb access. In this case I've needed to disconnect adb and restart it using root privileges.

adb kill-server
sudo adb start-server
RightHandedMonkey
  • 1,718
  • 20
  • 25