Search code examples
javaandroidpackageaide-ide

Android app with specific package name cannot install


Problem I am developing an Android app and for some reason I have the "App not installed" error when trying to install the package on my Android device. This application has already previously been installed successfully.

To investigate, I went for the basics:

  1. Uninstall my app from the device
  2. Make sure Security>Unknown Source is checked
  3. Created an HelloWorld app with random package name and tried to install on device: SUCCESS
  4. Created an HelloWorld app with same package name as my problematic project: FAILED

So my guess is that my package name is pointing to some stuff that was not uninstalled correctly.

Question Is there a way to make sure that all the data on an Android device related to a package name is deleted?

Context - Developing directly in android with the AIDE app. No access to any computer at the time since I am travelling. Device: - Samsung Galaxy Notes 10 2014 - Android 4.3 (not rooted)


Solution

  • One reason why this could happen is because during the last uninstall, not all relevant application files have been removed. I don't know why this happens, but i know that it does sometimes happen.

    There might be files left over that are owned by a user/group id that is no longer assigned to an application. When you now install an app with the same packagename, it will get a new user/group because it is not an update, but a fresh install. As your app still has the same package name it wants to create the same files, but it can't because one or more files/dirs still exists from the previous install and it can't overwrite/delete them as it lacks the permission because the are owned by different user/group ids.

    You could check the following location for files/dirs relating to your packagename, but i doubt you will able to do much without root access.

    • /data/data
    • /data/app
    • /data/app-asec
    • /data/app-lib
    • /data/dalvik-cache
    • /data/local/tmp
    • /mnt/asec
    • /mnt/obb
    • /mnt/sdcard/Android/obb

    (Full disclosure: This is my app)

    With root, the "CorpseFinder" feature of SD Maid will check the most common locations (see settings) for this issue.