1

I'm trying to use this Java library in my Android app. From the documentation, I have to put compile "json-to-pdf:json-to-pdf:0.7.5" in my build.grade dependencies. When I try to sync the project, I get an error:

Error:(39, 13) Failed to resolve: json-to-pdf:json-to-pdf:0.7.5

I asked the owner, but he does not know how to fix it. I think I have to add the following Maven dependencies in build.grade too:

<repositories>
  <repository>
    <id>clojars.org</id>
    <url>http://clojars.org/repo</url>
  </repository>
</repositories>

But I dont't know how to do that.

Here is my settings so far:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"
    compileOptions.encoding = 'ISO-8859-1'

    defaultConfig {
        applicationId "br.com.app"
        minSdkVersion 14
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

repositories {
    jcenter()
    //mavenCentral() I tried that but doesn't work
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.2.1'
    ...
    compile 'json-to-pdf:json-to-pdf:0.7.5' // Doesn't work
}

1 Answer 1

1

You have to define the clojars Maven repository in your build.gradle.

repositories {
    jcenter()
    maven {
        url 'http://clojars.org/repo'
    }
}

The author of this library should probably add this to the GitHub readme.

Update: I responded to the GitHub issue with the appropriate Gradle snippet that should be added to the docs.

Sign up to request clarification or add additional context in comments.

4 Comments

Thank you Mark. I already tried that but I'm getting this error: "Error:Failed to notify project evaluation listener."
That sounds like a completely unrelated problem. I'd try running your build from the command line to see if you get a better error.
Thanks Mark. I don't know if it's an unrelated error, because if I comment the "compile" line, the sync works properly
Your error can be fixed by changing to. 0.7.7 but you will run into an issue where the apk will fail to build. The library has a dependency on an old Java library whose class file format seems to not be supported. Quick fix is compile the project your self but Am stuck as I don't know how to compile cloja based Projects

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.