2

I'm having some strange issue with Android Studio recently. I'm trying to build a project after few modification in code. But the APK got installed is of old code. (I found this by debugging. When I debugged it was going to empty lines) But all my latest code are saved and it's there. I have tried the following steps which I know.

  1. Delete the build folders of Project and Module manually > Restart Studio > Clean Project > Rebuild Project
  2. Restart Android Studio and (I don't know why I restarted but I did that too)
  3. Invalidate and Cache Restart
  4. At some point I found a issue in XML related to style attribute for button which was like style:attr/buttonBarButtonStyle I later corrected to style:"?android:attr/buttonBarButtonStyle"I hope this change is correct because it don't show any more error.
  5. And finally it doesn't give me any error in stacktrace. Project always shows BUILD SUCCESSFUL

Nothing above helped me.

EDIT 1 : I have updated my Android Support Library to 22.1.1 latest version which released a couple of days ago

EDIT 2 : I uninstalled Android Studio. Deleted Android Studio related folders in C:\Program Files\Android\Android Studio and also deleted C:\Users\MyUserName\.android & .AndroidStudio & .gradle folders. And did fresh install of Android Studio. Later I imported a same project and build it. Again it happens in same way! I have also tried running the same project in other lap and it runs without any problem. I Don't know what else I'm missing here

EDIT 3 : Updating my build.gradle

apply plugin: 'com.android.application'

android {
compileSdkVersion 22
buildToolsVersion "22.0.0"

signingConfigs {
    debug {
        storeFile file("./debugkeystore/MyAppDebug.keystore")
    }
}
defaultConfig {
    applicationId "com.example.myapp"
    minSdkVersion 14
    targetSdkVersion 22
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
  }
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.0.0'
    compile 'com.google.android.gms:play-services:6.1.+'
    compile 'com.android.support:recyclerview-v7:+'
    compile 'com.android.support:support-v4:22.0.+'
    compile 'com.android.support:cardview-v7:21.0.+'
}
Kavin Prabhu
  • 2,307
  • 2
  • 17
  • 36
  • Have you tried deleting the APK from the projext's folder or uninstalling the app from your phone? – Josh Apr 27 '15 at 12:54
  • Yes, I did that too. But of no use :( – Kavin Prabhu Apr 27 '15 at 12:55
  • Have you uninstalled the apk on your phone manually, before installing new build? – Melquiades Apr 27 '15 at 13:19
  • Can you also try installing via command line? 'gradlew clean installDebug' – marius bardan Apr 27 '15 at 13:28
  • try :- adb shell pm uninstall -k com.package adb install /path/to/app-release.apk .if the signing of key is different then you have face the problem. – Anoop M Maddasseri Apr 27 '15 at 13:49
  • Nothing helped still trying to fix. Uninstalled and trying to re-install Android Studio. But the old user setting and cache is still there. Looking forward to make a clean install – Kavin Prabhu Apr 27 '15 at 16:06
  • please put your build.gradle file – Mounir Elfassi Apr 28 '15 at 04:45
  • By any chance, are you using beta, canary or dev version of AS? – Sufian Apr 28 '15 at 05:56
  • No, I'm using the Stable Channel Android Studio 1.1.0 & Build number : AI-135.1740770 – Kavin Prabhu Apr 28 '15 at 06:06
  • try removing this lines from your build.gradle: "signingConfigs { debug { storeFile file("./debugkeystore/MyAppDebug.keystore") } } " – Mounir Elfassi Apr 28 '15 at 08:59
  • Did you uninstall the apk from the device you are testing on? Try to uninstall your app from device first to make sure you are installing the modified apk and there are no device specific issues. Also make sure the app reaches those modified code parts, maybe just put the `Log.d(TAG,"Its current build!")` in launch activity in `onCreate()` to make sure you are running the current build. – Stan Apr 30 '15 at 08:57

3 Answers3

0

I just again uninstalled AndroidStudio and clear the registery and made it like a fresh install for the 3rd time and I don't know how but this time it worked! But didn't get what exactly happened!

Kavin Prabhu
  • 2,307
  • 2
  • 17
  • 36
0

I solved it by rebuilding the project. Go to the build tab

0

you should configure Run/Debug Configuration again and add to "Before launch" section "Gradle-aware Make" that's itRun/Debug Configuration