问题
I am new to android development and Android Studio. I also have a physical device which runs android version 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.
My project's target API level (when I create it) is always 23 (Android 6.0 Marshmallow). 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. Is this possible with the current version of Android Studio (1.4.1)?
回答1:
There is no way to choose the target API level using the New Project wizard in Android Studio currently (1.4.1). It should always be the latest version available anyway.
From 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.
To modify it after project creation just edit the targetSdkVersion
value in your build.gradle
file.
来源:https://stackoverflow.com/questions/33517184/how-to-choose-target-api-level-when-creating-a-new-project-in-android-studio