Android apps will only run on API 25

This is very strange now. No matter what project it is, my Android app won't run on any other roms, but only based on API 25. By default, the app hello world

doesn't even run on any other API. Basically the apk installation does not work on all other roms except those based on nougat.
Mine minsdkversion

is 21 though

Here is an example build.gradle (Module: app)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "26.0.0"
    defaultConfig {
        applicationId "com.rishav.basictest"
        minSdkVersion 21
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation 'com.android.support:appcompat-v7:25.4.0'
    testImplementation 'junit:junit:4.12'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
}

      

build.gradle (project): -

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0-alpha4'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

      

+3


source to share


1 answer


I met the same problem.

In Android Studio 2.3 and up, there is an instant run that can affect your code.

Disable Instant Run



File -> Settings -> Build, Execution, Deployment -> Instant Run

      

It worked fine in my case, I hope it helps you.

+1


source







All Articles