enefce / androidlibraryforgithubpackagesdemo Goto Github PK
View Code? Open in Web Editor NEWSample project showcasing the steps to publish and consume Android Libraries on the GitHub Packages Registry
License: Apache License 2.0
Sample project showcasing the steps to publish and consume Android Libraries on the GitHub Packages Registry
License: Apache License 2.0
First of all this is a great tutorial thanks for that.
I followed every step and succesfully published my package and i can see it on my repo and package but unfortunatelly when i try to use my package it's failing to resolve package.Also instead of build.gradle i am using settings.gradle file to add repositories.
Failed to resolve: com.trive.libraries.kycsdk:1.0.2
any thoughts ?
I have been following this Medium doc: Publishing Android libraries to GitHub Packages
This is build.gradle file:
import java.util.Properties
plugins {
id("com.android.library")
id("org.jetbrains.kotlin.android")
id("maven-publish")
}
val getVersionName = "1.0.0"
val getArtifactId = "dynamic-map"
val githubProperties = Properties()
githubProperties.load(
rootProject.file("github.properties").inputStream()
) // Load GitHub credentials from github.properties file
android {
...
}
dependencies {
...
}
afterEvaluate {
val gitUsername = githubProperties.getProperty("gpr.usr")
val gitPassword = githubProperties.getProperty("gpr.key")
println("GitHub Username: $gitUsername")
println("GitHub Token: $gitPassword")
publishing {
publications {
create<MavenPublication>("release") {
from(components["release"])
groupId = "com.gaurav.kumar"
artifactId = getArtifactId
version = getVersionName
artifact("$buildDir/outputs/aar/${getArtifactId}-release.aar")
}
}
repositories {
maven {
name = "DynamicMapRepo"
url = uri("https://maven.pkg.github.com/Cypher103360/DynamicMap")
credentials {
username = gitUsername
password = gitPassword
}
}
}
}
}
When I try to publish the library I get this:
gaurav@gaurav-ThinkPad-E15-Gen-4:~/AndroidStudioProjects/DynamicMap$ ./gradlew publish
> Configure project :dynamic-map
GitHub Username: Cypher103360
GitHub Token: *****
> Task :dynamic-map:publishReleasePublicationToDynamicMapRepoRepository FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':dynamic-map:publishReleasePublicationToDynamicMapRepoRepository'.
> Failed to publish publication 'release' to repository 'DynamicMapRepo'
> Invalid publication 'release': multiple artifacts with the identical extension and classifier ('aar', 'null').
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
BUILD FAILED in 1s
25 actionable tasks: 21 executed, 4 up-to-date
@prasad79 @up9cloud @fossabot
Please help me to address this issue.
I have project A which is used as a package.
Project B uses A as a dependency. B is used as a dependency in project C.
What will be the structure of project B?
Hi, thanks for your article, it was very enlightening!
Yet, I bumped into something. This is the repo: https://github.com/cesarferreira/android-unique-device-id
I'm trying to upload the github package, I followed your guide and it looks like i'm doing everything right but i keep getting this error:
~/code/github/android-unique-device-id master
❯ ./gradlew assembleRelease publish
> Task :android-unique-device-id:publishBarPublicationToGitHubPackagesRepository FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':android-unique-device-id:publishBarPublicationToGitHubPackagesRepository'.
> Failed to publish publication 'bar' to repository 'GitHubPackages'
> Could not PUT 'https://maven.pkg.github.com/cesarferreira/android-unique-device-id/cesarferreira/android-unique-device-id/0.0.1/android-unique-device-id-0.0.1.aar'. Received status code 403 from server: Forbidden
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 4s
59 actionable tasks: 3 executed, 56 up-to-date
my build gradle: https://github.com/cesarferreira/android-unique-device-id/blob/master/android-unique-device-id/build.gradle
def getArtifactId = { ->
return "android-unique-device-id"
}
publishing {
publications {
bar(MavenPublication) {
groupId 'cesarferreira'
version "0.0.1"
artifactId getArtifactId()
artifact("$buildDir/outputs/aar/${getArtifactId()}-release.aar")
}
}
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/cesarferreira/android-unique-device-id")
credentials {
username = System.getenv("GITHUB_USER")
password = System.getenv("GITHUB_TOKEN")
}
}
}
I even made a token with ALL permissions to see if those basic permissions weren't enough.
I made sure that the environment variables are there.
Does anything stand out to you that I'm missing?
Thanks in advance!
Hello, thanks for your step, it is clear.
But I met some problems, one is the command failed, I used "gradle publish", but it failed, error message showed "Received status code 409 from server: Conflict". Actually it upload success to GitHub Packages, I am stranged it seemed to upload twice.
Another problem is why the package contains some files which suffix are "*.sha1" and ".md5"?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.