gpt4 book ai didi

android - 将 Android 库发布到 bintray maven 会产生 2 个独立的 Artifact

转载 作者:行者123 更新时间:2023-11-30 00:17:26 25 4
gpt4 key购买 nike

我正在尝试使用 bintray 发布我的 android 库,但我最终在 bintray maven stringx 和 stringx-android-sdk 中得到了两个单独的 Artifact : https://dl.bintray.com/klimaszewski/stringx/io/stringx/资源和所有东西都放在这里: https://dl.bintray.com/klimaszewski/stringx/io/stringx/stringx/1.0.2/

并且 POM 文件被放置在正确的 Artifact 中: https://dl.bintray.com/klimaszewski/stringx/io/stringx/stringx-android-sdk/1.0.2/

我的 bintray 存储库是:stringx 和库名称:stringx-android-sdk

因为该库无法在我的项目中解决。这里出了什么问题?构建.gradle

buildscript {
repositories {
jcenter()
mavenCentral()
}

dependencies {
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
}
}
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'

ext {
bintrayRepo = 'stringx'
bintrayName = 'stringx-android-sdk'

publishedGroupId = 'io.stringx'
libraryName = 'StringX-SDK'
artifact = 'stringx-android-sdk'

libraryDescription = 'Automatic app Translation for Android'

siteUrl = 'https://www.stringx.io'
gitUrl = 'https://github.com/SzyQ/stringx-android-sdk'

developerId = 'klimaszewski'
developerName = 'Szymon Klimaszewski'
developerEmail = 'klimaszewski.szymon@gmail.com'

licenseName = 'The Apache Software License, Version 2.0'
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
allLicenses = ["Apache-2.0"]
versionMajor = 1
versionMinor = 0
versionHotFix = 2

libraryVersion = buildVersionName()
}

android {
compileSdkVersion 27
buildToolsVersion "26.0.2"
defaultConfig {
minSdkVersion 16
targetSdkVersion 27
versionCode buildVersionCode()
versionName buildVersionName()
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:support-annotations:27.0.0'
}

def buildVersionName() {
String versionName
if (versionHotFix == null || versionHotFix == 0) {
versionName = versionMajor + "." + versionMinor
} else {
versionName = versionMajor + "." + versionMinor + "." + versionHotFix
}
println "Version name: " + versionName
return versionName
}

def buildVersionCode() {
Integer versionCode
if (versionHotFix == null || versionHotFix == 0) {
versionCode = versionMajor * 10000 + versionMinor * 100
} else {
versionCode = versionMajor * 10000 + versionMinor * 100 + versionHotFix
}
println "Version code: " + versionCode
return versionCode
}

apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle'
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle'

最佳答案

Android 模块名称必须匹配 bintray 包,在我的例子中是“stringx-android-sdk”。

所以我不得不在 settings.gradle 中更改模块

include ':stringx-android-sdk'
project(":stringx-android-sdk").projectDir = file("../../stringx")

关于android - 将 Android 库发布到 bintray maven 会产生 2 个独立的 Artifact ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47002675/

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