Android应用仅在API 25上运行

时间:2017-06-23 17:14:42

标签: android android-studio

现在这很奇怪。无论它是什么项目,我的Android应用程序不会在任何其他roms上运行,但仅基于API 25。默认的hello world应用程序甚至不会在任何其他API上运行。 基本上除了基于nouugat的rom之外,其他所有rom上的apk安装都会失败。
我的minsdkversion是21,但

这是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(项目): -

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
}

1 个答案:

答案 0 :(得分:1)

我遇到了同样的问题..

在Android Studio 2.3及更高版本中,有“即时运行”可能会影响您的代码。

停用即时运行

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

在我的情况下,它工作得很完美,我希望这可以帮助你。