AndroidStudio介绍,代理配置,特性,技巧及从eclipse迁移到as
2016-01-04 11:57
691 查看
Android Studio视图
前言:
Android Studio 是google官方正式开发Android应用程序的开发工具,这玩意是基于IntelliJ IDEA,AndroidStudio 提供如下功能:
简单说:
灵活的gradle编译系统
编译变量和多apk的生成(变量是指不同产品的标识,比如debug和release)
代码模板帮助我们构建具有相同特性的app
支持布局拖拽和主题编辑的布局编译器
line tools 工具
签名支持
google 云平台
For specific Android Studio how-to documentation, see the pages in the Workflow section, such as Managing Projects from Android Studio and Building and Running from Android Studio. For a summary of the latest changes to Android Studio, see the Android Studio Release Notes.
如果你用as做Android开发,可以看看这些workflow这部分文档,比如在as中管理工程,编译和运行app以及as的历史版本。
1,Project and File Structure 工程目录结构及对应的文件结构
Project 整个工程目录结构
Packages每个项的目目录结构,包含src和res
Android每个项目的目录结构,包含src,res, manifests和整体的gradle配置文件
2,Android Build System Android编译系统,也就是使用gradle
3,Debug and Performance 调试及各种性能工具
Android Studio provides a number of improvements to assist you in debugging and improving the performance of your code, including an improved virtual device management, inline debugging, and performance analysis tools.
4,Android Virtual Device (AVD) Manager 模拟器管理
5,Inline debugging 调试
6,Memory and CPU monitor 内存和cpu监听
7,Heap dump 内存镜像,可以看到内存的
8,Allocation tracker 内存分配和跟踪
9,Data file access 数据存储
10,Code inspections 代码检查及命令行模式
11,Annotations in Android Studio 注解包的依赖
12,Inferring nullability 在你使用分析工具的时候,null的验证
To run a nullability analysis in Android Studio, select the Analyze > Infer Nullity menu option. Android Studio inserts the Android @Nullable and @NonNull annotations in detected locations in your code. After running a null analysis, it’s good practice to verify the injected annotations.
13,Log messages log信息
AndroidStudio Configuration
SDK Manager 更新配置
Settings –>Appearance –>System Settings–> Updates
Update channels 更新渠道
Proxy Settings 代理配置:
For application-specific HTTP proxy settings, set the proxy settings in the build.gradle file as required for each application module.
每个app的配置:
For project-wide HTTP proxy settings, set the proxy settings in the gradle/gradle.properties file.
整个工程的配置:
Features
不做过多介绍:
Translations Editor i18N的适配编辑器
Android Wear and TV support 手环和tv开发的支持
Fingerprint Support 指纹识别的支持
Developer Services google 的开发服务
Public and Private Resources 公用私有资源,这个值得研究
Tips and Tricks
开发技巧和秘籍:部分快捷键,反编译,注解,布局的所有机型视图
Migrating from Eclipse ADT
迁移工作,从eclipse迁移到AndroidStudio
Project Structure 工程目录:
整体对比:
目录结构对比图:
Mainfest对比:
Application ID for package identification
Build variants 不同包名打包配置:
Dependencies 依赖库
Gradle-based Build Process gradle 命令
直接在Terminal 中输入gradlew assemble
这个会下载对应的gradle版本:
对应的配置在 gradle\wrapper\gradle-wrapper.properties
如果想看所有的命令: Gradle 默认在右边
Using the Android Studio build system’s declarative logic
宏定义
Resource Optimization res优化
Resource shrinking res缩减
Filtering language resources 语言资源过滤:
Files to ignore 忽略文件配置:
A number of Android Studio files are typically not added to version control as these are temporary files or files that get overwritten with each build. These files are listed in an exclusion file, such as .gitignore, for the project and each app module. Typically, the following files are excluded from version control:
前言:
Android Studio 是google官方正式开发Android应用程序的开发工具,这玩意是基于IntelliJ IDEA,AndroidStudio 提供如下功能:
Flexible Gradle-based build system Build variants and multiple apk file generation Code templates to help you build common app features Rich layout editor with support for drag and drop theme editing lint tools to catch performance, usability, version compatibility, and other problems ProGuard and app-signing capabilities Built-in support for Google Cloud Platform, making it easy to integrate Google Cloud Messaging and App Engine And much more
简单说:
灵活的gradle编译系统
编译变量和多apk的生成(变量是指不同产品的标识,比如debug和release)
代码模板帮助我们构建具有相同特性的app
支持布局拖拽和主题编辑的布局编译器
line tools 工具
签名支持
google 云平台
For specific Android Studio how-to documentation, see the pages in the Workflow section, such as Managing Projects from Android Studio and Building and Running from Android Studio. For a summary of the latest changes to Android Studio, see the Android Studio Release Notes.
如果你用as做Android开发,可以看看这些workflow这部分文档,比如在as中管理工程,编译和运行app以及as的历史版本。
1,Project and File Structure 工程目录结构及对应的文件结构
Project 整个工程目录结构
Packages每个项的目目录结构,包含src和res
Android每个项目的目录结构,包含src,res, manifests和整体的gradle配置文件
2,Android Build System Android编译系统,也就是使用gradle
3,Debug and Performance 调试及各种性能工具
Android Studio provides a number of improvements to assist you in debugging and improving the performance of your code, including an improved virtual device management, inline debugging, and performance analysis tools.
4,Android Virtual Device (AVD) Manager 模拟器管理
5,Inline debugging 调试
6,Memory and CPU monitor 内存和cpu监听
7,Heap dump 内存镜像,可以看到内存的
8,Allocation tracker 内存分配和跟踪
9,Data file access 数据存储
10,Code inspections 代码检查及命令行模式
11,Annotations in Android Studio 注解包的依赖
12,Inferring nullability 在你使用分析工具的时候,null的验证
To run a nullability analysis in Android Studio, select the Analyze > Infer Nullity menu option. Android Studio inserts the Android @Nullable and @NonNull annotations in detected locations in your code. After running a null analysis, it’s good practice to verify the injected annotations.
13,Log messages log信息
AndroidStudio Configuration
SDK Manager 更新配置
Settings –>Appearance –>System Settings–> Updates
Update channels 更新渠道
Canary channel: 二进制 Dev channel: 开发 Beta channel: 测试 Stable channel: 稳定
Proxy Settings 代理配置:
For application-specific HTTP proxy settings, set the proxy settings in the build.gradle file as required for each application module.
每个app的配置:
apply plugin: 'com.android.application' android { ... defaultConfig { ... systemProp.http.proxyHost=proxy.company.com systemProp.http.proxyPort=443 systemProp.http.proxyUser=userid systemProp.http.proxyPassword=password systemProp.http.auth.ntlm.domain=domain } ... }
For project-wide HTTP proxy settings, set the proxy settings in the gradle/gradle.properties file.
整个工程的配置:
# Project-wide Gradle settings. ... systemProp.http.proxyHost=proxy.company.com systemProp.http.proxyPort=443 systemProp.http.proxyUser=username systemProp.http.proxyPassword=password systemProp.http.auth.ntlm.domain=domain systemProp.https.proxyHost=proxy.company.com systemProp.https.proxyPort=443 systemProp.https.proxyUser=username systemProp.https.proxyPassword=password systemProp.https.auth.ntlm.domain=domain ...
Features
不做过多介绍:
Translations Editor i18N的适配编辑器
Android Wear and TV support 手环和tv开发的支持
Fingerprint Support 指纹识别的支持
Developer Services google 的开发服务
Ads using AdMob Analytics Google Analytics Authentication using Google Sign-in Notifications using Google Cloud Messaging
Public and Private Resources 公用私有资源,这个值得研究
Tips and Tricks
开发技巧和秘籍:部分快捷键,反编译,注解,布局的所有机型视图
Migrating from Eclipse ADT
迁移工作,从eclipse迁移到AndroidStudio
Project Structure 工程目录:
整体对比:
目录结构对比图:
Mainfest对比:
Application ID for package identification
apply plugin: 'com.android.application' android { compileSdkVersion 19 buildToolsVersion "19.1" defaultConfig { applicationId "com.example.my.app" minSdkVersion 15 targetSdkVersion 19 versionCode 1 versionName "1.0" } ...
Build variants 不同包名打包配置:
productFlavors { pro { applicationId = "com.example.my.pkg.pro" } free { applicationId = "com.example.my.pkg.free" } } buildTypes { debug { applicationIdSuffix ".debug" } } ....
Dependencies 依赖库
dependencies { /* ,exclude: 'android-support-v13.jar'' */ /*哪个jar不被编译*/ compile fileTree(dir: 'libs', include: ['*.jar']) /*compile files('libs/*.jar')*/ compile 'com.android.support:appcompat-v7:22.0.0' // 可以不适用appcompat-v7 }
// Module dependency 依赖库 compile project(":lib") // Remote binary dependency compile 'com.android.support:appcompat-v7:19.0.1' // Local binary dependency 本地jar compile fileTree(dir: 'libs', include: ['*.jar'])
Gradle-based Build Process gradle 命令
assemble assembleDebug assembleRelease
直接在Terminal 中输入gradlew assemble
这个会下载对应的gradle版本:
对应的配置在 gradle\wrapper\gradle-wrapper.properties
#Wed Apr 10 15:27:10 PDT 2013 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
如果想看所有的命令: Gradle 默认在右边
Using the Android Studio build system’s declarative logic
宏定义
def getVersionCode) { def code = … return code } android { defaultConfig { versionCode getVersionCode() … } }
Resource Optimization res优化
Resource shrinking res缩减
android { ... buildTypes { release { minifyEnabled true shrinkResources true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } }
Filtering language resources 语言资源过滤:
apply plugin: 'android' android { compileSdkVersion 22 buildToolsVersion "22.0.1" defaultConfig { minSdkVersion 8 targetSdkVersion 22 versionCode 1 versionName "1.0" resConfigs "en", "de", "es" //Define the included language resources. resConfigs "mdpi", "hdpi" } ...
Files to ignore 忽略文件配置:
A number of Android Studio files are typically not added to version control as these are temporary files or files that get overwritten with each build. These files are listed in an exclusion file, such as .gitignore, for the project and each app module. Typically, the following files are excluded from version control:
.gradle /local.properties /.idea/workspace.xml /.idea/libraries .DS_Store /build /captures
相关文章推荐
- C#操作config文件的具体方法
- a10 config backup for aXAPI
- Web.Config文件配置之限制上传文件大小和时间的属性配置
- Android Studio注释模板介绍
- 基于Zend的Config机制的应用分析
- thinkPHP中config配置文件
- 关于Android Studio 和 Gradle的那些事儿
- 收藏各种技术源码
- VirtualBox-“please use a kernel appropriate for your cpu”
- Analog Trunk Features (模拟中继特征)
- Proxy Auto Config
- kali安装后的基本配置
- CentOS 6.4设置静态IP教程
- 如何迁移Xenapp或xendesktop数据库 Migration citrix Database
- config.sys
- 怎么源码安装 PKG_CONFIG_PATH设置
- 在MyEclipse 6.5中配置ext开发环境
- VirtualBox安装OS异常提示:Unable to boot - please use a kernel appropriate for your CPU.
- Bindable Converter Parameter
- Android Studio 使用 Gradle 打包 Jar-IT蓝豹