83

I've been trying to learn how to use Android Studio but when I attempted to run one of the sample programs I get this error message:

Installation failed with message null. It is possible that this issue is resolved by uninstalling an existing version of the apk if it is present, and then re-installing.

WARNING: Uninstalling will remove the application data!

Do you want to uninstall the existing application?

I've tried to do this on 5 more sample programs and all of them give me this error. Does anyone know how to solve this?

Victor Zamanian
  • 3,100
  • 24
  • 31
Merlin
  • 841
  • 1
  • 6
  • 3

29 Answers29

82

I'm Using Redmi 3s mobile. I got same problem.

Solution: This issue is common on Xiaomi phones running MIUI 8. This can resolved by turning off MIUI optimizations from Developer Options in Settings app. Then recompile the app and voila it works.

Settings --> Additional settings --> Developer options --> Turn Off MIUI optimization

Or

Settings --> Developer options --> Turn Off MIUI optimization
Jayaprakash G
  • 2,537
  • 1
  • 14
  • 10
  • 6
    This solution must be for all the MI Mobile phones. After turning off the MIUI optimizations and restarting the device i was able to debug the app on my Mi Note - 3 device. – Zax Apr 21 '17 at 17:36
  • 2
    But in my case it is turned off but still getting same issue.. I am using MIUI version 8.5.7.0, Any suggestion? – Shailendra Madda Oct 31 '17 at 09:55
  • I got this problem in Samsung J7 Core(Oreo) – Ashik Azeez Feb 23 '19 at 08:29
  • @AshikAzeez do you happen to have this app set up in the secure folder or dual messenger? – btraas Apr 08 '20 at 01:43
58

I got the same problem , just choose clean project then rebuild project from build menu , it's solved my problem

ahmadMarafa
  • 1,316
  • 1
  • 13
  • 15
45

Disable Instant Run

Preferences > Build, Execution, Deployment > Instant Run

Source: comment by @user77309

enter image description here

Pablo Cegarra
  • 20,955
  • 12
  • 92
  • 110
11

Path: Android Studio Preference / Build, Execution, Deployment / Instant Run

Go to Android Studio Preference (for Mac) or Settings (for windows)

Choose Build, Execution, Deployment tab

Choose Instant Run

Uncheck Enable Instant Run to hot swap code/resources changes on deply (default enabled)

It works for me!!

Yash
  • 482
  • 4
  • 12
8

Go to Settings > Applications. Probably you have the app still installed for other users (I had the same problem with a Moto G, I did not see the app among other apps, but it still was among my apps in Settings). Try to find it and remove for all users.

If the problem is this one you will find the app at the end of the list (in Settings > Apps > All)

All the apps marked as "Not installed" are still there and you can not install the same apps with Android Studio until they are there

Massimo
  • 3,436
  • 4
  • 40
  • 68
  • I don't know if this solved my problem, but I was surprised to see several old test versions that I have been working with over the last 2 weeks still sitting in the list ... +1 ... – dsdsdsdsd Apr 27 '16 at 14:33
7

This happens when your app is using any library and there is also an app installed in your device that is using the same library. Go to gradle and type:

android{
defaultConfig.applicationId="your package"
}

this will resolve your problem.

Irfan Qureshi
  • 369
  • 6
  • 7
5

INSUFFICIENT_STORAGE

Solution:clean you phone storage

Pay attention Android Studio log:

open: Permission denied
open: Permission denied
pkg: /data/local/tmp/com.example......... Failure [INSTALL_FAILED_INSUFFICIENT_STORAGE]
nalzok
  • 14,965
  • 21
  • 72
  • 139
PerfectWorld
  • 51
  • 1
  • 1
4

Step 1: Go to "Setting" → find "Developer options" in System, and click.

Step 2: TURN ON "Verify apps over USB" in Debugging section.

Step 3: Try "Run app" in Android Studio again!

            and you should also TURN ON following fields inside "Developer option" .....

1: TURN ON ->"Install via USB" field

Garvit
  • 312
  • 3
  • 12
Makvin
  • 3,475
  • 27
  • 26
4

Some solutions:

1 Build -> Clean Project

2 Build -> Rebuild Project

3 Built -> Make Project

4 Remove your application from device and try install again

5 Mb you have some problems with actual version of yours app(try to pull actual branch). Also you can check on your emmulator, if yours app is running.

6 Try to use 1,2,3,4 solutions.

Morozov
  • 4,968
  • 6
  • 39
  • 70
4

The solution for me was : (in a Huawei)

  • Android Studio -> Build -> Clean Project
  • In the phone -> go to Phone Manager -> Cleanup and Optimize
Álvaro Agüero
  • 4,494
  • 1
  • 42
  • 39
3

I had the same issue, and found that it was the USB cable I was using that was causing the issue.
Changing the USB cable fixed the issue, and I could successfully install the app afterwards.

Stéphane Copin
  • 1,888
  • 18
  • 18
2

In real device do below tasks..

1.clean all cache memory.

