gpt4 book ai didi

android - Gradle 2.1 错误 Cannot convert the provided notation to a File or URI [src/main/java, src]

转载 作者:行者123 更新时间:2023-11-29 00:16:08 29 4
gpt4 key购买 nike

我在使用 maven 编译我的项目时遇到问题,我收到此错误:

* What went wrong:
Cannot convert the provided notation to a File or URI: [src/main/java, src].
The following types/formats are supported:
- A String or CharSequence path, e.g 'src/main/java' or '/usr/include'
- A String or CharSequence URI, e.g 'file:/usr/include'
- A File instance.
- A URI or URL instance.

我的 build.gradle 与我过去使用的一样,看起来:

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.14.0'
}
}
apply plugin: 'com.android.library'
apply plugin: 'maven'
android {
compileSdkVersion 19
buildToolsVersion = "21.1.0"
defaultConfig {
minSdkVersion 9
targetSdkVersion 19
versionName VERSION_NAME
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs 'src'
res.srcDirs 'res'
}

// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')

// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
buildToolsVersion '21.1.0'
}
apply from: "../gradle-local-mvn-push.gradle"
dependencies {
}

当我尝试构建 AAR 库并将其上传到 Maven 时会发生这种情况

../gradlew uploadArchives

最佳答案

你有你的 gradle-local-mvn-push.gradle 脚本的代码吗?我有同样的问题,它来 self 的 Maven 脚本。

我通过替换解决了这个问题:

task sourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java
}

task sourcesJar(type: Jar) {
classifier = 'sources'
from 'src/main/java'
}

关于android - Gradle 2.1 错误 Cannot convert the provided notation to a File or URI [src/main/java, src],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26787490/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com