在链接到 Jcenter 之前,如何对我上传到 Bintray 的模块进行模块处理?

how can I module I uploaded on Bintray before linked to Jcenter?

你好,我为 androidthings 制作了 mpu6050 的驱动程序(?)并上传到 bintray https://dl.bintray.com/mechasolution/androidthings/

似乎上传得很好,因为我成功下载并重新使用了 *.aar 库。

我听说链接到 Jcenter 需要大约一天的时间,所以在链接之前我需要额外的代码来测试。

在项目的build.gradle

buildscript {
    repositories {
        mavenCentral()
        jcenter()
        maven { url "https://dl.bintray.com/mechasolution/AndroidThings/" }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'
        classpath 'com.novoda:bintray-release:0.3.4'
    }
}

在应用程序中 build.gradle

dependencies {
    ...
    compile 'org.mechasolution:mpu6050:0.1@aar'
}

下面是模块的build.gradle

apply plugin: 'com.android.library'
apply plugin: 'com.novoda.bintray-release'

publish {
    repoName  = 'AndroidThings'
    userOrg = 'mechasolution'
    groupId = 'org.mechasolution'
    artifactId = 'mpu6050'
    publishVersion = '0.1'
    desc = 'mpu6050 driver for AndroidThings provided by mechasolution'
    website = 'https://github.com/mechasolution/mpu6050test'
    issueTracker = "https://github.com/mechasolution/mpu6050test/issues"
    repository = "https://github.com/mechasolution/mpu6050test.git"
}

这似乎是正确的代码,但 android studio keep 给出了错误

错误:(31, 13) 解析失败:org.mechasolution:mpu6050:0.1

有谁知道我错过了什么或哪里出错了?

你应该将你的 repo 放在根 build.gradleallprojects 下(而不是 buildscript):

allprojects {
    repositories {
        jcenter()
        maven { url "https://dl.bintray.com/mechasolution/AndroidThings/" }
    }
}

来自 Android Studio guide :

The allprojects block is where you configure the repositories and dependencies used by all modules in your project, such as third-party plugins or libraries. Dependencies that are not required by all the modules in the project should be configured in module-level build.gradle files