Android studio Emulator ( device unauthorized) - android

I know that on a normal device I have to authorize the debugging process, but Authorizing it on an emulator is my first time.
I just installed my first emulator on my home pc to do some work stuff, and this poped up.
Any idea what is the cause or is it normal for android o api 26 google play SDK?
PS: I am using windows version at home.

Issue Resolved.
Step 1- Made a new emulator(Any).
Step 2- then fixed another problem the black screen by changing the settings to use hardware graphics.(Dunno if this problem was related to the bug)
And Bam every thing worked.

when this happens you can request permission through the emulator
demonstrative video
But on the android Q api 29 emulator, when USB debugging is requested, the alert is gone before it can be confirmed, and the emulator bugs, preventing the emulator from connecting. I am not able to solve, just resetting and losing everything to solve.

TOOLS-->AVDMANAGER
Click on tooltip on the right side, you can see wipe data before doing that turn off your emulator.
This Worked for me.

I was facing the same issue and tried all most all the suggested steps but following worked for me :
Steps:
Delete all the emulators with google play.
Create new emulator without google Play .
Now if you run the emulator, no authorization issue will be there
Or
An another approach to fix this issue is :
Steps:
let your emulator launch
Go to settings and enable the "USB debugger" option as you normally do in real time devices(5 click on Developer Options->build number)

I found a mismatch between the .android/adbkey* files associated with the user running the process running adbd, and the same file associated with the user running the emulator.
I don't know about windows, but this is possible in Linux if you run adb as root to work around file permissions.
Fix: As the user running the emulator, type this into a command shell:
adb kill-server; adb devices

Delete your Emulador, then Create an emulador without google play services, it can be Android Q (Android 11).
It worked for me.

For this to work for me I had to start a new emulator from android studio with Oreo instead of Pie as a system image.

Just delete the ~/.android folder.

I also face the same issue and its generated because I copied my SDK from one PC to another PC with Same configuration(Software and Hardware). Now I create an emulator on Pie and also tried Oreo but unauthorised comes for both.
Solution:
I delete my build tools, platform tools, emulator only not complete SDK and download all of them again. Now I create my emulator for all type of Version and now no unauthorised error for all type of emulators.

Keep the Emulator on
Delete android folder using
rm -rf ~/.android
Then restart adb
adb kill-server
You should get a prompt on the emulator to allow USB Debugging
View the device status
adb devices
This should fix the issue, I used this to fix when I was having issues launching the emulator from expo when making a react native app.

Had the same issue, none of the answers here worked, eventually found the following worked for me:
Create a new emulator without Google Play and start it, visual studio detects it on first start and the device will be authorised.

I fixed this issue on my Arch Linux while I'm developing Flutter apps, by deleting all of the emulator devices and create a new emulator without the Google Play Store.
Also, in the Graphics setting don't forget to choose Hardware Graphics instead of Automatic and the device will be available and detected.

Create an emulador without google play services,
it can be Android Q (Android 11). It worked for me.

I fixed it on Win10. When adding new device, choose Android 11 (without Google play)

Related

Android Studio not installing app on device, no error messages

I have a clean Android project on Android Studio (just with a "hello world' screen), and I'm trying to install the app on my Samsung Galaxy S10e.
I click the Run button, and this is what I see in the Build Output:
And the apk is generated successfully.
But it's not launched and not installed on the device (no icon, and it doesn't appear in the apps list).
When I try manually installing the apk by adb install app-debug.apk, it works. The app shortcut appears on the device, it's added to the apps list, and I can launch the app.
At first also adb install didn't work, giving out the error INSTALL_FAILED_TEST_ONLY, but I solved that by adding android.injected.testOnly=false to gradle.properties.
I tried changing Gradle version to 6.0.1 (looks like this is the latest at the moment), and it didn't help.
I also have my device selected at the top:
How can I make Android Studio install and launch the app on my device?
Android Studio version: 3.5.3
Edit:
I'm seeing the same behavior on an Emulator. I opened AVD from Android Studio and chose Pixel 3A. The emulator opens up, I run the app, nothing happens on the emulator (and I see the same Build Output messages).
The same happens to me. It is probably a bug in Android Studio. At the second compilation the app installs correctly. It is tedious.
There isn't enough information to find the cause of this issue.
But since it works with adb, it means you run adb command. There could be only one instance of adb daemon running. So if it's involved externally my guess is Android Studio won't have access to it.
Possibly try adb kill-server and running again from Android Studio and see if that helps.
I encountered the same problem, which I solved by checking the running devices. The connected phone had 2 accounts (might be personal & work) which was listed on the list of devices, so I had to select the second option, and it ran successfully on my phone. see the attached image.
One thing it might be:
Enable usb debugging
Settings
System
Developer options
Turn the setting on for usb debugging
If it does not appear go to settings about phone. Then click on build number like 7-10 times and it will enable you to have the developer options appear.

