gpt4 book ai didi

android - 如何将android库发布到Jfrog bintray?

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:14:21 30 4
gpt4 key购买 nike

我正在从事 Android 库开发,我已经完成了我的库工作并生成了 aar 和 jar 文件,但是当我尝试发布到二进制文件时,我收到一条错误消息。

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':mylittlelibrary:bintrayUpload'.
> Could not create package 'abcd/maven/helloaar.example.com.mylittlelibrary': HTTP/1.1 404 Not Found [message:Repo 'maven' was not found]

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 5.391 secs
Could not create package 'abcd/maven/helloaar.example.com.mylittlelibrary': HTTP/1.1 404 Not Found [message:Repo 'maven' was not found]
2:41:59 AM: External task execution finished 'bintrayUpload'.

构建.gradle

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

repositories {
mavenCentral()
}

android {
compileSdkVersion 24
buildToolsVersion "24.0.0"

defaultConfig {
minSdkVersion 17
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.0.0-beta1'
}

group = 'helloaar.example.com.mylittlelibrary'
version = '1.0.2'

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

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

task generateJavaDocsJar(type: Jar) {
from generateJavaDocs.destinationDir
classifier 'javadoc'
}
generateJavaDocsJar.dependsOn generateJavaDocs

bintray {
user = 'abcd'
key = '1234567890fghgfhffjfgjfjfjrtyjtkjg'
pkg {
repo = 'maven'
name = 'helloaar.example.com.mylittlelibrary'

version {
name = '1.0.2'
desc = 'My test upload'
released = new Date()
vcsTag = '1.0.2'
}

licenses = ['Apache-2.0']
vcsUrl = ''
websiteUrl = ''
}
configurations = ['archives']
}

artifacts {
archives generateJavaDocsJar
archives generateSourcesJar
}

enter image description here

请仔细阅读我的脚本并建议我一些解决方案。

最佳答案

在发布到 Bintray 之前,您必须拥有稳定的代码构建。Bintray 上的层次结构如下:用户 --> Repo --> package --> version --> artifact意味着 Repo 应该在该层次结构的包之上。

gradle.build 中的以下几行可能是导致错误的主要原因:

pkg {
repo = 'maven'
name = 'helloaar.example.com.mylittlelibrary'
}

层次结构错误。

在使用maven时你应该检查你是否遵守maven约定,否则Maven Build不会成功。 Explanation for Maven Repositories on Bintray.

你遇到的错误:

HTTP/1.1 404 Not Found [message:Repo 'maven' was not found] 

意思是你没有一个Repository on Bintray调用maven。所有包版本和文件都应该在您创建的 Bintray 存储库下。

有关更多详细信息或支持问题,您可以使用 Bintray support该团队面向所有 Bintray 用户开放,可以帮助您解决与 Bintray、Artifactory、Mission control 和 Xray 等任何 JFrog 平台服务相关的任何问题。

关于android - 如何将android库发布到Jfrog bintray?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39400451/

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