Jaewon.A.C Jaewon.A.C - 3 years ago 161
Android Question

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

Hello I made a driver(?) of mpu6050 for androidthings and uploaded on bintray

It seems like uploaded well cuz I successfully downloaded and reused *.aar library.

I've heard it'll take about a day to be linked to Jcenter, so I need additional code to test before it's linked.

In project's build.gradle

buildscript {
repositories {
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'

In app's build.gradle

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

below are module's 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"

It seem's like correct code but android studio keep gives error

Error:(31, 13) Failed to resolve: org.mechasolution:mpu6050:0.1

does anyone knows what I missed or went wrong?

Answer Source

You should place your repo under allprojects in your root build.gradle (not buildscript) :

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

From 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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download