Android应用程序仅能在API 25上运行。

3
这现在非常奇怪。无论是什么项目,我的 Android 应用程序都只能在基于 API 25 的 ROM 上运行。甚至连默认的“Hello World”应用程序也不能在任何其他 API 上运行。 基本上,在除了 Nougat 以外的所有其他 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(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
}

失败的原因是什么? - Gabe Sechan
当您在API 21设备上运行应用程序时会发生什么? - Code-Apprentice
@GabeSechan 在Android Studio中出现错误,显示“Apk无法安装-0”。 - Rishav
@Code-Apprentice 同样的问题。它根本无法安装。 - Rishav
嗨,我在Android开发方面还比较新手,现在遇到了同样的问题。即使我选择了Jellybean来创建项目,它也无法安装在其他API级别上,只能在Nougat上安装。使用sdk 26.0.0可能与此有关。当我开始使用“26.0.0”时,这个问题可能就开始出现了。 - user6506253
@Rishav 如果不确定,就假设这是AS alpha/beta的一个值得向Android团队报告的错误;-) - DaveNOTDavid
1个回答

1

我遇到了相同的问题..

在Android Studio 2.3及更高版本中,有可能会受到Instant Run的影响。

禁用Instant Run

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

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

我会尝试禁用即时运行并回报结果。但是,即使我导出我的应用程序后问题仍然存在,这不应该是无关紧要的。另外,我正在使用Android Studio 3.0 canary 4。 - Rishav

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接