作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在使用 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/
我是一名优秀的程序员,十分优秀!