我試圖按照建議的方法將此library包含到我當前的項目中here 這導致打破了我的項目和I我在圖書館 這裏的build.gradlle文件收到以下錯誤是該項目的的build.gradle(更新):gradle.build錯誤(28,0):未找到Gradle DSL方法:'apply()'
// 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
}
}
subprojects {
ext.global_compileSdkVersion = 22
ext.global_buildToolsVersion = "23.0.0 rc2"
}
的build.gradle的應用模塊:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
apply plugin: 'com.android.application'
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
}
}
android {
compileSdkVersion 22
buildToolsVersion "23.0.0 rc2"
}
subprojects {
ext.global_compileSdkVersion = 22
ext.global_buildToolsVersion = "23.0.0 rc2"
}
和我想添加庫中的build.gradle:
/*
* Copyright (C) 2015 Haruki Hasegawa
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
apply plugin: 'com.android.library'
ext {
// required for 'android-maven-publish.gradle'
mavenPublishDestDir = new File(rootDir, "repository").absolutePath
mavenPublishDataFile = file('./library-data.properties').absolutePath
mavenPublishSigningSetting = file('../signing/library-maven-publish-signing.properties').absolutePath
}
// Common configurations
android {
defaultConfig {
minSdkVersion 9
targetSdkVersion 22
def dataProps = new Properties()
dataProps.load(project.file(project.mavenPublishDataFile).newDataInputStream())
versionCode dataProps.VERSION_CODE.toInteger()
versionName dataProps.VERSION_NAME
}
buildTypes {
release {
minifyEnabled false
shrinkResources false
consumerProguardFiles 'proguard-rules.pro'
}
debug {
minifyEnabled false
shrinkResources false
consumerProguardFiles 'proguard-rules.pro'
}
}
} apply plugin: 'java'
dependencies {
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:recyclerview-v7:22.2.1'
}
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:deprecation" << "-Xlint:unchecked"
}
和settings.gradle
include ':app', ':advancedRecyclerView'
它是什麼,我做錯了什麼?
好吧,我加了他們試圖解決這個錯誤。我現在刪除它們,但我仍然得到相同的錯誤 –
@A_Matar檢查更新的答案。一定要使用gradle版本2.4+。 –
你是如何得到這一行的:com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:0.7.4我希望能夠在將來爲我自己的任何庫格式化它 –