3

I am trying to upload an Android library (written in Java) on jitpack.io. This is the build.gradle file of the library.

plugins {
    id 'com.android.library'
    id 'maven-publish'
}

android {
    compileSdkVersion 33
    buildToolsVersion "30.0.3"

    defaultConfig {
        minSdkVersion 28
        targetSdkVersion 33
        versionCode 1
        versionName "1.0"

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

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {

    implementation 'androidx.appcompat:appcompat:1.6.1'
//    implementation 'com.google.android.material:material:1.9.0'
    implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.5'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}

publishing {
    publications {
        release(MavenPublication) {
            groupId = 'com.github.my_github_id'
            artifactId = 'my_library'
            version = '1.0'

            afterEvaluate {
                from components.release
            }
        }
    }
}

But the log in jitpack shows the following:

Gradle 'publishToMavenLocal' task not found. Please add the 'maven-publish' or 'maven' plugin.
 See the documentation and examples: https://docs.jitpack.io

Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dhttps.protocols=TLSv1.2
/home/jitpack/build/upi/build.gradle has component: release
Running: ./gradlew -Pgroup=com.github.my_github_id -Pversion=1.0 publishToMavenLocal
Build-tool 32.0.0 is missing DX at /opt/android-sdk-linux/build-tools/32.0.0/dx
Build-tool 32.0.0 is missing DX at /opt/android-sdk-linux/build-tools/32.0.0/dx
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dhttps.protocols=TLSv1.2

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':upi:compileReleaseAidl'.
> Installed Build Tools revision 32.0.0 is corrupted. Remove and install again using the SDK Manager.

* 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 862ms
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dhttps.protocols=TLSv1.2
Archive: my_android_project_name:my_library:unspecified
Publication: com.github.my_github_id:my_library:1.0
Publication: my_android_project_name:my_library:unspecified
Build tool exit code: 0
Looking for artifacts...
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dhttps.protocols=TLSv1.2
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dhttps.protocols=TLSv1.2
Looking for pom.xml in build directory and ~/.m2
Found artifact: com.github.my_github_id:my_library:1.0
Found artifact: my_android_project:my_library:unspecified
2023-08-23T18:28:11.758414916Z
Exit code: 0

ERROR: No build artifacts found
Expected artifacts in: $HOME/.m2/repository/my_android_project/my_library/unspecified

jitpack.yml:

jdk:
  - openjdk8

I am using the latest version of gradle and Android Studio. I have tried looking into different solutions, but none of them works. Maybe I am missing a point, as this is the first time I am publishing a library.

George
  • 255
  • 8

0 Answers0