如何在android studio

时间:2017-10-19 10:03:09

标签: android android-studio jar

我想在Android studio中创建一个导出的jar文件, 但是这里的问题,当我导入到其他项目时,gson,rxjava和retrofit的依赖关系不包括在jar文件中

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha8'


    // API CONNECTION
    compile 'com.squareup.retrofit2:retrofit:2.1.0'
    compile 'com.squareup.retrofit2:converter-gson:2.0.2'
    compile 'com.google.code.gson:gson:2.6.1'
    compile 'com.squareup.okhttp3:logging-interceptor:3.3.1'
    compile 'com.squareup.okhttp3:okhttp:3.3.1'
    compile 'com.squareup.okhttp3:okhttp-urlconnection:3.3.1'
    compile 'io.reactivex.rxjava2:rxjava:2.0.2'
    compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
    compile 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'junit:junit:4.12'
}
task deleteJar(type: Delete) {
    delete 'libs/logmanagementlib.jar'
}

task createJar(type: Copy) {
    from('build/intermediates/bundles/release/')
    into('libs/jars/')
    include('classes.jar')

    rename('classes.jar', 'logmanagementlib.jar')

}

createJar.dependsOn(deleteJar, build)

你能举个例子来说明如何包含编译'com.google.code.gson:gson:2.6.1?

0 个答案:

没有答案
相关问题