// 在module中,build.gradle.kts不能使用下面的方式来引用本地jar包。 // 不能使用 fileTree 这种方式,Android studio可以打包成功,但是命令行【./gradlew assembleRelease 】会失败。因为是在 module中不允许加载本地aar包 // implementation(fileTree("libs") { include("*.aar", "*.jar")}) // 但是,compileOnly的可以直接写 compileOnly(fileTree("libs-compileOnly") { include("*.aar", "*.jar") }) // 需要在settings.gradle.kts中,先配置需要加载哪里的本地jar包 dependencyResolutionManagement { repositories { flatDir { // 使用本地 aar 包地址 dirs("app-某个module/libs") } } } // 然后在module中,通过下面的方式,来直接引用。xxxc不需要再写路径,直接写名称就行 implementation(mapOf("name" to "xxxc", "ext" to "jar"))
android开发注意
转载请备注引用地址:编程记忆 » android开发注意