android入门

知识点
1.android的系统架构
2.AndroidManifest.xml文件中确定主界面的代码
3.区分AppCompatActivity与Activity的区别
4.build.gradle详解(笔记一下,以后用的时候直接查看)

1.在介绍android的系统架构之前大家先看一张图

这里写图片描述

android系统架构包含四个层面:Linux内核层,系统运行层,应用框架层,应用层。

①Linux内核层:
为android设备的各种硬件提供了底层的驱动。比如:显示驱动,音频驱动等
②系统运行层(c/c++在这里)
SQLite、Webkit等在这里。
Android运行库层还包含了Dalvik虚拟机(5.0之后改为ART运行环境),Dalvik是专门为移动设备定制的,它针对手机内存,CUP性能有限等情况做了优化处理.
③应用框架层:
这一层主要提供了构建应用程序时可能用到的各种API.
④应用层
手机上的应用程序都属于这一层

2.AndroidManifest.xml文件中确定主界面的代码(表示是主活动)

<intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>

3.AppCompatActivity与Activity的区别
AppCompatActivity是Activity的子类,这是一种向下兼容的Activity,可以将Activity在各个系统版本中增加的特性和功能最低兼容到Android2.1系统。

4.build.gradle详解(笔记一下,以后用的时候直接查看)

工程

buildscript {
    repositories {
        jcenter()//代码托管仓库,理解为一个用来存放代码的地方
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.2'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

项目

//这里一般有两种值可选'com.android.application'表示应用程序模块(可以直接运行)
//com.android.library表示这是一个库模块(依附于别的应用程序模块来运行)
apply plugin: 'com.android.application'

android {
    compileSdkVersion 24//指定编译的版本
    buildToolsVersion "25.0.1"//指定项目构建工具的版本

    defaultConfig {
        applicationId "com.atguigu.myapplication"//项目的包名
        minSdkVersion 19//最低兼容Android系统版本
        targetSdkVersion 24//表示已经在此版本上进行了充分的测试
        versionCode 1//项目的版本号
        versionName "1.0"//项目的版本名

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    }
    buildTypes {//通常只会有两个包,一个是release,一个是debug(可以忽略不写)
        release {
            minifyEnabled false//是否进行代码混淆
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])//本地依赖库声明
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:24.2.1'//远程依赖
    testCompile 'junit:junit:4.12'
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值