Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
439 views
in Technique[技术] by (71.8m points)

building - Android Studio is installing old apk on device

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...