zoukankan      html  css  js  c++  java
  • Android Development HandBook-Android Studio 特别篇

    开发准备中http://www.cnblogs.com/dev2007/p/4059829.html

    主要介绍了基础环境的搭建,开发工具主要是Eclipse,由于Android Studio使用越来越广,此篇针对Android Studio相关简要说明。

    首先推荐

    网站1:http://www.androiddevtools.cn/ 几乎android相关工具都能在上面下载。

    网站2:http://www.android-studio.org/ Android Studio的中文社区

    1. Android Studio下载

    2.安装完成后,SDK镜像地址配置(针对没有使用VPN的同学)

      按照 http://www.androiddevtools.cn/ 首页的教程参照即可

    关于Gradle(以下示例为Module:app的builde.gradle)

    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 23
        buildToolsVersion "23.0.1"
    
        defaultConfig {
            applicationId "com.awu.kanzhihu"
            minSdkVersion 15
            targetSdkVersion 23
            versionCode 1
            versionName "1.1.20160120"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }
    
    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        testCompile 'junit:junit:4.12'
        compile(name: 'roundedimageview', ext: 'aar')
        compile 'com.android.support:appcompat-v7:23.1.1'
        compile 'com.android.support:design:23.1.1'
        compile 'com.mcxiaoke.volley:library:1.0.19'
        compile 'com.google.code.gson:gson:2.2.4'
        compile 'com.android.support:cardview-v7:23.1.1'
        compile 'com.android.support:support-v4:23.1.1'
        compile 'com.umeng.analytics:analytics:latest.integration'
        compile files('libs/umeng-update-v2.6.0.1.jar')
    }

    简要说明:

    apply plugin: 'com.android.application'

    表明这个模块是app的,即我们的apk项目,另外还有library项目(android studio中为Module项目)。

    android {
        compileSdkVersion 23
        buildToolsVersion "23.0.1"
    
        defaultConfig {
            applicationId "com.awu.kanzhihu"
            minSdkVersion 15
            targetSdkVersion 23
            versionCode 1
            versionName "1.1.20160120"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }

    可以通过它配置apk编译工具版本,编译sdk版本,适配版本(原本应该写在androidmainfest.xml里的,比如最低SDK版本,适配SDK版本,android studio默认是这样的,比如以上代码中。也可参看项目中build.gradle(Module:app)

      

    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        testCompile 'junit:junit:4.12'
        compile(name: 'roundedimageview', ext: 'aar')
        compile 'com.android.support:appcompat-v7:23.1.1'
        compile 'com.android.support:design:23.1.1'
        compile 'com.mcxiaoke.volley:library:1.0.19'
        compile 'com.google.code.gson:gson:2.2.4'
        compile 'com.android.support:cardview-v7:23.1.1'
        compile 'com.android.support:support-v4:23.1.1'
        compile 'com.umeng.analytics:analytics:latest.integration'
        compile files('libs/umeng-update-v2.6.0.1.jar')
    }

    配置工程要使用的库

    1.远程服务器库中有这个lib,Gradle配置名称后,会自动从远程下载这个lib,不需要自己本地添加

    2.本地添加的lib,也要按files引用的方式,添加进来

    其他用途:

    按照不同参数,编译多个apk(比如在androidmainfest.xml需要增加渠道值来区分不同apk)

    关于Git

    如果项目本身是Git管理的,在android studio里,直接添加对该项目的版本管理Add Root后(如果报git找不到的异常,需要安装git软件),菜单项中就会有版本管理的图标,可视化操作相对很方便。

  • 相关阅读:
    How to Use .Net Remoting Using C#
    How to: Build a Client Application
    C# 禁用鼠标中间键
    秒杀系统:设计方案与实现思路
    JDBC连接数据库
    Java调用webService示例
    spring MVC
    rust贪吃蛇
    初识智遥工作流软件——表单开发篇2
    初识智遥工作流软件——表单开发篇1
  • 原文地址:https://www.cnblogs.com/dev2007/p/5159400.html
Copyright © 2011-2022 走看看