Android-1

res 资源目录
不同资源放在不同的目录,生成对应的资源清单类
AndroidMainfest.xml

四大组件

Activity

Activity是应用中负责与用户交互组件
View是所有UI、容器控件的基类

Service

是后台运行,不需要跟用户交互
运行之后有自己独立的生命周期

BroadcastReceiver

广播消息接受器
监听的是Android应用中的其他组件

ContentProvider

跨应用的数据交换

Intent

可以启动应用中的另一个Activity或Service
可以发送广播消息来触发系统中的BroadcastReceiver
Activity、Service、BroadcastReceiver 三者可以使用Inter作为通信载体

构建文件

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        jcenter() // 代码托管仓库
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.0-alpha08'
//        项目构建插件

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

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
apply plugin: 'com.android.application'
//应用程序模块,可以直接运行,库 不能直接运行

android {
//    闭包
    compileSdkVersion 27
//    具体的配置
    defaultConfig {
        applicationId "com.example.liuhuajian.myapplication2"
//        最低兼容的版本
        minSdkVersion 25
//        测试过的版本
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
//    生产安装文件的配置
    buildTypes {
//正式包
        release {
//            代码是否混淆
            minifyEnabled false
//            混淆规则
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
//        debug  测试包
    }
}
//依赖 :本地依赖、远程依赖、库依赖
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}

日志打印

log.v() 小日志,verbose 最小级别的日志
log.d() debug 调试日志
log.i() info
log.w() warn 警告
log.e() 错误信息

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值