Android Studio Instant Run is not enabled? - android

Instant Run is a new feature introduced for reduce time for run and debug app.
I have all the required configuration for enabling Instant run, but it is not enabled on Android Studio. Here is my configuration below.
1. Android Studio 2.1
2. 'com.android.tools.build:gradle:2.1.0'
3. minSdkVersion 15
4. Settings->Build, Execution, Deployment > Instant Run = "Enable Instant Run..."
5. Run ->device is Android version 4.4.4
Then Instant Run is NOT enabled.
But when I am Run->on device Android Version 5.1.1, Instant Run is enabled.
Please suggest, if some other configuration I missed to enable Instant run for Android 4.4.4 device.

When you are running for the first time Instant Run is not required as the apk will be installed for the first time in the selected device. From the second time onward if you choose the same device to deploy your changes then instant run will be automatically enabled from Android studio 2.0 and Gradle version 2.0.
Please Note: You are required to run in debug mode.
For more Clear understanding you may visit this link

Instant Run is supported only while deploying a debug build variant, using Android Plugin for Gradle version 2.0.0 or higher, and targeting devices running Android 4.0 (API level 15) and higher.

This answer solved the problem in my case.
you have missed the Fingerprint Certificate Authorization dialog in your
phone when you connected it, try to change the USB mode to Media, or
another different than the one you have in and then reconnect your
device, or go to Developer Options -> Revoke USB Debugging and
reconnect, watch for the dialog and click on accept, that should solve
your problems.
Otherwise, try this:
set your ANDROID_SDK_HOME again and:
unplug device adb kill-server adb start-server plug device

Try to recreate project, but do not use spaces in the fullpathname.

Go to sdk manager and select API Level 15 which is Android 4.0.3 (IcecreamSandwich) under SDK Platforms. This fixed my problem.

For me the problem was the link cable, it seems like it had an unstable connection. I used another one and it worked without a problem.

Related

Android Studio refuses to build and install any app on my phones

Since the time I have updated android studio to 3.5, I have been unable to run any app on multiple of my physical phones (Redmi Note 4 and OnePlus6). The app isn't installing on any of them. But it is installing on the emulated devices of the same respective versions (Android 24 and Android 28), so it is not an issue with the code.
Moreover, I tried to build the previous versions of my app stored on Git, and now Android Studio does not build the app showing - "linking error". While that same code version was working fine a few months ago (prior to the android studio update). Which is why I think the problem is somehow with the Android Studio and not the code...
Things I have tried
Disable instant Run (Not an option anymore in Android Studio >=3.5.1)
Enable USB debugging, connect using the device using "Transfer Files" mode and not "Charging Device" Mode
Turn off MIUI Optimization and Reboot
Uninstall App and re install
Build the apk, transfer the apk to the device and then try the install (This works on OnePlus 6 but not on Redmi Note 4)
The apps I have tried target Sdk >=27, and use androidx. However, I tried to go back to a previous version of the app, which didn't use androidx (and used the legacy support libraries), but still got the same error.
My system is Ubuntu 18.04, and current Android studio version is 3.5.3
Errors I have been getting include:
INSTALL_FAILED_USER_RESTRICTED
Device Not Found
UPDATE:
- Just tried to install on OnePlus6, doesn't install there as well. Earlier I had tested only for Redmi Note 4.
- Tried uninstalling and reinstalling the app, building the apk and
transferring on the phone then manually installing.
- This is happening across projects, at least for Redmi Note 4. I tried this with one of my course projects, same/similar problems.
My guess is problems with Android Studio update and the recent migration to androidx from the "legacy" support libraries
How I solved it:
Disable "Use libusb backend" in the Settings -> Build, Execution and Deployment -> Debugger
Sorry Android Studio 3.5 for the curses
How I found the solution:
I checked the logs of android studio by going to Help -> Compress Logs and Show in Files. In the folder which opened, I saw the logs by the name adb.1000.log (because adb - android debug bridge, handles the communication with the device). In the last few lines I saw - "read transfer failed: LIBUSB_TRANSFER_CANCELLED". I read here about the option of libusb
Did you try to clean/rebuild... under /Build/Clean Project, after that /Build/Rebuild Project and after cleaning and rebuilding you can try under /File/Invalidate caches

Why Android studio won't run app on Android Pie (9.0)?

I've upgraded my Google Pixel to Android 9.0/Pie.
When I try to run an application from Android studio I don't see the Google Pixel in the list, there's only a null device named FA69R0306649. When I run my application, Android studio tries to install the app but then fails.
It looks like Android Studio is not recognizing the phone anymore. It Worked perfectly fine a couple of hours ago under Oreo (8.x).
Also, if I deploy the app on google play as alpha and then download it runs perfectly under 9.0/Pie.
Any suggestions to get the run/debug working with android 9.0 phone under Android Studio (3.1.4)?
The Pixel running 9.0 requires USB 2.0 high speed.
Apparently the Pixel running Android Pie cannot talk to the PC using neither USB 3.0 nor USB 1.1 full speed nor USB 2.0 running at full speed.
I had a similar problem with my Xiaomi Mi A1. When I upgraded from Android 8.1 to 9 Android Studio would hang on "Installing application" forever.
After trying revoking USB debugging authorization and completely reenabling developer options with no success it turned out a simple restart did it.
Looks like there are multiple issues that lead to the same problem.
I had the same issue with a Xiaomi Mi A2 after upgrading to Android 9. If you are using Linux, try adding the udev permissions manually, following the steps described here. In my case, that was the only solution that worked.
Please re-enable developer options again after the OS version upgrade, the device name will appear and it will be working fine again
Install Sdk Platforms of Android 9. In Android studio Top Right besides Search Icon.Press That Icon of SDK manager and look either sdk platform is updated and installed.
A simple solution just go to your Developer option on your phone , right below the USB Debugging option it says to "install via USB" just enable it and you are all set to install an app through android studio into your 9.0 device.

my App not running on my phone?

made an app. smoothly running on moto phone but not running on mi phones.
Installation failed with message Failed to establish session.
Error while Installing APKs
what i done:
enabled developer option.
enabled install Apks via USB.
is there any possible reason why this is happening?
i had the same problem, please disable Instant Run
File-> Settings-> Build,Execution,Deployment-> Instant Run-> Uncheck (Enable Instant Run to hot swap code)
It can happen because for few reasons:
No enought space, but it should have told you so.
The minApi that your app supports is higher than the device's API.
Your app supports different processor architecture than your device.

Instant Run performed a full build and install since the installation on the device does not match the local build on disk

Android Studio gives error when running application with instant run enabled. I have updated my android studio to 2.3 today and since then its showing me above information.
On android studio 3.0.1
I ran a full build right after I enabled instant run.
Once that was done . The error was gone and instant run worked.
Re-run Android studio with emulator helped me to install it on next lunch.
if you are using external devices then turn On or Off the device, or connection miss-match. please retry to connect devices and run your application then reconnect device.
You can disable Instant Run by going to (in android studio) File -> Settings -> Build,Execution,Deployment -> Instant Run
and uncheck Instant Run

Android Studio Stuck on "Installing APK"

