Reputation: 321
I am trying to connect an Android Studio Emulator to my expo application, but I get this error message:
Couldn't start project on Android: Error running adb: This computer is not authorized to debug the device. Please follow the instructions here to enable USB debugging: https://developer.android.com/studio/run/device.html#developer-device-options. If you are using Genymotion go to Settings -> ADB, select "Use custom Android SDK tools", and point it at your Android SDK directory.
Does anyone know what to do with this?
Thanks!
Upvotes: 32
Views: 84945
Reputation: 190
There are two ways of doing this.
First step: Open android studio > virtual device > click on more_vert > select wipe data
Second step: Open your command prompt and use this command
>> adb -e emu kill
or
If Expo CLI is running, stop it with ctrl+c -- this will stop ADB.
Disconnect your Android device from the computer. Revoke USB Debugging on the device: Open the Settings app on your device. Navigate: Developer Options -> select Revoke USB debugging authorizations. Reconnect the device: The device will prompt you to agree to connect the computer. You must confirm it. The computer is now authorized for debugging!
Upvotes: 0
Reputation: 1792
I spent an hour to find out how to fix that problem, when I finally realized that I plugged my phone to get charged into the same computer I work on while using the emulator.
Upvotes: -1
Reputation: 54
Updating expo-cli globally fixed it for me. Remember to run it with admin privileges then restart android studio and wipe android data.
npm install -g expo-cli
Upvotes: 0
Reputation: 51
This computer is not authorized for developing on. https://expo.fyi/authorize-android-device
I resolved this issue by choosing a device without the google play store (play button).
Upvotes: 0
Reputation: 103
I know the exact answer of this question The Problem is your AVD manager is not set to the path Than you have add to path first is ANDROID_SDK_ROOT and PLATFORM-TOOLS HERE I GIVE ALL THE LOCATION PLATFORM TOOLS - C:\Users\YOUR_USERNAME\AppData\Local\Android\Sdk\platform-tools ANDROID_DK_ROOT - C:\Users\YOUR_USERNAME\AppData\Local\Android\Sdk ADD in path (SEARCH ON START EVIRONMENT VARIABLES) and than restart your pc
Upvotes: 2
Reputation: 7
today I experience the same issue but I have fixed it very easily. Try the solution it might work for you too. Many developers have wsl or windows subsystem for Linux and it is using a VM and I found it blocks the android sim and causes the error "Error running adb". The solution I found was to open my PowerShell and type "wsl --shutdown". After rerunning the script for android emulation from expo it worked like a charm. Hope I helped.
Upvotes: 0
Reputation: 4729
I was facing the same issue. I am using windows machine. Steps I did to resolve:
I have added the environment variable.
ANDROID_SDK_ROOT
to your android studio path, like in my case it is: C:\Users\kushalseth\AppData\Local\Android\Sdk
C:\Users\kushalseth\AppData\Local\Android\Sdk\platform-tools
To Validate, run the command: adb
in command prompt.
(Also check, if you are logged-in to expo from cmd. This is an extra precautionary step.)
Upvotes: 2
Reputation: 1
Open the Android Virtual Device Manager(AVD Manager).
And in your current virtual device on the right side, there will be a dropdown icon, and click that icon.
In the dropdown list there will be a Wipe Data and click it.
And Run your Emulator
Upvotes: 0
Reputation: 1
For Windows:
Select 'Wipe Data' option in the AVD manager and restart again.
Or
Add SDK tools path eg: E:\Android\SDK and SDK platform-tools path eg: E:\Android\SDK\platform-tools in the windows system environmental variables. (In my case I have installed SDK inside the E directory)
Upvotes: 0
Reputation: 137
Upvotes: 2
Reputation: 31
I was using the emulator from Android Studio for my expo projects. It used to work properly. Then, one day the emulator stopped interacting with expo, always saying:
This computer is not authorized for developing on . https://expo.fyi/authorize-android-device
The advices given on that link did not help. Revoking the USB permissions did not help either. Even newly created Devices in AVD Manager did not let me connect.
However, finally this answer solved the problem for me
Choosing a device from AVD Manager without Google Play Store on it let me connect expo to the emulator, again.
Note: I could not get to the root cause of the problem, so I am still not sure why it stopped working all of a sudden. I upgraded to Expo SDK 39 at the same time that I switched from managed workflow to bare workflow. So, one of those circumstances may have caused the problem.
Upvotes: 1
Reputation: 1742
enjoy :)
Upvotes: 3
Reputation: 39
I had the same issue and it almost took one day to figure that out. First try enabling the USB debugging mode, still if it shows the same error try the next step. Try to check ADB devices in cmd, if it doesn't work go and change the environmental variables of the android SDK manager.
And refer this link https://medium.com/@vsburnett/running-a-react-native-app-on-an-android-virtual-device-with-expo-in-windows-10-9e0976db5f50
Upvotes: 0
Reputation: 3415
Enter your BIOS settings on boot of your machin and enable Virtualization Technology. The location may differ depending on your processor.
Upvotes: -3
Reputation: 171
I had this problem today, I just disabled USB debugging and enabled it again. Worked.
Upvotes: 6
Reputation: 287
What has worked for me just now:
Upvotes: 27
Reputation: 557
Try running a lower version of the android emulator from android studio. I was getting the same error while trying to run the latest expo-react-native
app on android emulator version 9.0 Pie
. I got it working by running a lower version of the android emulator version 8.1 Oreo
. You also have to tab allow/ok on the phone screen when asked for enable USB Debugging
during the app booting on the emulator.
Upvotes: 0
Reputation: 5107
tldr:
Look at the emulator "screen" and accept the prompt asking if you want to allow debugging.
I got that message you described in the question when I did the following:
npm start
(which runs expo start
)
The provided link didn't seem to pertain to the emulator.
I didn't realize at first, but the solution was waiting on the screen of the emulated device. It was quietly showing a standard Android permission prompt, asking for permission to allow debugging the device. This prompt is described in the "note" in https://developer.android.com/studio/command-line/adb#Enabling,
Note: When you connect a device running Android 4.2.2 or higher, the system shows a dialog asking whether to accept an RSA key that allows debugging through this computer. This security mechanism protects user devices because it ensures that USB debugging and other adb commands cannot be executed unless you're able to unlock the device and acknowledge the dialog.
This of course I would expect for a phone, but didn't think of it for an emulator.
Once I granted that permission in the emulated phone, then expo proceeded to run on the emulator.
Upvotes: 8
Reputation: 661
I discovered that "USB Debugging" had been turned off in the Developer Options of the emulator. Turning it on fixed the problem. No idea how it came to be turned off.
Upvotes: 5