@DefinedOne
2015-12-07T03:50:38.000000Z
字数 9007
阅读 930
AndroidStudio集成开发环境(IDE)的初步使用
create at 2015/11/11, update at 2015/12/07
android
studio
ide
使用
配置
下载网址:
Android Studio 中文社区:安卓官方开发工具-Android SDK/JDK/Gradle-下载/安装/升级/教程/汉化
http://android-studio.org/
下载之后按步骤安装。
未配置时,出现这条消息:
Error:Invalid Gradle JDK configuration found.
展开File目录…,进行设置:
File > Project Structure > SDK Location > {
Android SDK Location = D:\android\sdk;
JDK Location = D:\android\jdk\jdk1.8.0_51;
}
下载最新版的Gradle构建工具包:
http://gradle.org/gradle-download/
如:gradle-2.4-all.zip。解压到AndroidStudio的安装路径之内:
D:\Android Studio\gradle\gradle-2.4(之前可能有gradle-2.2.1等)
File > Setting > Build, Execution, Deployment > Build Tools > Gradle {
Project-level settings: {
false = User default gradle wrapper (recommended);
true = Use local gradle distribution {
Gradle home: = D:/Android Studio/gradle/gradle-2.4;
}
}
}
File > Setting > 搜索“File encodings” {
IDE Encoding = UTF-8;
Project Encoding = UTF-8;
Properties Files (*.properties) {
Default encoding for properties files: = UTF-8;
}
}
Settings -> Editor -> Appearance -> Show line numbers = true;
信息来自:
http://www.xuebuyuan.com/526074.html
AndroidStudio会自动连接Google等网站检查自身环境的问题,例如自动更新Gradle。但是长城防火墙(GFW, Great Firewall)阻止电脑访问国外网站,导致AndroidStudio卡顿。
分类: Android 2015-02-10 10:20 199人阅读 评论(0) 收藏 举报
在bin目录下文件idea.properties中最后添加一行,保存重新打开软件即可。
\Program Files\Android\Android Studio\bin\idea.properties {
disable.android.first.run = true;
}
信息来自:
http://blog.csdn.net/Hitourlee/article/details/43409537
http://blog.csdn.net/u012400465/article/details/41900807
http://blog.csdn.net/Nature_Day/article/details/43699925
Android Studio打包运行时出现卡顿:
Gradle: Executing Tasks [:app:assembleDebug]
禁止打包时联网检查,加速Android Studio/Gradle构建
Solved mine with:
File -> Settings -> Build, Execution, Deployment -> Build Tools -> Gradle {
Offline work = true;
}
Gradle builds went from 8 minutes to 3 seconds.
answered Aug 14 at 16:27--mn_test347
设置为离线之后,有时候签名打包会出现错误:
BUILD FAILED
No cached version of com.android.tools.build:gradle:1.3.0 available for offline mode.
这时需要重新设置为在线,它会自动下载一些文件
Download https://jcenter.bintray.com/com/android/tools/build/gradle/1.3.0/gradle-1.3.0.pom
Download https://jcenter.bintray.com/com/android/tools/build/gradle-core/1.3.0/gradle-core-1.3.0.pom
Download https://jcenter.bintray.com/com/android/tools/build/builder/1.3.0/builder-1.3.0.pom
Download https://jcenter.bintray.com/com/android/tools/lint/lint/24.3.0/lint-24.3.0.pom
Download https://jcenter.bintray.com/net/sf/proguard/proguard-gradle/5.2.1/proguard-gradle-5.2.1.pom
Download https://jcenter.bintray.com/net/sf/proguard/proguard-parent/5.2.1/proguard-parent-5.2.1.pom
Download https://jcenter.bintray.com/com/android/tools/build/builder-model/1.3.0/builder-model-1.3.0.pom
Download https://jcenter.bintray.com/com/android/tools/build/builder-test-api/1.3.0/builder-test-api-1.3.0.pom
信息来自:
http://my.oschina.net/sammy1990/blog/388846
http://blog.isming.me/2015/03/18/android-build-speed-up/
https://plus.google.com/u/0/+RicardoAmaral/posts/e9PG6vSN5w3
http://stackoverflow.com/questions/16775197/building-and-running-app-via-gradle-and-android-studio-is-slower-than-via-eclips/23648341#23648341
这里依据使用AndroidStudio新建的Android项目的目录结构进行描述。
MyApplication\app\src\main\java
MyApplication\app\src\main\res
MyApplication\app\src\main\res\drawable-xxhdpi
MyApplication\app\libs // 依赖的“.jar”包
MyApplication\app\src\main\jniLibs\armeabi // 依赖的“.so”包
MyApplication\app\src\main\jniLibs\armeabi-v7a
MyApplication\app\src\main\jniLibs\x86
这里依据使用AndroidStudio新建的Android项目的目录结构进行描述。
按照常用性排序:
MyApplication\app\build.gradle // SDK版本、签名密钥、依赖的包等等
MyApplication\settings.gradle // 配置包含哪几个代码库
MyApplication\build.gradle
MyApplication\app\proguard-rules.pro // 代码混淆的规则的配置
MyApplication\[其他……]
【 待完善 】
include ':app'
include ':umeng_library'
【 待完善 】
apply plugin: 'com.android.application'
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.1'
compile project(':umeng_library')
// compile files('libs/gson-2.3.1.jar')
}
android {
compileSdkVersion 21
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.xxx.xxx" // 应用的名称
minSdkVersion 11
targetSdkVersion 21
versionCode 20
versionName "1.0"
}
signingConfigs {
mySigningConfigTwo {
}
myDefaultSigningConfig {
keyAlias 'mySigningKey'
keyPassword 'myPassword2015'
storeFile file('D:\\android\\key\\android.keystore')
storePassword 'myPassword2015'
}
}
buildTypes {
debug {
}
release {
signingConfig signingConfigs.myDefaultSigningConfig // 使用签名
minifyEnabled false // 是否代码混淆
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
}
2013-05-20 02:50 by youxiachai, 121011 阅读, 34 评论, 收藏, 编辑
用Gradle 构建你的android程序
http://www.cnblogs.com/youxilua/archive/2013/05/20/3087935.html
Studio教程
发起人
monroe
我是傻逼
积分: 4075
威望: 37
擅长话题: MAC 第三方类库 版本控制 安装教程 Studio教程
默认的 module 目录下的 build.gradle 文件内容如上。
apply plugin: 'com.android.application':
表示使用 com.android.application 插件。也就是表示,这是一个 android application module 。 com.android.library 表示,这是一个 android library module 。
android:
配置所有android构建过程需要的参数。
compileSdkVersion:
用于编译的 SDK 版本。
buildToolsVersion:
用于 Gradle 编译项目的工具版本。
defaultConfig:
Android 项目默认设置。
applicationId:应用程序包名。
minSdkVersion:最低支持 Android 版本。
targetSdkVersion:目标版本。实际上应为测试环境下测试机的 Android 版本。
versionCode:版本号。
5. **versionName**:版本名称。
buildTypes:
编译类型。默认有两个: release 和 debug 。我们可以在此处添加自己的 buildTypes ,可在 Build Variants 面板看到(见 讲解1 )。
minifyEnabled:
是否使用混淆。在老版本中为 runProguard ,新版本之所换名称,是因为新版本支持去掉没使用到的资源文件,而 runProguard 这个名称已不合适了。
2. **proguardFiles**:
使用的混淆文件,可以使用多个混淆文件。此例中,使用了 **SDK** 中的 **proguard-android.txt** 文件以及当前 **module** 目录下的 **proguard-rules.pro** 文件。
dependencies:
用于配制引用的依赖。
compile fileTree(dir: 'libs', include: ['*.jar']):
引用当前 module 目录下的 libs 文件夹中的所有 .jar 文件。
2. **compile 'com.android.support:appcompat-v7:21.0.3'**:
引用 **21.0.3**版本的 **appcompat-v7** (也就是常用的 **v7** library 项目)。
版本控制
讲解12
当你在 Android Studio中创建了一个项目之后,默认是没有版本控制的。如果你想对项目进行版本控制,可以这么设置。
VCS --> Enable Version Control Integration 。
http://ask.android-studio.org/?/article/23
$
http://blog.csdn.net/u012956156/article/details/48545203
Android Studio 代码混淆 与 发布release正式签名版本
分类: android网络部分 2015-09-18 13:17 56人阅读
(这篇文章全面的解说了代码混淆)
#
2015/10/30
图片资源文件: MyProject\app\src\main\res\drawable, drawable-hdpi, drawable-mdpi, drawable-xhdpi, drawable-xxhdpi;
依赖的".jar"包:MyProject\app\libs;
依赖的".so"包:MyProject\app\src\main\jniLibs\armeabi, armeabi-v7a, x86;
*app/build.gradle*:
android {
compileSdkVersion 21 // 编译所使用的SDK版本\sdk\platforms\android-21,或者打开SDK Manager查看已经下载的版本
buildToolsVersion "23.0.1" // 编译所使用的构建工具?版本\sdk\build-tools\23.0.1
defaultConfig {
applicationId "com.gis.pror" // 应用名称
minSdkVersion 11
targetSdkVersion 21 //
versionCode 1
versionName "1.0"
}
buildTypes {
release { // 创建发布版本时的配置
minifyEnabled false // 是否代码混淆
shrinkResources true // 收缩资源
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' // 代码混淆的配置文件
}
}
packagingOptions {
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
}
dependencies { // 依赖的程序包
compile fileTree(dir: 'libs', include: ['*.jar']) // 表示依赖\libs\目录下的所有jar包
compile 'com.android.support:appcompat-v7:22.2.1' // 依赖这个程序库
compile files('libs/arcgis-android-api.jar') // 依赖这个jar包
compile project(':umeng_library') // 依赖这个程序库
}
}
AndroidStudio最常用的快捷键
https://zybuluo.com/DefinedOne/note/128869
File > Settings > 直接搜索“Serialization issues” {
true = Serializable class without 'serialVersionUID'
}
自动生成serialVersionUID的操作方法:
Alt+Enter > 第一项 > 第二项 > Enter;
http://blog.csdn.net/zhangxiweicaochen/article/details/12782889
http://stackoverflow.com/questions/23384804/how-to-see-all-todo-tasks-in-android-studio
(Message窗口会提示)
http://blog.csdn.net/hyr83960944/article/details/36437491
分类: android开发 2014-12-11 10:09 59人阅读
http://blog.csdn.net/hujiaxuan1995/article/details/41862995
KKKKKKKKKK-149-2014年12月21日-3关注
0 收藏,4.7k 浏览
电脑配置太低,每次android studio启动就会自动打开上次关闭的项目然后电脑就会卡半天,请教怎么关闭?
2 个回答
0采纳
yy1300326388 22 6月4日 回答 · 6月4日 更新
Appearance & Behavior > System Setting {
Reopen last project on startup = false;
}
http://www.unjeep.com/q/9010612.htm
2015/11/10
http://blog.csdn.net/madison7/article/details/48519273
Error:(1, 0) Plugin with id 'com.android.application' not found.
<a href="openFile">Open File</a>
Plugin with id 'com.android.application' not found
分类: 安卓 2015-09-17 11:13 31人阅读 评论(0) 收藏 举报
android android studio
Android studio
Plugin with id 'com.android.application' not found
解决方案:
打开 [项目文件夹]\app\build.gradle 文件,在文件末尾添加:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
}
}
copy https://zybuluo.com/DefinedOne/note/216419
*end *