官术网_书友最值得收藏!

Instant Run

In earlier versions of Android Studio, each time a project was run on any kind of device, a full build had to be performed. Even if we made only tiny changes to our code, we would still have to wait for the entire app to be rebuilt and reinstalled. This could prove very time-consuming, especially on less powerful machines. This slowness often resulted in having to test several modifications at once, leading to a more complex debugging process than is ideal.

Instant Run attempts to build only those classes or activities that have been changed since the last build, and providing the manifest file has not been edited, the app is not even reinstalled, and in some cases, the launch activity is not even restarted.

As Instant Run is a recent innovation, it is unfortunately not available on all versions of Android and, to take full advantage of it, you will need to set the minimum SDK level to API 21 or higher, although elements of it will work with API level 15 and higher. In Android Studio, this level is set from the build.gradle (Module: app) file, as follows:

android { 
compileSdkVersion 25
buildToolsVersion "25.0.1"
defaultConfig {
applicationId "com.mew.kyle.chapterone"
minSdkVersion 21
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

More often than not, we try to make our apps as backward-compatible as possible and developing an app that only works with API level 21 or higher would seriously limit the number of users we can reach. However, the time Instant Run saves us makes it worthwhile to test and debug an app API 21 or higher and then, later, reassemble it to match the versions we wish to target.

When deciding which Android versions to target, a useful dashboard displays the up-to-date usage data of platforms and screens. It can be found at developer.android.com/about/dashboards/index.html.

Moving from another IDE to Android Studio need not be a difficult transition and will prove invaluable once complete. However, it may be that you have projects developed in other IDEs that you wish to continue developing using Studio. Fortunately, this is a simple task, as the following section demonstrates.

主站蜘蛛池模板: 会昌县| 辛集市| 平塘县| 同心县| 弥勒县| 桐梓县| 垫江县| 柞水县| 南汇区| 滨州市| 宁国市| 历史| 吉木萨尔县| 黎川县| 鄂托克前旗| 潍坊市| 凤冈县| 磐安县| 华阴市| 铁岭县| 邯郸市| 阿巴嘎旗| 东兰县| 邢台县| 苏尼特右旗| 南宁市| 通道| 奇台县| 格尔木市| 星座| 盘锦市| 巍山| 江孜县| 永昌县| 苍梧县| 汕头市| 明水县| 蓬莱市| 定远县| 海兴县| 宕昌县|