Maven 捆绑.aar文件中的所有依赖项
我有一个SDK项目,它引用了gradle中的许多依赖项。我必须要求SDK用户在项目中使用SDK时添加这些依赖项。问题是,每次我添加一些新的依赖项或用新的依赖项替换当前的依赖项时,我也必须要求用户进行更改,我认为这不是一个好的做法。是否有一种方法可以捆绑.aar中的所有依赖项。我使用以下代码生成工件文件Maven 捆绑.aar文件中的所有依赖项,maven,android-studio,gradle,artifacts,Maven,Android Studio,Gradle,Artifacts,我有一个SDK项目,它引用了gradle中的许多依赖项。我必须要求SDK用户在项目中使用SDK时添加这些依赖项。问题是,每次我添加一些新的依赖项或用新的依赖项替换当前的依赖项时,我也必须要求用户进行更改,我认为这不是一个好的做法。是否有一种方法可以捆绑.aar中的所有依赖项。我使用以下代码生成工件文件 uploadArchives{ repositories.mavenDeployer { def deployPath = file(getProperty('aar.de
uploadArchives{
repositories.mavenDeployer {
def deployPath = file(getProperty('aar.deployPath'))
repository(url: "file://${deployPath.absolutePath}")
pom.project {
groupId 'myPackageName'
artifactId 'wingoku-io'
version "0.0.6"
}
}
这些是我的依赖项:
dependencies {
compile 'com.github.nkzawa:socket.io-client:0.5.0'
compile 'com.android.support:cardview-v7:21.+'
compile 'de.greenrobot:eventbus:2.4.0'
}
编辑:
我在uploadArchives方法中添加了以下方法。工件文件的大小增加了,但是当我在app项目中使用.aar文件时,它找不到文件
uploadArchives{
repositories.mavenDeployer {
def deployPath = file(getProperty('aar.deployPath'))
repository(url: "file://${deployPath.absolutePath}")
pom.project {
groupId 'myPackageName'
artifactId 'wingoku-io'
version "0.0.6"
}
**configurations.all {
transitive = true
}**
}
更新:
我尝试了以下代码,因为@aar正在生成错误(在jcenter()上找不到xx.xx.xx.aar)。这仍然是失败的,d
compile ('com.github.nkzawa:socket.io-client:0.5.0'){
transitive=true
}
compile ('com.android.support:cardview-v7:21.+@aar'){
transitive=true
}
compile ('de.greenrobot:eventbus:2.4.0'){
transitive=true
}
Dalvik对所有类发出以下警告:
dalvikvm﹕ “Lio/wingoku/sdk/Fetch$6;”类的链接失败
它最终会抛出有关编辑的异常
configurations.all {
transitive = true
}
我不确定它是否有任何影响
我想你应该这样写:
dependencies {
compile 'com.github.nkzawa:socket.io-client:0.5.0'{
transitive=true
}
compile 'com.android.support:cardview-v7:21.+@aar'{
transitive=true
}
compile 'de.greenrobot:eventbus:2.4.0'{
transitive=true
}
}
它只是说
- cardview是本库中包含的aar
- eventbus和socket.io-client是要包含在aar中的jar库
compile'com.github.nkzawa:socket.io客户端:0.5。0@aar“
找不到