【发布时间】:2021-10-20 22:20:41
【问题描述】:
我正在构建一个 android 库,我想将该库的依赖项作为传递依赖项包含到我的应用程序中。这是我图书馆的build.gradle 文件:
plugins {
id 'com.android.library'
id 'com.github.dcendents.android-maven'
}
group='com.github.rohg007.xxx'
android {
compileSdkVersion 30
defaultConfig {
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
ndk {
abiFilters 'armeabi-v7a', 'arm64-v8a'
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.3.1'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
//SDK level dependencies
implementation 'org.protoojs.droid:protoo-client:4.0.3'
api 'org.webrtc:google-webrtc:1.0.32006'
implementation 'com.squareup.okhttp3:okhttp:4.9.1'
implementation("com.squareup.okhttp3:logging-interceptor:4.9.1")
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'io.reactivex.rxjava2:rxjava:2.2.6'
implementation 'com.jakewharton.timber:timber:4.7.1'
}
repositories {
mavenCentral()
}
当我将库作为模块包含时,它工作正常并且所有传递依赖都得到解决:
implementation project(path: ':huddle01-android-sdk')
但是当我在 Jitpack 上发布并包含它作为依赖项时:
implementation 'com.rohg007.xxx:0.1.0'
或
implementation ('com.rohg007.xxx:0.1.0'){transitive=true}
无法解析 webrtc 依赖。 如何包含对发布的传递依赖?
【问题讨论】:
-
你找到解决方案了吗?
标签: android android-studio gradle android-gradle-plugin jitpack