user3386826
user3386826

Reputation: 437

Can't Compile Any External Libraries in Android Studio Project

I'm trying to add the android-betterpickers library into my Android Studio project.

I'm getting this error every time:

FAILURE: Build failed with an exception. 

* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration           ':app:_debugCompile'.
   > Could not resolve com.code-troopers.betterpickers:library:2.5.2.
     Required by:
         MyApp:app:unspecified
      > Could not resolve com.code-troopers.betterpickers:library:2.5.2.
     > Could not get resource 'https://jcenter.bintray.com/com/code-troopers/betterpickers/library/2.5.2/library-2.5.2.pom'.
        > Failure initializing default system SSL context

I've tried the solutions stated here, here, and here.

None of these worked for me.

I'm using Ubuntu 15.04 and Android Studio -v 1.5.1, my gut tells me this isn't an issue for Windows or iOS users or it would have more attention.

Here is my app/build.gradle file:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.boyd.myapp"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile files('libs/library-1.0.19.jar')
    compile 'com.android.support:appcompat-v7:23.2.0'
    compile 'com.android.support:design:23.2.0'
    compile 'com.google.android.gms:play-services:8.4.0'
    compile 'com.google.android.gms:play-services-appindexing:8.4.0'
    compile 'com.code-troopers.betterpickers:library:2.5.2'
    compile 'com.android.support:support-v4:23.2.0'
}

Note: I had to use a jar file for the Volley library (the 'libs/library-1.0.19.jar' file) in the dependencies. That worked well. Unfortunately, android-betterpickers doesn't have a public aar file available. If I can't find a fix/workaround, I may just have to request an aar file from them.

Google Play Services library works well, but perhaps it's because the library is downloaded directly from android servers, I can't say for sure.

Anyone know of a solution?


UPDATE

I found the aar file!

Located here: https://jcenter.bintray.com/com/code-troopers/betterpickers/library/

for anyone that wants this particular library.

Gradle build successful after adding aar as library and using this solution.


UPDATE 4/11/16

I ended up having to reinstall Ubuntu on my desktop. I must have had a system issue of sorts.

Upvotes: 0

Views: 902

Answers (3)

Vladimir Petrakovich
Vladimir Petrakovich

Reputation: 4286

There is something wrong with SSL on your system.

Try to reinstall ca-certificates and ca-certificates-java packages via apt-get.

Upvotes: 1

Ashish Rawat
Ashish Rawat

Reputation: 5839

Add this in your build.gradle

repositories {
    mavenCentral()
}

explanation in artifact dependencies tutorial

Upvotes: 0

Oleksii
Oleksii

Reputation: 1

You may add in build.gradle:

android {
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_7
    targetCompatibility JavaVersion.VERSION_1_7
}

}

or in "Project structure"

Upvotes: 0

Related Questions