当前位置: 首页 > 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

在这里插入图片描述

http://www.dtcms.com/a/174465.html

相关文章:

  • 三极管偏置电路分析
  • 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版本的全流程实践
  • 【LDM】视觉自回归建模:通过Next-Scale预测生成可扩展图像(NeurIPS2024最佳论文阅读笔记与吃瓜)
  • 打造智慧养老实训室,构建科技赋能养老新生态
  • TDengine 车联网案例
  • 51单片机同一个timer 作为定时器和波特率发生器么?
  • LeetCode 热题 100 79. 单词搜索
  • Spring Cloud Stream集成RocketMQ(kafka/rabbitMQ通用)
  • 如何选择 边缘计算服务器
  • 代码随想录图论part03
  • 总结一下最近的知识盲区(个人笔记)
  • 抖音热门视频评论数追踪爬虫获取