0

I'm working on an Android library that allows communication with a Bluetooth device. The library itself has two important dependencies.

The goal is to make an .aar available of the library for others to include in their apps, with a sample app being available for reference.

I'm currently working on the sample app, and I've successfully imported the library into the app, but the library's dependencies are not being included so I'm receiving errors such as java.lang.NoClassDefFoundError: Failed resolution of: ...

It was my understanding that the library's gradle file would be used when compiling the library, but this does not seem to be the case?

My library's gradle file is as follows:

apply plugin: 'com.android.library'
apply plugin: 'me.tatarka.retrolambda'

buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath 'me.tatarka:gradle-retrolambda:3.6.0'
    }
}

repositories {
    mavenLocal()
}

android {
    compileSdkVersion 25
    buildToolsVersion '25.0.3'

    defaultConfig {
        minSdkVersion 19
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    publishNonDefault true
}

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:support-annotations:25.3.1'
    compile 'com.polidea.rxandroidble:rxandroidble:1.3.2'
    compile 'com.github.zafarkhaja:java-semver:0.9.0'
    testCompile 'junit:junit:4.12'
}

Any ideas?

lorenzo
  • 494
  • 6
  • 23

0 Answers0