Android Studio no longer seems to be detecting when an app has installed on a target device and opened. It gets stuck on "Installing APK" and the progress bar is empty. There are no errors, the apk successfully installs and opens, it's just the IDE is still showing "Installing APK" and it does not automatically connect the debugger. I can manually connect the debugger using the "Attach debugger to Android process button", but this is not ideal.
Can anyone offer any suggestions for what's up and how to resolve it?
It turns out the problem wasn't with Android Studio, but with the device I was using for testing. I tried a different device and it behaved normally, progressing beyond "Installing APK" and stopping on breakpoints.
Somehow the "wait for debugger" setting in developer options on the problem device had switched to off. I switched this back on and now this device is behaving normally.
-Note that I had to choose an arbitrary debug app for the setting to become active. Once I'd set it on, I deselected the debug app and the setting remained on, as I left it. This was a HUAWEI P8 running android 6.0 API Level 23.
Recently, I was facing the same issue when I have updated My Device (MI A1) OS from Android Oreo(8.0) to Android Pie(9.0),
Solution: Go to the Settings > Developer options > Now click on > Revoke USB debugging authorisations.
It will disable/remove developer options from your device, Now restart your device once and then you just need to re-enable your developer options and that all you need to do, Enjoy Developing on Pie.
Hope this will help you as well.. :)
I found a solution that works for me. In Developer Options turn off "Monitor apps installed by ADB".
Just reboot your phone (:
It happens after update android version.
On my HTC One I unchecked “Verify apps over USB” in Settings -> Developer Options.
I had this same problem. I solved it by revoking USB Debugging Authorizations and then re-enabling USB Debugging on my chosen device(s).
Edit: Cleaning my project also helped with solving this problem.
for me it was something magic
I solve it by removing the USB from the Laptop and from mobile too(type-c cable) and
turning off the debugging mode and again turn it on
and then I connect it back to my Laptop and selected the same FILE TRANSFER MODE
then run the app and it get installed to my device and work as expected
Hope you will find Useful to
I have this problem recently on my Pixel 2 testing device, latest factory image with Android Studio 3.4, on windows 10.
I have tried all methods mentioned but none of them work. It cost me more than 6 hours to figure it out.
My problem is the USB driver, I am not using the "perfect" USB driver. My driver works in most scenarios and commands but not in every scenario.
You do not need Android Studio to dig into this problem, just using adb.
Please try if you can install apk from adb using following command:
adb install xxxx.apk
If it stuck at "performing streamed install" but never finish, this is the problem.
Please try push a big file(more than 5MB) to your device:
adb push xxxx.apk /storage/emulated/0
In my testing, it stuck at 13%, 16%, etc, but never go on. It seems cannot transfer large files. This is why the installation is pending in my case.
I update the driver to another one, and the problem is fixed. Hope it can solve your problem, too.
I had the exact same problem.
what's more, i can not adb shell and adb push files.
I am running an Ubuntu 18.04 VM and test on xiaomi phone 8,9.
The problem for me was the USB Compatibility setting for the VM was set to 2.0, it needs to be at least 3.0. To change the setting power down the VM and choose the "Edit virtual machine settings" in the VMPlayer startup menu. Then select the "USB Controller" device and change "USB Compatibility" to USB 3.0.
Hope this can help u!
It doesn't hurt to verify your USB port. In my case it was the faulty USB port which I had to switch to the mobo's one instead of the case port.
Restarting Android studio worked for me
I tried rebooting my phone and it worked.
When attach my mobile to my PC, the follow menu is showed. I Clicke on it.
In the next section, I had changed from "USB connection" to "Transfer files"
After that adb install works for me.
In my case, Second Space was created but not switched on. I had to delete the second space and everything worked just fine.
My settings are:
Usb debugging -> ON
Install via Usb -> ON
Verify over USB -> ON
Wait for debugger -> ON
Device: Redmi Note 5 Pro
I had this issue with an emulator on Linux. After trying pretty much every solution and suggestion on this page, what made it work for me was turning off Instant Run.
In my case i did not make sure that my android studio DSK manager was up to date with the android version that my device was operating on. So when running flutter doctor all seemed well, and i had the latest android version and all on android studio, but as mentioned it was not matching the version for my device i had connected.
Once i added the correct android version (in my case android 6.0) with SDK manager using android studio, it did not get stuck at installing apk.
My case was similar but for Android Version 10 required having the Verify bytecode of debuggable apps to off.
Final settings were:
USB debugging -> ON
Wait for debugger -> ON
Verify apps over USB -> ON
Verify bytecode of debuggable apps -> OFF
Device: Pixel XL
For me, the top answer "wait for debugger" was completely greyed out.
What worked for me was to look inside "Apps" and I noticed the app was uninstalled, but only for my current user. Clicking uninstall for all users unblocked the installation via Android Studio again.
Check following in your project
build-gradle plugin version in project level build.gradle file
gradle version in gradle-wrapper.properties file
buildToolsVersion
uninstalling the previous installed app worked for me
Turn off Verify apps over USB and Verify bytecode for debuggable apps (might not be available for all devices) in your Developer settings menu. The install time will decrease drastically.
I'm using Visual Studio Xamarin and the issue was caused by the missing CPU architecture. After checking them, the APK became installable via adb install ...
Just reboot your mobile . If not working try reboot your Android studio and mobile.

Categories

Resources