Android Studio: Running application in emulator not working

Today I downloaded Android Studio for my Debian Testing system. I wanted to run a HelloWorld application but weren't able to run it. With adb I can install it without having any problems.
However, if I try to do it with Android Studio, it gets stuck on 'Installing APKs'. The same happens when I try to start it in an emulator (gets stuck on 'Waiting for target device to come online').
My device is a Samsung Galaxy S3 with LineageOS (Android 7.1.2) and root permissions. Android Studio recognizes my phone properly.
What I've already done:
installed openjdk
set android_home
installed all the SDK-platforms since Android 4.3 and Android Emulator from SDK tools
enabled USB-debugging
tried with MTP and PTP
tried another emulated phone
installed lib32stdc++6
restarted my computer
and probably much more
I tried to do it the whole evening and couldn't find a solution. Is there something Debian-specific because I can only find instructions for Ubuntu? I have never experienced anything close to this on other systems.
Thank you in advance.
EDIT: I am now able to use my phone to run the android application by using USB 2.0 instead of USB 3.0! Is that a normal behavior since it works with native adb? I mean, if I buy a new PC after some years which has got only USB 3.0 ports, will I not be able to use phone debugging with Android Studio or is this just an issue? It is still known since 2014 (https://stackoverflow.com/a/9548311/8292104).
However, I still cannot get the app running on an AVD. I changed graphics to software, now it shows the phone but the screen remains black and the phone won't start. What can I do to fix it?
Try to completely delete and install Android Studio again, I think that it will solve the problem
Another possible solution that worked for me is to, in the application, go to
app - build - intermediates - split-apk - debug - slices
and then delete all of the contents within this folder. Then again, this only worked for me, so I would duplicate the document in case of corruption.

Instant run issue on Android Studio 2.2

I have updated my android studio to 2.2, Since then I get this strange issue when running the studio gives me error Instant Run requires that the platform corresponding to your target device (Android 1.0) is installed. I am using Note 4 on android 6.0.1. Why is this error happening ?
If you have connected your android device, unplug it then uninstall the current app. Then plug the usb back and click run. You good to go.
Am also facing similar issues since i downloaded the upgrade patch for android studio 2.2
i have noticed it happens when Android monitor says device offline Android device says offline yet connectet
The reason why the device goes offline and yet its connected properly i don't know yet. When i click download i get this error Package id platforms;android-1
I currently sole this temporarily by checking if android monitor says device offline, if yes i unplug the USB and plug it back in else it just runs fine
I had the same problems as you all and I solved it.
If you get an error like 'error Package id platforms;android-1 ' you must go to: Tools -> Android->SDK Manager, and thed to SDK Platforms. Make sure that 'Show Package Details' tab is checked (so that you can see all packages) and Android 1.1 package installed.
Otherwise just install it like all others packages. After you do this, restart Android Studio, unplug/plug phone. You will be asked then to conform something at your device, say ok and you fixet problem.
I got the same problem, but with an emulator.
So the answer of unplug/plug the device is not applicable to me.
I deleted my emulator and create a new one in Android Studio.
And, it's solved...
Connect to your computer as MTP. After this Android Studio will recognize your device and SKD could install for it.l
I've solved this by changing the USB cable. The one given by Samsung is useless.
I had the same problem but it solved after I approve the confirmation box for connecting the phone to the computer.
Running the android studio as sudo did the trick for me.
i got same problem , i have unplug my Device then uninstall the current app. Then plug the usb back and click run. i am good to go and my Problem
In this Video there is a Solution for Error running app: Instant Run requires 'Tools | Enable ADB integration' to be enabled. It worked for me to disable the instance run error messages.
In my case SDK location was incorrect.
I disabled Instant_Run option.
please check SDK version in local.properties file.

Not able to install .apks via adb

I have been working on a particular Android application for sometime and have been able to run these apps via Android Studio quite fine before but since applying a recent update I have not been able to run the app via Android studio because of the following error:
android.os.TransactionTooLargeException
Error: Could not access the Package Manager. Is the system running?
I have tried to troubleshoot this issue by connecting via a different TCP/IP instead of through USB (thinking it was a cable fault of sorts), reinstalling ADB, removing the ADB driver and restarting Android Studio, and all of the above yielded the same error when trying to run the app from Android Studio.
The update that was applied was the addition of the YouTube Android Player to a fragment. The fragment that contains YouTube Player was added to FragmentManager of the parent Activity during the onCreate method of this fragment. Could this be the problem? Or am I looking in the wrong place
Any insight would be appreciated.
You may have gotten this error while attempting to run an Android application on an emulator or device using Android Studio. The most common cause of this error is simple as stated in this link: You have to manually unlock your Android Virtual Device by swiping the "lock" icon on the screen. Security measures prevent the emulator from letting you connect the debugger before doing this. Make sure also that you are running Android Studio version above 0.3.2 or the latest version. There was some issue reported in AS 0.3.2. You can update it from Help >Check for update.
Found this thread which states that it might be an issue with your emulator not with Android Studio. Maybe you are trying to install application before even the emulator started properly. Wait till the home screen appears in the emulator before trying to install any application.
Also try to install any apk in Emulator from command line
Steps to install
Go to $Android_SDK_DIR\platform-tools, right click there keeping shift key pressed and Chose "Open Command Window here".
Run command adb devices to make sure yout emulator is running properly. It will show all your running emulators.
Now if emulators are showing properly, type the command adb install YOUR_FULL_APK_PATH , YOUR_FULL_APK_PATH is of any .apk
file path in your system.
You need to wait for the emulator to full start which may take a few minutes. Once it is fully started (UI on the emulator will change), it should work. You will need to restart the app after the emulator is running and choose the running emulator when prompted. You can check on this bug report the full details.
Hope this helps!
I'm not sure, but check if this works.
menu>> tools>>Android>>Enable ADB integration check it

Start my application on genymotion

I have just installed genymotions, but when I try to start my app on it, as described at the end of this paragraph, eclipse starts the old emulator even if the new one(genymotion) is running. I tried to change the debug configuration but the only virtual devices that I can see in target are the old emulators(see the photo below).
If in target i follow this answer, I get the following error :
[2014-01-30 19:50:00 - HelloWorld] No active compatible AVD's or devices found. Relaunch this configuration after connecting a device or starting an AVD.
Moreover I followed the FAQs that suggests how to bing the SDK. I show my configuration in the second photo.
The devices shown in the photo are all made with AVD, there aren't the one of genymotion and neither the one that is running:
Here I put the configurations of genymotion:
How can I say to eclipse to start the genymotion emulator and not the AVD one?
Looking at your screenshot I think you should unselect all the AVDs displayed on the list. The option you chose launches the best selected AVD by default, and optionally a device.
Also, the Genymotion instances are considered as real devices by ADB and ADT. So, as GhostDerfel mentioned, you need to run one of them before running your app on Genymotion instance.
To know all the detected devices by ADB you can look at the "Devices" section of DDMS. If a Genymotion device is detected, it should show a name like this : genymotion-galaxy_s3....
You can also run this command adb devices. The result should show something like this:
List of devices attached
192.168.56.102:5555 device
Each Genymotion machine is listed by its local IP address here.
If you can't find your Genymotion instance(s), check that you have the lastest version of Genymotion. A ADB detection bug has been fixed on the release 2.0.2
I had the same problem, i solved it by closing Genymotion and starting it from Genymotion Virtual Device Manager in Eclipse
i also had this problem and all tried all the above solutions and still was not working.but finally i read in the genymotion manual that u can simply drag and drop ur apk to the device and it will load and run.so i tried that and not only it worked it also seemed to solve the path problem also so that when ever i run the project it will automatically detect my device created by genymotion.
I can resolve by connecting a real device one time.
You need to install the genymotion plugin. In android studio File>Settings>Plugins>Browse Repositories > install genymotion plugin. once installed a genymotion button should appear in android studio.I hope that helpfull for you.

Categories

Resources