简体   繁体   English

在Android Studio中创建新项目时如何选择目标API级别?

[英]How to choose target API level when creating a new project in Android Studio?

I am new to android development and Android Studio. 我是android开发和Android Studio的新手。 I also have a physical device which runs android version 5.0.1. 我也有一个运行Android 5.0.1版的物理设备。 When I try to debug an app from Android Studio on my device I don't get the behavior as in the emulator. 当我尝试从我的设备上的Android Studio调试应用程序时,没有得到模拟器中的行为。

My project's target API level (when I create it) is always 23 (Android 6.0 Marshmallow). 我的项目的目标API级别(创建时)始终为23(Android 6.0棉花糖)。 Although the minimum API level is 17 (Android 4.2 Jelly Bean) I want to know how to set the target API level on project creation. 尽管最低API级别为17(Android 4.2 Jelly Bean),但我想知道如何在项目创建时设置目标API级别。 Is this possible with the current version of Android Studio (1.4.1)? 当前版本的Android Studio(1.4.1)是否可行?

There is no way to choose the target API level using the New Project wizard in Android Studio currently (1.4.1). 当前,无法使用Android Studio(1.4.1)中的“新建项目”向导来选择目标API级别。 It should always be the latest version available anyway. 无论如何,它应该始终是最新版本。

From http://developer.android.com/intl/es/training/basics/supporting-devices/platforms.html#sdk-versions : 来自http://developer.android.com/intl/es/training/basics/supporting-devices/platforms.html#sdk-versions

To allow your app to take advantage of these changes and ensure that your app fits the style of each user's device, you should set the targetSdkVersion value to match the latest Android version available. 为了使您的应用能够利用这些更改并确保您的应用适合每个用户设备的样式,您应该将targetSdkVersion值设置为与可用的最新Android版本匹配。

To modify it after project creation just edit the targetSdkVersion value in your build.gradle file. 要在创建项目后对其进行修改,只需在build.gradle文件中编辑targetSdkVersion值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM