Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
p x
MapMultiEngine
Commits
5cd6ea37
Commit
5cd6ea37
authored
Jan 19, 2026
by
p x
Browse files
fat aar 1
parent
1921f8bc
Changes
13
Hide whitespace changes
Inline
Side-by-side
app/build.gradle.kts
View file @
5cd6ea37
import
org.jetbrains.kotlin.fir.scopes.impl.overrides
plugins
{
alias
(
libs
.
plugins
.
android
.
application
)
alias
(
libs
.
plugins
.
kotlin
.
android
)
...
...
@@ -39,10 +41,8 @@ android {
}
}
dependencies
{
implementation
(
fileTree
(
mapOf
(
"dir"
to
"libs"
,
"include"
to
listOf
(
"*.jar"
,
"*.aar"
))))
//
api
(fileTree(mapOf("dir" to "libs","include" to listOf("*.jar", "*.aar"))))
implementation
(
libs
.
androidx
.
core
.
ktx
)
implementation
(
libs
.
androidx
.
appcompat
)
implementation
(
libs
.
material
)
...
...
@@ -64,4 +64,4 @@ dependencies {
// https://github.com/CymChad/BaseRecyclerViewAdapterHelper/ RecyclerView 适配器
implementation
(
"io.github.cymchad:BaseRecyclerViewAdapterHelper4:4.1.7"
)
}
\ No newline at end of file
}
app/libs/mappi-release.aar
0 → 100644
View file @
5cd6ea37
File added
build.gradle.kts
View file @
5cd6ea37
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript
{
repositories
{
// maven { setUrl("https://plugins.gradle.org/m2/") }
}
dependencies
{
// classpath("org.jetbrains.dokka:dokka-base:2.1.0")
// classpath("com.github.kezong:fat-aar:1.3.8")
// classpath("com.github.kezong:fat-aar:1.3.8")
}
}
plugins
{
...
...
@@ -14,15 +19,3 @@ plugins {
// id("org.jetbrains.dokka") version "2.0.0" apply false
// id("org.jetbrains.kotlin.jvm") version "2.1.10" apply false
}
//tasks.register<Jar>("dokkaHtmlJar") {
// dependsOn(tasks.dokkaHtml)
// from(tasks.dokkaHtml.flatMap { it.outputDirectory })
// archiveClassifier.set("html-docs")
//}
//
//tasks.register<Jar>("dokkaJavadocJar") {
// dependsOn(tasks.dokkaJavadoc)
// from(tasks.dokkaJavadoc.flatMap { it.outputDirectory })
// archiveClassifier.set("javadoc")
//}
\ No newline at end of file
mapapi/build.gradle.kts
View file @
5cd6ea37
import
org.jetbrains.dokka.gradle.engine.parameters.VisibilityModifier
import
org.jetbrains.kotlin.gradle.utils.COMPILE
import
org.jetbrains.kotlin.gradle.utils.COMPILE_ONLY
import
org.jetbrains.kotlin.fir.scopes.impl.overrides
plugins
{
alias
(
libs
.
plugins
.
android
.
library
)
alias
(
libs
.
plugins
.
kotlin
.
android
)
id
(
"kotlin-kapt"
)
id
(
"kotlin-parcelize"
)
// id("maven-publish")
// signing
// id ("org.jreleaser") version "1.20.0"//JReleaser now has support for publishing via the Central Publisher Portal and can be used via their Gradle plugin integration.
// id("org.jetbrains.dokka") version "2.0.0"
// kotlin("jvm") version "2.1.0"
// Generates HTML documentation
id
(
"org.jetbrains.dokka"
)
version
"2.1.0"
// Generates Javadoc documentation
id
(
"org.jetbrains.dokka-javadoc"
)
version
"2.1.0"
// id("com.mobbeel.plugin") version "2.0.3"
// id("com.kezong.fat-aar")
// id("maven-publish")
}
...
...
@@ -64,9 +61,8 @@ android {
}
}
dependencies
{
implementation
(
fileTree
(
mapOf
(
"dir"
to
"libs"
,
"include"
to
listOf
(
"*.jar"
,
"*.aar"
))))
//
api
(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar", "*.aar"))))
implementation
(
libs
.
androidx
.
core
.
ktx
)
implementation
(
libs
.
androidx
.
appcompat
)
implementation
(
libs
.
material
)
...
...
@@ -76,11 +72,18 @@ dependencies {
androidTestImplementation
(
libs
.
androidx
.
junit
)
androidTestImplementation
(
libs
.
androidx
.
espresso
.
core
)
// 依赖本地AAR(替换成你的AAR文件名,不需要后缀.aar)
// api(files("libs/AMap3DMap_10.1.201_AMapNavi_10.1.201_AMapSearch_9.7.4_AMapLocation_6.4.9_20250326.jar"))
// api(files("libs/car_and_road_3d-1209-release.aar"))
// api(files("libs/MineNaviSDK-3.9.aar"))
// api(files("libs/unityLibrary-release(12).aar"))
// implementation("org.jetbrains.dokka:android-documentation-plugin:2.1.0")
// dokkaJavadocPlugin("org.jetbrains.dokka:kotlin-as-java-plugin:2.1.0")
dokkaJavadocPlugin
(
"org.jetbrains.dokka:kotlin-as-java-plugin"
)
// dokkaHtmlPlugin("org.jetbrains.dokka:kotlin-as-java-plugin")
// embed(project(path=":maplibs"))
api
(
project
(
":maplibs"
))
// Webview交互
api
(
"com.github.lzyzsd:jsbridge:1.0.4"
)
...
...
@@ -102,6 +105,7 @@ dependencies {
implementation
(
"androidx.fragment:fragment-ktx:1.8.0"
)
// compileOnly("org.jsoup:jsoup:1.17.2") // 最新稳定版
}
...
...
@@ -237,7 +241,6 @@ tasks.named("dokkaGenerateJavadoc") {
finalizedBy
(
"removeUnwantedTags"
)
}
// 在 build.gradle.kts 中添加
tasks
.
register
(
"generateOverviewTree"
)
{
group
=
"documentation"
...
...
@@ -326,6 +329,154 @@ tasks.register("generateOverviewTree") {
//group = "msmap"
//version = "1.0"
afterEvaluate
{
// 关联到 release 变体的 assemble 任务(如需 debug 替换为 "assembleDebug")
val
assembleReleaseTask
=
tasks
.
findByName
(
"assembleDebug"
)
// val assembleReleaseTask = tasks.findByName("assembleDebug")
val
mergeAarsTask
=
tasks
.
named
(
"mergeAarsIntoMappiAar"
,
Copy
::
class
)
assembleReleaseTask
?.
finalizedBy
(
mergeAarsTask
)
}
tasks
.
register
<
Copy
>(
"mergeAarsIntoMappiAar"
)
{
group
=
"build"
description
=
"Merge AARs from maplibs/libs into mappi-release.aar"
// 1. 定义临时目录(解压 AAR 用)
val
tempDir
=
file
(
"$buildDir/tmp/merged_aars"
)
val
mappiAarUnzipDir
=
file
(
"$tempDir/mappi"
)
val
libsAarUnzipDir
=
file
(
"$tempDir/libs_aars"
)
val
outputAarDir
=
file
(
"$buildDir/outputs/aar/"
)
// 2. 清空并重建临时目录
delete
(
tempDir
)
mkdir
(
tempDir
)
mkdir
(
mappiAarUnzipDir
)
mkdir
(
libsAarUnzipDir
)
// 3. 解压 mappi 自身的 AAR 到临时目录
val
mappiAarFile
=
file
(
"$outputAarDir/cusc_map_2.0.aar"
)
if
(
mappiAarFile
.
exists
())
{
from
(
zipTree
(
mappiAarFile
))
into
(
mappiAarUnzipDir
)
}
// 4. 遍历 maplibs/libs 下所有 AAR,解压并合并到 mappi 的 AAR 目录
val
maplibsLibsDir
=
project
(
":maplibs"
).
file
(
"libs"
)
// 关联 maplibs 模块的 libs 目录
val
aarFiles
=
maplibsLibsDir
.
listFiles
{
file
->
file
.
name
.
endsWith
(
".aar"
)
}
?:
emptyArray
()
aarFiles
.
forEach
{
aarFile
->
// 解压当前 AAR 到临时目录
copy
{
from
(
zipTree
(
aarFile
))
into
(
libsAarUnzipDir
)
}
// 4.1 合并 classes.jar(处理冲突:覆盖式合并)
val
libClassesJar
=
file
(
"$libsAarUnzipDir/classes.jar"
)
if
(
libClassesJar
.
exists
())
{
val
mappiClassesJar
=
file
(
"$mappiAarUnzipDir/classes.jar"
)
if
(
mappiClassesJar
.
exists
())
{
// 先解压 mappi 自身的 classes.jar
val
mappiClassesTemp
=
file
(
"$tempDir/mappi_classes"
)
delete
(
mappiClassesTemp
)
mkdir
(
mappiClassesTemp
)
copy
{
from
(
zipTree
(
mappiClassesJar
))
into
(
mappiClassesTemp
)
}
// 再解压依赖 AAR 的 classes.jar 并覆盖
copy
{
from
(
zipTree
(
libClassesJar
))
into
(
mappiClassesTemp
)
}
// 重新打包为 classes.jar
ant
.
withGroovyBuilder
{
"jar"
(
"destfile"
to
mappiClassesJar
.
absolutePath
,
"basedir"
to
mappiClassesTemp
.
absolutePath
)
}
delete
(
mappiClassesTemp
)
}
else
{
// mappi 无 classes.jar,直接复制依赖的
copy
{
from
(
libClassesJar
)
into
(
mappiAarUnzipDir
)
}
}
}
// 4.2 合并 res 目录(资源冲突直接覆盖)
val
libResDir
=
file
(
"$libsAarUnzipDir/res"
)
if
(
libResDir
.
exists
())
{
copy
{
from
(
libResDir
)
into
(
"$mappiAarUnzipDir/res"
)
// 使用 duplicatesStrategy 控制重复文件处理
duplicatesStrategy
=
DuplicatesStrategy
.
INCLUDE
}
}
// 4.3 合并 jni 库(SO 文件)
val
libJniDir
=
file
(
"$libsAarUnzipDir/jni"
)
if
(
libJniDir
.
exists
())
{
copy
{
from
(
libJniDir
)
into
(
"$mappiAarUnzipDir/jni"
)
duplicatesStrategy
=
DuplicatesStrategy
.
INCLUDE
}
}
// 4.4 合并 assets 目录
val
libAssetsDir
=
file
(
"$libsAarUnzipDir/assets"
)
if
(
libAssetsDir
.
exists
())
{
copy
{
from
(
libAssetsDir
)
into
(
"$mappiAarUnzipDir/assets"
)
duplicatesStrategy
=
DuplicatesStrategy
.
INCLUDE
}
}
// 4.5 简易合并 AndroidManifest.xml(复杂场景建议手动调整)
val
libManifest
=
file
(
"$libsAarUnzipDir/AndroidManifest.xml"
)
if
(
libManifest
.
exists
())
{
val
mappiManifest
=
file
(
"$mappiAarUnzipDir/AndroidManifest.xml"
)
if
(
mappiManifest
.
exists
())
{
val
mappiManifestContent
=
mappiManifest
.
readText
(
Charsets
.
UTF_8
)
val
libManifestContent
=
libManifest
.
readText
(
Charsets
.
UTF_8
)
// 提取依赖 AAR manifest 的 application 内内容,合并到 mappi 的 manifest 中
val
libAppContent
=
Regex
(
"(?s).*<application(.*?)>(.*?)</application>.*"
)
.
find
(
libManifestContent
)
?.
groups
?.
get
(
2
)
?.
value
?:
""
val
newMappiManifest
=
mappiManifestContent
.
replace
(
"</application>"
,
libAppContent
+
"</application>"
)
mappiManifest
.
writeText
(
newMappiManifest
,
Charsets
.
UTF_8
)
}
}
// 清空当前 AAR 的解压目录,准备处理下一个
delete
(
libsAarUnzipDir
)
}
// 5. 重新打包合并后的文件为新的 mappi-release.aar
delete
(
mappiAarFile
)
ant
.
withGroovyBuilder
{
"jar"
(
"destfile"
to
mappiAarFile
.
absolutePath
,
"basedir"
to
mappiAarUnzipDir
.
absolutePath
)
}
// 6. 清理临时目录
delete
(
tempDir
)
println
(
"✅ 已将 maplibs/libs 下的 AAR 合并到 mappi-release.aar 中,路径:${mappiAarFile.absolutePath}"
)
}
//publishing {
// publications {
...
...
mapapi/libs/AMap3DMap_10.1.201_AMapNavi_10.1.201_AMapSearch_9.7.4_AMapLocation_6.4.9_20250326.jar
0 → 100644
View file @
5cd6ea37
File added
mapapi/libs/MineNaviSDK-3.9.aar
0 → 100644
View file @
5cd6ea37
File added
mapapi/libs/car_and_road_3d-1209-release.aar
0 → 100644
View file @
5cd6ea37
File added
mapapi/libs/unityLibrary-release(12).aar
0 → 100644
View file @
5cd6ea37
File added
maplibs/build.gradle.kts
View file @
5cd6ea37
import
org.gradle.internal.declarativedsl.parsing.main
plugins
{
alias
(
libs
.
plugins
.
android
.
library
)
alias
(
libs
.
plugins
.
kotlin
.
android
)
id
(
"maven-publish"
)
//
id("maven-publish")
}
android
{
...
...
@@ -31,6 +33,13 @@ android {
kotlinOptions
{
jvmTarget
=
"11"
}
// Package the local AAR into the module's output
sourceSets
{
named
(
"main"
).
configure
{
jniLibs
{
srcDirs
(
"libs/"
)}
}
}
}
dependencies
{
...
...
@@ -38,11 +47,12 @@ dependencies {
// implementation(libs.androidx.core.ktx)
// implementation(libs.androidx.appcompat)
// implementation(libs.material)
testImplementation
(
libs
.
junit
)
androidTestImplementation
(
libs
.
androidx
.
junit
)
androidTestImplementation
(
libs
.
androidx
.
espresso
.
core
)
//
testImplementation(libs.junit)
//
androidTestImplementation(libs.androidx.junit)
//
androidTestImplementation(libs.androidx.espresso.core)
}
/*
publishing {
publications {
register<MavenPublication>("minenai") {
...
...
@@ -63,4 +73,4 @@ publishing {
}
}
}
}
\ No newline at end of file
}*/
maplibs/src/androidTest/java/com/mone/navi/ExampleInstrumentedTest.kt
deleted
100644 → 0
View file @
1921f8bc
package
com.mone.navi
import
androidx.test.platform.app.InstrumentationRegistry
import
androidx.test.ext.junit.runners.AndroidJUnit4
import
org.junit.Test
import
org.junit.runner.RunWith
import
org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith
(
AndroidJUnit4
::
class
)
class
ExampleInstrumentedTest
{
@Test
fun
useAppContext
()
{
// Context of the app under test.
val
appContext
=
InstrumentationRegistry
.
getInstrumentation
().
targetContext
assertEquals
(
"com.mone.navi.test"
,
appContext
.
packageName
)
}
}
\ No newline at end of file
maplibs/src/main/AndroidManifest.xml
deleted
100644 → 0
View file @
1921f8bc
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
</manifest>
\ No newline at end of file
maplibs/src/test/java/com/mone/navi/ExampleUnitTest.kt
deleted
100644 → 0
View file @
1921f8bc
package
com.mone.navi
import
org.junit.Test
import
org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class
ExampleUnitTest
{
@Test
fun
addition_isCorrect
()
{
assertEquals
(
4
,
2
+
2
)
}
}
\ No newline at end of file
settings.gradle.kts
View file @
5cd6ea37
...
...
@@ -24,7 +24,6 @@ dependencyResolutionManagement {
maven
{
setUrl
(
"https://maven.aliyun.com/repository/google"
)
}
maven
{
setUrl
(
"https://maven.aliyun.com/repository/gradle-plugin"
)
}
maven
{
setUrl
(
"https://maven.aliyun.com/repository/public"
)
}
//四维高精地图仓库
// maven {
// isAllowInsecureProtocol = true
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment