无法在bintrayUpload中规范化路径

时间:2015-11-18 07:05:38

标签: android build.gradle gradlew

我在运行gradlew install时遇到以下错误。

  

无法捕获任务' javadoc'的输入文件的快照。在最新的检查。有关详细信息,请参阅stacktrace。

     

无法规范化文件路径' C:\ android \ sdk \ platforms \ android-23 \ android.jar; C:\ android \ sdk \ platforms \ android-23 \ optional \ org.apache.http .legacy.jar'

项目的build.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.3.0'
    classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
    classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
}
allprojects {
repositories {
    jcenter()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

库模块的build.gradle:

apply plugin: 'com.android.library'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'com.github.dcendents.android-maven'


ext {
bintrayRepo = 'maven'
bintrayName = 'befrest'

publishedGroupId = 'com.oddrun.libraries'
libraryName = 'Befrest'
artifact = 'befrest'

libraryDescription = 'Simple Push Notification Library For Android'

siteUrl = 'https://github.com/hojjat-imani/PushNotif'
gitUrl = 'https://github.com/hojjat-imani/PushNotif.git'

libraryVersion = '0.0.1'

developerId = 'hojjat-imani'
developerName = 'Hojjat Imani'
developerEmail = 'imani.hojjat95@gmail.com'

licenseName = 'The Apache Software License, Version 2.0'
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
allLicenses = ["Apache-2.0"]
}

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
useLibrary  'org.apache.http.legacy'

defaultConfig {
    minSdkVersion 10
    targetSdkVersion 23
    versionCode 0
    versionName "0.0.1"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
}




version = libraryVersion

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

task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives javadocJar
archives sourcesJar
}

// Bintray
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())

bintray {
user = properties.getProperty("bintray.user")
key = properties.getProperty("bintray.apikey")

configurations = ['archives']
pkg {
    repo = bintrayRepo
    name = bintrayName
    desc = libraryDescription
    websiteUrl = siteUrl
    vcsUrl = gitUrl
    licenses = allLicenses
    publish = true
    publicDownloadNumbers = true
    version {
        desc = libraryDescription
        gpg {
            sign = true //Determines whether to GPG sign the files. The default is false
            passphrase = properties.getProperty("bintray.gpg.password")
            //Optional. The passphrase for GPG signing'
        }
    }
}
}



group = publishedGroupId                               // Maven Group ID for the artifact

install {
repositories.mavenInstaller {
    // This generates POM.xml with proper parameters
    pom {
        project {
            packaging 'aar'
            groupId publishedGroupId
            artifactId artifact

            // Add your description here
            name libraryName
            description libraryDescription
            url siteUrl

            // Set your license
            licenses {
                license {
                    name licenseName
                    url licenseUrl
                }
            }
            developers {
                developer {
                    id developerId
                    name developerName
                    email developerEmail
                }
            }
            scm {
                connection gitUrl
                developerConnection gitUrl
                url siteUrl

            }
        }
    }
}
}

2 个答案:

答案 0 :(得分:5)

您可以在libs文件夹中添加org.apache.http.legacy.jar。 你可以在Android/Sdk/platforms/android-23/optional

中找到这个jar

我还将此行添加到我的app.gradle文件

compile files('libs/org.apache.http.legacy.jar')

但是如果你使用更多的库,你可以使用这种方式

compile fileTree(dir: 'libs', include: ['*.jar'])

这解决了因谷歌删除了对Apache HTTP客户端的支持而导致的所有错误。请勿将compileSdkVersion 23更改为22,我认为此解决方案更好。

答案 1 :(得分:0)

android 23中的apache http似乎有问题。 只需将compileSdkVersion 23更改为22并删除useLibrary 'org.apache.http.legacy'即可解决问题。