Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio is installing old apk on device

Tags:

I am developing an Android app using Android Studio (0.89 Build #AI-135.1404660, Built on Sept 3,2014) using both emulator and Nexus 4 device.

I had the same issue with a version prior to that.

The problem is that after I changed my code and resource files, I still get the old apk installed on the device or emulator.

What do I need to do to get it to run current code? Is it a building config?

Is it a known issue with Android Studio?

Or with a Nexus 4 device?

This is the second time it has happened, and I resolved it(then) after trying one of the steps below. They have not worked for me again.

Here is what I've tried

  1. Build > Clean Project > Restart Android Studio > Run
  2. Build > Rebuild Project > Run
  3. Step 1 plus Uninstalling of apk on device
  4. Step 2 plus Unistalling of apk on device
  5. Adding erroneous resource entry then running.

I have read the following:

  1. Android apk install: How to clear files from old version?
  2. adb - How to reinstall an app, without retaining the data?
  3. Device still has the old apk
  4. Android build doesn't update code base or resources for target .apk on device

None has worked so far.

like image 538
user919426 Avatar asked Sep 14 '14 07:09

user919426


People also ask

How can I install a different version of an Android app APK without overwriting the installed version?

Just change the name of the app. Now, uninstall the app and then install the modified APK. Now install the latest version as well. You need not modify it.

Why app is not installing in my phone from Android Studio?

The Android app not installed error can be combated after resetting app permissions. Go to Settings > Apps > Reset App Preferences/Reset Application Permissions. After this, third-party software can be installed on your device.

Where does Android Studio install APK?

The apks are in $project/$module/build/apk. You can ofcourse just run the application from the UI which will automatically install it. “To install an APK file on the emulated device, drag an APK file onto the emulator screen.


2 Answers

I had the same problem. After trying numerous methods that didn't work, I realized that I had accidentally changed an option in my "Run Configuration". Here's exactly what I did to fix the issue.

  1. Run --> Edit Configurations
  2. With your configuration selected on the left panel (mine says "app"), in the General tab on the right panel, there is a section called "Before launch". This section should have an option added called "Gradle-aware Make", but I had accidentally removed it.
  3. I re-added it by pressing the "+", then clicking OK in the popup (leave the input box in the popup blank).
  4. Click apply.

This fixed the problem immediately. Hope this helps someone!

like image 89
JamesD Avatar answered Oct 20 '22 12:10

JamesD


Run / Debug Configurations / Miscellaneous TAB [] Uncheck: Skip installation if APK has not changed

Android Studio doesn't always detect small changes in code.

like image 40
David Avatar answered Oct 20 '22 10:10

David