4

My app won't update. It builds and runs but it's some old version and the changes I've made aren't counted. If I make a Toast for example, it won't show. If I delete an existing one, it will still show.

I've tried the following already:

  • Updating Android Studio and updates in the SDK manager

  • uninstalling the app off my phone and reinstalling

  • cleaning

  • make sure "Gradle-aware Make" is in run configurations

  • File - invalidate caches

  • make sure "Skip installation" is unticked.

  • delete the build folder of the project and rebuilt

  • adb shell pm clear com.packagename.app - "Success" but not fixed

  • adb shell uninstall com.packagename.app - "Success" but not fixed

  • Increase versionCode and versionName in build.gradle

  • Change build variant

  • Making a new project and copying the files

  • Android Studio is installing old apk on device

I've tried doing it on another phone and it's stuck on an older version on that one too.

Community
  • 1
  • 1
Questioner
  • 2,451
  • 4
  • 29
  • 50
  • 1) you could try and change version in the Manifest. 2) longer way around, make new project, move all stuff over (kinda works for smaller projects). Make sure different App name... – Flummox - don't be evil SE May 24 '16 at 14:08
  • @Flummox It's not a small project and what do I do when it happens again, make a new project again and move all the stuff over again etc. etc. etc.? – Questioner May 24 '16 at 14:10
  • I don't like to have to create a whole new project, but I do not know a better way around then that... – Flummox - don't be evil SE May 24 '16 at 14:14
  • Where is the old APK even coming from? I deleted it from the phone and deleted the build folder but it keeps coming back! – Questioner May 24 '16 at 14:20
  • Setting the Build variant? – Flummox - don't be evil SE May 24 '16 at 14:28
  • @Flummox What about setting the build variant? – Questioner May 24 '16 at 14:30
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/112807/discussion-between-flummox-and-questioner). – Flummox - don't be evil SE May 24 '16 at 14:31
  • http://stackoverflow.com/search?q=android+studio+not+updating+apk http://stackoverflow.com/questions/25831082/android-studio-is-installing-old-apk-on-device – Flummox - don't be evil SE May 24 '16 at 15:31
  • @Flummox That question is where I got some of the things I tried and showed in my question. For example, the "Gradle aware make" part worked for the OP of that question but didn't for me. – Questioner May 24 '16 at 15:44
  • I ended up making a new project and copying the source folders to the new project and trying again. Even that didn't work. – Questioner May 25 '16 at 08:58
  • I have the exact same problem and I tried all of the above. I've also tried to build a second app and I still get an old APK of the first!!! Have you found a way to fix it? Only help I can provide is that even when I go for a clean build I get the following in the gradle log: `:app:preBuild UP-TO-DATE` `:app:preDebugBuild UP-TO-DATE` `:app:checkDebugManifest` `:app:preReleaseBuild UP-TO-DATE` Seems strange to me but I'm unsure of it has anything to do with it... – Gian Luca Scoccia Aug 04 '16 at 22:02

4 Answers4

1

I had a similar problem with AndroidStudio Canary 2020.3.1 Canary 2.

In my case it helped to check Run/Debug Configurations/Always install with package manager.

(I might have missed some simple reason for this behaviour, though.)

aaron
  • 31
  • 3
1

It's due to a bug in Android Studio because of Deploy optimizations on Android 11.

Temporary fix is to disable optimizations by following the below: In toolbar > Run > Edit Configurations... > General Tab > Check: Always install with package manager

Syed Zeeshan
  • 490
  • 1
  • 7
  • 13
0

I would comment this, but I can't yet, so... I would try to delete the .apk from "Project\app\build\outputs\apk" folder. Or at least check it's modification date.

datiKaa
  • 326
  • 2
  • 15
0

this might help you:

defaultConfig {
    applicationId "com.example.app"
    minSdkVersion XX
    targetSdkVersion XX
    versionCode 1 // <-- set this one to a bigger, it is used for upgrade
    versionName "1.0"
}
  • Already did that. Actually made a comment saying I did it but my internet connection dropped just at that moment. – Questioner May 24 '16 at 14:17
  • 2
    @Questioner - did you ever get this resolved? I'm running into the same problem and have tried so many different things to fix it and nothing is working. – Smokin Joe Aug 25 '17 at 02:09