我试图通过gradle将库添加到我的项目中。我收到了错误:
错误:无法通知项目评估监听器。
这是我的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()
}
}
答案 0 :(得分:0)
用以下文件替换文件:
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'}
}
}