Android Studio - 无法在设备 minSdk(API 23, N) 上运行应用程序!= device Sdk(API 22) [英] Android Studio - Unable to run app on device minSdk(API 23, N) != device Sdk(API 22)

查看:26
本文介绍了Android Studio - 无法在设备 minSdk(API 23, N) 上运行应用程序!= device Sdk(API 22)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我在我的电脑上重新安装了 linux,在我重新安装了 android studio 之后,我尝试获取一个我写到我手机上的应用程序,这个应用程序以前没有问题.该应用程序针对具有 API 16 或更高版本的设备,但显然 Android Studio 现在具有称为 N 预览的功能,它不允许我在手机上运行任何内容.特别是当我点击运行按钮时,它告诉我

so i reinstalled linux on my computer and after i reinstalled android studio i tried getting an app that i wrote on to my phone which previously had not been a problem. The App ist targeted at devices with API 16 or higher but apparently Android Studio now features something called N preview which does not let me run anything on my phone. specifically when i hit the run button it tells me that

minSdk(API 23, N) != device Sdk(API 22)

minSdk(API 23, N) != device Sdk(API 22)

我知道这似乎目标 API 设置不正确,但是当我开始项目时,我将其设置为 16.现在我该如何解决这个问题?另外,在项目上更改目标 API 的最干净方法是什么?我只是更改构建 gradle 吗?

i know this seems as though the target API isnt set correctly but when i started the project i set it to 16. Now how do i get around this? Also whats the cleanest way to change the target API on a project? Do i just change the build gradle?

非常感谢!

应用 gradle 文件:

app gradle file:

apply plugin: 'com.android.application'

android {
compileSdkVersion 'android-N'
buildToolsVersion "23.0.3"

defaultConfig {
    applicationId "com.example.josias.myapplication"
    minSdkVersion 16
    targetSdkVersion 'N'
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.+'}

推荐答案

ChangecompileSdkVersion 'android-N'compileSdkVersion 22targetSdkVersion 'N'targetSdkVersion 22

Change compileSdkVersion 'android-N' to compileSdkVersion 22 and targetSdkVersion 'N' to targetSdkVersion 22

这篇关于Android Studio - 无法在设备 minSdk(API 23, N) 上运行应用程序!= device Sdk(API 22)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