2.check the internal storage space (if space is just 500 mb free, then remove some data or app in the internal storage maintain at least 1 gb space.

3.again do clean all cache memory.

4.now goto android studio or eclipse click on app goto run select the device and run I hope app will install and it will run..!!!

KUSHA B K
  • 1,489
  • 13
  • 20
1

Uninstalling from AVD worked for me. After reinstalling it worked

1

For the 1st time installation of apps in a device, enable developer option which is mentioned in the above post. For facing problem while installing the apps from the tool, follow the below steps....

By enabling an option in settings, you can install apps directly. Error will disappear.

For MI users: Go to Settings-> Additional settings-> Privacy-> Unknown sources (make it enable) For Normal Users: Go to Settings-> Security -> Unknown sources (make it enable)

Priya Rajan
  • 687
  • 8
  • 21
1

Simply closing Android Studio (and emulator) then re-opening fixed it for me. Once I ran the app again, the apk re-installed successfully and app ran properly.

lkisac
  • 2,007
  • 1
  • 26
  • 31
1

Recently I also find the same problem and there some reasons behind this but I am giving you 3

  1. In your phone in the setting go to "Developer Option" and enable USB debugging
  2. Also, check the "Install via USB" is also on in Developer Option itself.
  3. In Android Studio go to File -> Settings -> Build, Execution, Deployment -> Instant Run and uncheck the Enable Instant Run

It must work.

Ankit Pandey
  • 220
  • 5
  • 9
0

Happened to me as well: At the first time, it says- Failure [INSTALL_FAILED_CONFLICTING_PROVIDER] At the second time, it says- DELETE_FAILED_INTERNAL_ERROR

This because of the new 'com.google.android.gms' version 8.3.0

Changing it back to 8.1.0 solved the problem in my case

Yaron Recher
  • 2,348
  • 1
  • 13
  • 9
0

I was having the same error, but i fixed it after reinstalling the HAXM. This problem is caused because of the virtual device not starting properly. If your device keep showing on screen "Android" or the screen is black, it have not started yet, you have to wait more for it to start properly, then it shall run. If it is too slow, maybe you should find a way to accelerate the Android Virtual Device (AVD). The Intel computers have the HAXM (hardware-accelerated-execution-manager).

In my computer was not starting because of the HAXM not working, I fixed it by reinstalling the HAXM, downloading it from the intel website: "https://software.intel.com/en-us/android/articles/intel-hardware-accelerated-execution-manager"

Then i set the HAXM max memory to 1536MB in the installation, for not having the problem of this other post, that you maybe have and i was having too: "HAXM configuration in android studio"

After all done, it worked fine.

Community
  • 1
  • 1
0
android {
    buildTypes {
        debug {
            debuggable true
        }

and In the AndroidManifest.xml file, add android:debuggable="true" to the <application> element.

https://developer.android.com/studio/run/device.html#setting-up

it works for me..

Mr Lister
  • 45,515
  • 15
  • 108
  • 150
Ravi Kumar
  • 69
  • 9
0

I solved the issue by simply deleting my whole /build folder and rebuilding (menu Build > rebuild project).

0

This problem cause to me because of the project path . Y:\Example&SourceCode with & sign So i change the Project path to another one without special characters. Now It is Fine.

Ye Htun Z
  • 2,079
  • 4
  • 20
  • 31
0

For me it only started working after I rebooted device (Motorola-Nexus-6).

(I also tried to clean, disable "instant run", reopen Android Studio, verified installed applications to be sure there are no clashes, disable and reenable Debug mode in phone, reconnect USB cable)

0

I have faced this issue since I have upgraded the build tools from 26.0.2 to 27.0.3. Reverting back, clean and rebuild solve the issue. Also I have degraded the gradle plugin version from 3.1.3 to 3.0.1 as the latest version was overriding the build tools to latest version.

DevChamp
  • 188
  • 2
  • 2
  • 14
0

I also got same problem while generating signed APK. Just select APK signature scheme v1, not v2 (introduced in in Android 7.0). If you select v2 scheme it won't work on devices that use Android versions older than 7.0.

contrapost
  • 673
  • 12
  • 22
sandeep
  • 7
  • 2
0

if your "versionCode" in build.gradle file is less than the eralier version code then, your app wont install. Try to install with same "version code" or more than that.

dileep krishnan
  • 326
  • 4
  • 7
0

If you do all of things above and still get stuck, just try reopening your Android Studio.

Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92
0

I had the same issue but finally it worked after storage clean on my mobile. May be happen because of insufficient storage

Sandun Sameera
  • 402
  • 6
  • 13
0

I have a Redmi K20, the following is MI, Redmi specific that I learned in a hard way

How I ended up in the error: I uninstalled the debug app from the phone because my assets were not accessible (maybe I had faulty source code)

Solution (steps that worked for me in sequence):

  1. Uninstall the app
  2. As per suggestion above by @Jayaprakash G and all, I turned off MIUI optimization
  3. I tried finding "Instant Run", but seems missing in Android Studio 3.6.2
  4. MI supports "Second Space", switch to it. You'll observe the app is still there. Again uninstall.
  5. Switch space back to original again. By any chance, if you see the same app in frequently used app in the app drawer, again uninstall.
  6. Try to compile and run the app from Android Studio and let it show in the app phone (Error 3 will be still there, but installation will succeed).
  7. Clean the project, close Android Studio
  8. Start Android Studio, now everything will work as normal without the Error 3
cppxaxa
  • 135
  • 1
  • 9
-1

I solve this problem by: Enable Instant Run

Settings>Build, Execution, Deployment>Instant Run

Ado
  • 411
  • 4
  • 9
  • I seriously doubt that such problems can be "solved" this way. – GhostCat Sep 14 '17 at 04:38
  • 1
    @GhostCat According all the answers for this problem,I think this prolem cause by AS build system or Custom Android OS.Clean,Rebuild,and disable Instant Run can effective.But my case solve by Enable Instant Run.and when I disable Instant Run ,the problem appears again. Enviroment:AS 3.0Beata5.Android 5.0.2 – Ado Sep 14 '17 at 04:59