当前位置: 首页 > news >正文

Android组件化 -> Debug模式下,本地构建module模块的AAR和APK

本地构建module模块的AAR

gradle.properties

isCommonApp = false

模块的build.gradle

  • apply plugin: 'com.android.library'module模块编译
  • manifest.srcFile 'src/main/AndroidManifest.xml':读取没有启动AppActivity的配置文件
if (isCommonApp.toBoolean()){apply plugin: 'com.android.application'
}else{apply plugin: 'com.android.library'
}
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'android {namespace 'com.example.lib_common'compileSdk 34sourceSets{main{// 如果是app, 独立调试,如果是module, 壳工程调试if (isCommonApp.toBoolean()) {manifest.srcFile 'src/main/java/moduleDebug/AndroidManifest.xml'} else {manifest.srcFile 'src/main/AndroidManifest.xml'}}}signingConfigs{release{storeFile file('../build_keystore/release.jks')storePassword '19980226'keyAlias 'release_key'keyPassword '19980226'}}defaultConfig {if (isCommonApp.toBoolean()){applicationId "com.example.lib_common"}minSdk 24testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"consumerProguardFiles "consumer-rules.pro"}buildTypes {release {signingConfig signingConfigs.releaseminifyEnabled falseproguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'}}compileOptions {sourceCompatibility JavaVersion.VERSION_17targetCompatibility JavaVersion.VERSION_17}kotlinOptions {jvmTarget = '17'}}dependencies {api libs.androidx.core.ktxapi libs.androidx.appcompatapi libs.materialapi libs.androidx.activityapi libs.androidx.constraintlayoutapi libs.junitapi libs.androidx.junitapi libs.androidx.espresso.coreapi "androidx.lifecycle:lifecycle-process:2.6.2"
}

读取没有启动页的AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest>
</manifest>

Gradle指令编译AAR

./gradlew :lib_common:assembleDebug

在这里插入图片描述

本地构建module模块的APK

gradle.properties

isCommonApp = true

模块的build.gradle

  • apply plugin: 'com.android.application'app模块编译
  • manifest.srcFile 'src/main/java/moduleDebug/AndroidManifest.xml':读取指定启动AppActivity的配置文件
if (isCommonApp.toBoolean()){apply plugin: 'com.android.application'
}else{apply plugin: 'com.android.library'
}
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'android {namespace 'com.example.lib_common'compileSdk 34sourceSets{main{// 如果是app, 独立调试,如果是module, 壳工程调试if (isCommonApp.toBoolean()) {manifest.srcFile 'src/main/java/moduleDebug/AndroidManifest.xml'} else {manifest.srcFile 'src/main/AndroidManifest.xml'}}}signingConfigs{release{storeFile file('../build_keystore/release.jks')storePassword '19980226'keyAlias 'release_key'keyPassword '19980226'}}defaultConfig {if (isCommonApp.toBoolean()){applicationId "com.example.lib_common"}minSdk 24testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"consumerProguardFiles "consumer-rules.pro"}buildTypes {release {signingConfig signingConfigs.releaseminifyEnabled falseproguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'}}compileOptions {sourceCompatibility JavaVersion.VERSION_17targetCompatibility JavaVersion.VERSION_17}kotlinOptions {jvmTarget = '17'}}dependencies {api libs.androidx.core.ktxapi libs.androidx.appcompatapi libs.materialapi libs.androidx.activityapi libs.androidx.constraintlayoutapi libs.junitapi libs.androidx.junitapi libs.androidx.espresso.coreapi "androidx.lifecycle:lifecycle-process:2.6.2"
}

读取有启动页的AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"><application android:name=".LibCommonApp"android:theme="@style/Theme.AppCompat"><activity android:name=".LibCommonActivity"><intent-filter><action android:name="android.intent.action.MAIN" /><category android:name="android.intent.category.LAUNCHER" /></intent-filter></activity></application>
</manifest>

Gradle指令编译APK

./gradlew :lib_common:assembleDebug

在这里插入图片描述

相关文章:

  • 三极管偏置电路分析
  • 51单片机入门教程——AT24C02(I2C 总线)
  • 在PBiCGStab(Preconditioned Bi-Conjugate Gradient Stabilized)算法中处理多个右端项的block版本
  • Github Action部署node项目
  • 论文阅读笔记——ROBOGROUND: Robotic Manipulation with Grounded Vision-Language Priors
  • 一个基于Asp.Net Core + Angular + Bootstrap开源CMS系统
  • 【离线安装python包的方法】
  • Nginx 安全防护与 HTTPS 部署
  • 【基础】Python包管理工具uv使用教程
  • Linux远程管理
  • HHsuite3 的 HHblits 和 HHsearch比较
  • 【上位机——MFC】单文档和多文档视图架构
  • TestStand API 简介
  • 猿人学web端爬虫攻防大赛赛题第7题——动态字体,随风漂移
  • 本地文件批量切片处理与大模型精准交互系统开发指南
  • C# 使用SunnyUI控件 (VS 2019)
  • UE5 渲染思路笔记(角色)
  • Java学习手册:分库分表策略
  • UE5 诺伊腾动捕使用笔记
  • 欧拉系统(openEuler)上部署OpenStack的完整指南 ——基于Yoga版本的全流程实践
  • 上海黄浦区拟73.2654亿元协议出让余庆里7宗组合地块
  • 丁薛祥在学习《习近平经济文选》第一卷专题研讨班上强调:深入学习贯彻习近平经济思想,加强党中央对经济工作的集中统一领导
  • 娱见 | 为了撕番而脱粉,内娱粉丝为何如此在乎番位
  • “高校领域突出问题系统整治”已启动,聚焦招生、基建、师德等重点
  • 乘客被困停滞车厢超4小时,哈尔滨铁路局客服:列车晚点,表示歉意
  • 张建华评《俄国和法国》|埃莲娜·唐科斯的俄法关系史研究