工具

Android-Studio

2019-08-15  本文已影响0人  闲云a

原文链接

工欲善其事,必先利其器。——《论语·卫灵公》

概览

探索 Android Studio

配置build

Gradle 依赖项管理指南

dependencies {
    // Dependency on a local library module
    implementation project(":mylibrary")

    // Dependency on local binaries
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    // Dependency on a remote binary
    implementation 'com.example.android:app-magic:12.3'
}

Debug

  1. Show Execution Point
  2. Step Over:单步执行。如果当前行为方法调用(不会跳到方法内部),方法执行完后跳到下一行。
  3. Step Into:与Step Over不同的是,会跳到方法内部(非类库的方法)。
  4. Force Step Into:与Step Into不同的是,始终跳到方法内部。
  5. Step Out:跳出方法,返回到该方法调用处。
  6. Drop Frame
  7. Run to Cursor
  8. Resume Program:程序执行到下一个断点处。
  9. Stop:停止调试。

变量观察

条件断点

循环体内设置。

日志断点

Suspend取消选中,显示日志输入框。

异常断点

单击如下图标,在弹窗中新建异常断点。

变量断点

方法断点

在方法名所在行添加断点。

Plugins

其他

配置Logcat颜色

Assert:#8F0005 深红
Debug:#0070BB 蓝
Error:#FF0006 红
Info:#48BB31 绿
Verbose:#BBBBBB 白
Warning:#BBBB23 黄

Android Gradle plugin

简介

Android Gradle plugin

buildscript {
    repositories {
        // Gradle 4.1 and higher include support for Google's Maven repo using
        // the google() method. And you need to include this repo to download
        // Android Gradle plugin 3.0.0 or higher.
        google()
        jcenter()
        ...
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.1'
        
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

The following table lists which version of Gradle is required for each version of the Android Gradle plugin. For the best performance, you should use the latest possible version of both Gradle and the plugin.

|Plugin version|Gradle version|Build Tools|
|:-|:-|
|1.0.0 - 1.1.3|2.2.1 - 2.3|
|1.2.0 - 1.3.1|2.2.1 - 2.9|
|1.5.0|2.2.1 - 2.13|
|2.0.0 - 2.1.2| 2.10 - 2.13|
|2.1.3 - 2.2.3|2.14.1+|
|2.3.0+|3.3+|
|3.0.0+|4.1+|26.0.2+|
|3.1.0+|4.4+|
|3.2.0 - 3.2.1|4.6+|
|3.3.0 - 3.3.2|4.10.1+|
|3.4.0+|5.1.1+|

3.4.0 (April 2019)

This version of the Android plugin requires the following:

3.3.0 (January 2019)

3.2.0 (September 2018)

3.1.0 (March 2018)

3.0.0 (October 2017)

This version of the Android plugin requires the following:

Optimizations

历史版本

3.4 (April 2019)

3.4.2 (July 2019)
3.4.1 (May 2019)
3.4.0

R8
gradle.properties可以做如下设置:

# Disables R8 for Android Library modules only.
android.enableR8.libraries = false
# Disables R8 for all modules.
android.enableR8 = false

**Note: **For a given build type, if you set useProguard to false in your app module's build.gradle file, the Android Gradle plugin uses R8 to shrink your app's code for that build type, regardless of whether you disable R8 in your project's gradle.properties file.

3.3 (January 2019)

3.0 (October 2017)

Android Studio 3.0 includes an optional new DEX compiler called D8. It will eventually replace the DX compiler, but you can opt-in to use the new D8 compiler now.

Native debugging with Android Studio no longer supports 32-bit Windows.

上一篇下一篇

猜你喜欢

热点阅读