Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Maven 捆绑.aar文件中的所有依赖项_Maven_Android Studio_Gradle_Artifacts - Fatal编程技术网

Maven 捆绑.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

我有一个SDK项目,它引用了gradle中的许多依赖项。我必须要求SDK用户在项目中使用SDK时添加这些依赖项。问题是,每次我添加一些新的依赖项或用新的依赖项替换当前的依赖项时,我也必须要求用户进行更改,我认为这不是一个好的做法。是否有一种方法可以捆绑.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"
        }
    }
这些是我的依赖项:

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库

您可以发布您的依赖项部分吗?@ben75请查看更新的问题。仔细查看日志,查看另一条关于同一库的多个版本的警告。(可能支持lib?)不,我找不到关于同一lib的多个版本的任何警告。我也使用了依赖模块。仍然抛出ClassDefNotFoundError。您是如何解决它的?您能解释一下这将做什么吗?它给出了错误:Gradle DSL method
compile'com.github.nkzawa:socket.io客户端:0.5。0@aar“
找不到