Skip to content

[Moved to MavenCentral] An Android library that takes the standard toast to the next level with many styling options. Works on all Android versions.

Notifications You must be signed in to change notification settings

sharetripnet/StyleableToast

 
 

Repository files navigation

Setup OSS Library to Jitpack io

  1. in the library module's build.gradle.kts, add id("maven-publish")
plugins {
    id("maven-publish")
    alias(libs.plugins.android.library)
    alias(libs.plugins.kotlin.android)
    // other plugins....
}
  1. Add this block to library module's build.gradle.kts:
publishing {
    publications {
        create<MavenPublication>("release") {
            afterEvaluate { // Ensures the Android component is properly evaluated
                from(components["release"])
            }
            groupId = "io.github.muddz" // Replace with your group ID
            artifactId = "styleabletoast"          // Replace with your artifact ID
            version = "v0.0.6"                 // Replace with your version
        }
    }
}

So your end file should look like this:

plugins {
    id("maven-publish")     // <--------------- add this
    alias(libs.plugins.android.library)
    alias(libs.plugins.kotlin.android)
}

android {
    namespace = "io.github.muddz.styleabletoast"
    compileSdk = 35

    defaultConfig {
        minSdk = 21

        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
        consumerProguardFiles("consumer-rules.pro")
    }

    buildTypes {
        release {
            isMinifyEnabled = false
            proguardFiles(
                getDefaultProguardFile("proguard-android-optimize.txt"),
                "proguard-rules.pro"
            )
        }
    }
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_11
        targetCompatibility = JavaVersion.VERSION_11
    }
    kotlinOptions {
        jvmTarget = "11"
    }
}

// <--------------- add this
publishing {
    publications {
        create<MavenPublication>("release") {
            afterEvaluate { // Ensures the Android component is properly evaluated
                from(components["release"])
            }
            groupId = "io.github.muddz" // Replace with your group ID
            artifactId = "styleabletoast"          // Replace with your artifact ID
            version = "v0.0.6"                 // Replace with your version
        }
    }
}

dependencies {
    // ... ... 
}
  1. create a jitpack.yml file in project root. Add this to the file:
jdk:
  - openjdk17
before_install:
  - sdk install java 17.0.1-open
  - sdk use java 17.0.1-open
  1. Run this command in terminal: ./gradlew publishToMavenLocal

This command should run successfully, and you should get the generated files in ~/.m2/repository/ directory.

Finally, git commit, and git tag. Now go to jitpack io, and you should see your library.

About

[Moved to MavenCentral] An Android library that takes the standard toast to the next level with many styling options. Works on all Android versions.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 66.5%
  • Kotlin 33.5%