Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android studio not refreshing new versions

With an ASUS ZenPad10 happens that sometime I run an application but instead the old one get started. So I think to have fixed something but actually I'm testing the version that has still the bug, loosing a lot of time.

With other tablets this doesn't happen. Beside that, I need to disable ADB for starting the app in the tablet. With a Nexus 10 I have no need to do any of that.

In the /data/app directory there is also all directories (like "myapp/") instead of apks (like "myapp.apk") as in the Nexus 10.

Any idea to avoid the problems with the refresh?

I wonder if "Verify apps over USB" might be the cause, but I'm not able to disable it on the ASUS.

I think it's not necessary, but this is my main gradle file:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        maven { url "http://dl.bintray.com/populov/maven" }
        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.+'
    }
}

allprojects {
    repositories {
        mavenCentral()
        jcenter()
        maven {
            url 'https://github.com/suckgamony/RapidDecoder/raw/master/repository'
        }
    }
}

task wrapper(type: Wrapper) {
    gradleVersion = '2.5' //version required
}

And this is my App gradle file:

apply plugin: 'com.android.application'

dependencies {
    compile fileTree(include: '*.jar', dir: 'libs')
    compile project(':Structure:StructureExam')
    compile 'com.github.bmelnychuk:atv:1.2.+'
    compile 'com.github.johnkil.print:print:1.3.1'
    compile 'de.codecrafters.tableview:tableview:0.9.6'
}

android {
    compileSdkVersion 23
    buildToolsVersion '23.0.1'

    signingConfigs {
        release {
            storeFile file("../../myfile.jks")
            storePassword "mypass"
            keyAlias "myalias"
            keyPassword "mypass"
        }
    }

    buildTypes {
        release {
            signingConfig signingConfigs.release
        }
    }

    lintOptions {
        checkReleaseBuilds false
        // Or, if you prefer, you can continue to check for com.centervue.lib_util.errors in release builds,
        // but continue the build even when com.centervue.lib_util.errors are found:
        abortOnError false
    }

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }

        // Move the tests to tests/java, tests/res, etc...
        instrumentTest.setRoot('tests')

        // Move the build types to build-types/<type>
        // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
        // This moves them out of them default location under src/<type>/... which would
        // conflict with src/ being used by the main source set.
        // Adding new build types or product flavors should be accompanied
        // by a similar customization.
        debug.setRoot('build-types/debug')
        release.setRoot('build-types/release')
    }
}
like image 271
Filnik Avatar asked Feb 16 '16 17:02

Filnik


2 Answers

It looks you have instant-run ON ( which is by default ). That feature leads to ship only changed code to app on device. that what might causing troubles you are facing...

Disable it: [Settings/preferences] -> Build, Execution, Deployment -> Instant Run : Uncheck "Enable Instant Run to hot swap code..... "

Alternatively you can use clean and Rerun 'app' from Run (^⌘R)

like image 113
Maher Abuthraa Avatar answered Oct 05 '22 11:10

Maher Abuthraa


In Android Studio goto run -> Edit Configurations... and under app and the general tab check if you have Gradle-aware Make under "before launch". if not add it with the plus.

You should also make sure everything in your build.gradle is correct, especially under defaultConfig.

These are common fixes to the problem, however, it is strange that only one specific device is having the issue. I'll keep investigating and edit this answer if I find a solution but try these for now.

like image 20
cammace Avatar answered Oct 05 '22 11:10

cammace