Installation failed due to: 'null' - Android Studio 3.5

82,533

Solution 1

Open Run/Debug Configuration dialog (Windows: Run > Edit Configurations)

edit You app > General > Installation Options > Install Flags .

add install flags -r -t.

This flags means adb install -r -t apkpath

screen pic

Solution 2

You need disable "Use libusb backend" in preferences--> debugger enter image description here

Solution 3

This issue in Android Studio happens for devices lower then API 26 (Android 8). This is caused by replacement of InstantRun, known now as ApplyChanges.

Seems to be there are only two ways before they fix it in the next update.

  1. Run on API>=26.
  2. After every change in code edit run configuration changing deploy from APK to App bundle and vise-versa. If I correctly understand, this will correctly rebuild app and workaround bug.

Of course, there is an option to manually delete app from device before running app from AndroidStudio.

Solution 4

Build > Clean project its work's for me. Before change other setting try this first.

Happy coding :)

Solution 5

For me either uninstalling the app or cleaning project "solves" the problem. To make it less frustrating I added clean job to debug build type like so:

buildTypes {
    ...
    debug {
        clean
    }
    ...
}
Share:
82,533
Taseer
Author by

Taseer

👹 The Satanist 👹 Kotlin > Go > TypeScript > Java > JavaScript

Updated on December 22, 2021

Comments

  • Taseer
    Taseer over 2 years

    I have updated Android studio to 3.5, ever since I am running into an APK installation problem. This is the only log it shows:

    Installation did not succeed.
    The application could not be installed: INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION
    Installation failed due to: 'null'
    Retry
    

    This happens when trying to install APK on a real device. If I uninstall the app from the device and then rerun the build, it installs only one time and then it keeps throwing this error on the next installation. It runs fine on an emulator but I can not use an emulator for everything.

    What I have tried:

    • Deleted Android Studio configuration file.
    • Deleted Gradle files from the project.
    • Invalidated and reset caches.
    • Cleaned/rebuilt the project.
    • Looked for similar problems Stackoverflow(nothing matches my problem)
    • Clean installed(Removed all files including SDKs) Android Studio 3.5

    Update

    I installed Linux Mint on my machine and tested the AS 3.5 there, for some reason everything is working fine even for Android 7 and below devices.

    Previous OS: Windows 10 1903

    Current OS: Linux Mint 19.2

    I reckon this problem may be originating from Windows machines.

  • adek111
    adek111 almost 5 years
    I have an Android 9.0 device and have this problem. However, when I mix running tests between emulator and then real device, app and tests appear to be running quite often. I don't really know why but maybe it will help someone.
  • mohax
    mohax almost 5 years
    Maybe you can successfully rerun app on API26+ if you click Apply changes, instead of rerun? This is new button to right of rerun.
  • Taseer
    Taseer almost 5 years
    I have changed OS to Linux and AS 3.5 is working fine there.
  • Admin
    Admin almost 5 years
    This flags means adb install -r -t apkpath,I guess.@TaseerAhmad
  • duckbrain
    duckbrain almost 5 years
    -r means "replace existing application". -t means "allow test packages"
  • 0101100101
    0101100101 almost 5 years
    Where did this man come from and how did he think of this solution? Give him a medal!
  • Syed Arsalan Kazmi
    Syed Arsalan Kazmi almost 5 years
    Not working for me! :( Please look at my problem. Its a little different than yours. stackoverflow.com/questions/57770464/…
  • Yogesh Umesh Vaity
    Yogesh Umesh Vaity almost 5 years
    It's working for app install but not for tests. When I try to run androidTest.
  • Taseer
    Taseer almost 5 years
    We have to wait for a 'stable' 3.6 release.
  • Beatrice Lin
    Beatrice Lin almost 5 years
    The setting is Run > Edit Configurations, if windows version.
  • Raskilas
    Raskilas over 4 years
    Only this solution helped - Xubuntu 18.04
  • Minasie Shibeshi
    Minasie Shibeshi over 4 years
    That was just amazing
  • Kebab Krabby
    Kebab Krabby over 4 years
    Cant believe this worked! Android Studio 3.5.1 Android Debug Bridge version 1.0.41 Version 29.0.5-5949299
  • srisindhu saride
    srisindhu saride over 4 years
    Works like charm. Struggled with this problem for months and only this answer worked for me
  • Polycarp Kavoo
    Polycarp Kavoo over 4 years
    Works like charm
  • Ryan Barrett
    Ryan Barrett over 4 years
    thank you so much for this tidbit - I was having to remove my app before each debugging session after upgrading Android-Studio ... now it works on it's own!
  • CoolMind
    CoolMind over 4 years
    I uninstalled the app from API 29 emulator and it helped.
  • Zoe stands with Ukraine
    Zoe stands with Ukraine almost 4 years
    DO NOT USE THIS! Aapt has been deprecated in favor of aapt2, and will eventually be removed. This workaround will stop working, and cause other problems when aapt is removed
  • Vivek
    Vivek almost 4 years
    OMG! this has solved a big big problem. Struggled with this problem for months as wel.. Wow!
  • Chris.Jenkins
    Chris.Jenkins over 3 years
    Fixed this for me on OSx 10.15! Thank you!
  • Gulnaz Ghanchi
    Gulnaz Ghanchi over 2 years
    It does not work for me
  • TimWeb
    TimWeb over 2 years
    This helped me. Thanks)