习惯使用ANT在Netbeans中配置Android项目,我是Android Studio和Gradle的新手。
(在Netbeans和Android Studio中)我对Gradle依赖项与Android support-v4库的最新版本进行了一些努力。只要版本设置在23.0.0以下,即22 21等,一切都很好,但是当使用support-v4:23.x.x时,事情就会出错。
为了研究这个问题,我制作了一个仅由一个FragmentActivity组成的极简主义项目。指定v4 23,它找不到Activity或FragmentActivity的任何核心方法,例如getWindow()
我已经尝试了mavenCentral()和mavenLocal()。
感谢您的帮助。
编辑:下面添加了build.gradle内容。
import org.gradle.api.artifacts.*
apply plugin: 'base' // To add "clean" task to the root project.
subprojects {
apply from: rootProject.file('common.gradle')
}
task mergedJavadoc(type: Javadoc, description: 'Creates Javadoc from all the projects.') {
title = 'All modules'
destinationDir = new File(project.buildDir, 'merged-javadoc')
// Note: The closures below are executed lazily.
source {
subprojects*.sourceSets*.main*.allSource
}
}
buildscript {
repositories {
jcenter()
}
//Make sure that gradle is updated to this version
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0'
}
}
repositories {
mavenLocal()
mavenCentral() //se viktig kommentar 030416
flatDir {dirs 'libs'}
}
apply plugin: 'com.android.application'
ext {
supportLibVersion = '23.2.1'
//versionName = '2.8.0'
}
android {
compileSdkVersion 23
buildToolsVersion = '23.0.3' //"21.1.2"
//publishNonDefault true
defaultConfig {
//minSdkVersion 15 //Spotify requires min14, Facebook min15
//targetSdkVersion 23
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
res.srcDirs = ['res']
}
}
buildTypes {
debug {
applicationVariants.all { variant ->
variant.outputs.each { output ->
output.outputFile = new File(output.outputFile.parent, output.outputFile.name.
replace(".aar", "-${versionName}.aar"))
}
}
}
}
}
dependencies {
//support
compile ('com.android.support:support-v4:23.2.1')
compile 'com.google.android.gms:play-services-appindexing:8.1.0'
}