无法在Android gradle上通知项目评估监听器

我正在尝试通过gradle将库添加到我的项目中.我收到一个错误:

Error:Failed to notify project evaluation listener.

这是我的build.gradle文件:

apply plugin: 'com.android.application'

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

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

repositories {
    jcenter()

    // The library owner indicates me to add the following lines
    maven {
        url 'http://clojars.org/repo'
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.2.1'
    compile 'com.android.support:design:22.2.1'
    compile 'com.jakewharton:butterknife:7.0.1'
    compile 'com.loopj.android:android-async-http:1.4.8'
    compile 'com.github.machinarius:preferencefragment:0.1.1'
    compile 'com.pavelsikun:material-seekbar-preference:0.8+'
    compile 'com.android.support:cardview-v7:22.0.+'
    compile 'com.android.support:recyclerview-v7:22.0.+'
    compile 'com.getbase:floatingactionbutton:1.9.0'
    compile files('libs/itextpdf-5.5.6.jar')
    compile 'json-to-pdf:json-to-pdf:0.7.5' // Here is the library that's causing an error
}

该项目不同步.我不知道如何解决这个问题.

编辑:这是我的顶级构建gradle:

// Top-level build file where you can add configuration options common to 

all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.2.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}
最佳答案
用以下文件替换文件:

    apply plugin: 'com.android.application'

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

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

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.2.1'
    compile 'com.android.support:design:22.2.1'
    compile 'com.jakewharton:butterknife:7.0.1'
    compile 'com.loopj.android:android-async-http:1.4.8'
    compile 'com.github.machinarius:preferencefragment:0.1.1'
    compile 'com.pavelsikun:material-seekbar-preference:0.8+'
    compile 'com.android.support:cardview-v7:22.0.+'
    compile 'com.android.support:recyclerview-v7:22.0.+'
    compile 'com.getbase:floatingactionbutton:1.9.0'
    compile files('libs/itextpdf-5.5.6.jar')
    compile 'json-to-pdf:json-to-pdf:0.7.5' // Here is the library that's causing an error
}

buildscript {
    repositories {
        jcenter()
        maven {url 'http://clojars.org/repo'}
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.2.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

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

转载注明原文:无法在Android gradle上通知项目评估监听器 - 代码日志