今天学习了构建本地gradle花费1小时,学习bmob后端云的数据服务和部分的短信服务,仔细的阅读了其中的介绍文档,并且参照在CSDN中看了一些demo,花费时间3小时,短信服务没有看完,明天接着看
config.gradle
ext { android = [ compileSdkVersion:29, buildToolsVersion:"29.0.3", applicationId:"com.example.meet", minSdkVersion:28, targetSdkVersion:29, versionCode:1, versionName:"1.0" ] //依赖配置 dependencies = [ "appcompat":'androidx.appcompat:appcompat:1.0.2', "httpclient" : 'org.apache.http.legacy' ] }
app.gradle
apply plugin: 'com.android.application' /* 1,统一性 2,便于管理 3,版本管理 gradle构建性能指标 1,全量编译 2,代码增量编译 3,资源增量编译:修改res下面文件时候 */ android { if(rootProject.hasProperty('devBuild')) { splits.abi.enable=false splits.density.enable=false //禁用png压缩 aaptOptions.cruncherEnabled=false } compileSdkVersion rootProject.ext.android["compileSdkVersion"] buildToolsVersion rootProject.ext.android["buildToolsVersion"] defaultConfig { applicationId rootProject.ext.android["applicationId"] minSdkVersion rootProject.ext.android["minSdkVersion"] targetSdkVersion rootProject.ext.android["targetSdkVersion"] versionCode rootProject.ext.android["versionCode"] versionName rootProject.ext.android["versionName"] //测试 resConfigs("zh","xxhdpi") testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { //自定义gradle debug{ buildConfigField("boolean","LOG_DEVUG","true") buildConfigField("String","LOG_TAG",""MEET"") buildConfigField("String","SP_NAME",""Config"") } release { buildConfigField("boolean","LOG_DEVUG","false") buildConfigField("String","LOG_TAG",""MEET"") buildConfigField("String","SP_NAME",""Config"") minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) // v7 implementation rootProject.ext.dependencies["appcompat"] //添加Framework依赖 implementation project(path: ':framework') implementation 'androidx.constraintlayout:constraintlayout:1.1.3' testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test.ext:junit:1.1.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' }
framework.gradle
apply plugin: 'com.android.library' android { useLibrary rootProject.ext.dependencies["httpclient"] compileSdkVersion rootProject.ext.android["compileSdkVersion"] buildToolsVersion rootProject.ext.android["buildToolsVersion"] defaultConfig { minSdkVersion rootProject.ext.android["minSdkVersion"] targetSdkVersion rootProject.ext.android["targetSdkVersion"] versionCode rootProject.ext.android["versionCode"] versionName rootProject.ext.android["versionName"] testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles 'consumer-rules.pro' } buildTypes { //自定义gradle debug{ buildConfigField("boolean","LOG_DEBUG","true") buildConfigField("String","LOG_TAG",""Meet"") buildConfigField("String","SP_NAME",""Config"") } release { buildConfigField("boolean","LOG_DEBUG","false") buildConfigField("String","LOG_TAG",""Meet"") buildConfigField("String","SP_NAME",""Config"") minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation rootProject.ext.dependencies["appcompat"] testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test.ext:junit:1.1.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' }