Unable to publish Android library project on JitPack
Asked Answered
U

1

7

I made a small library for Android which I uploaded on my public Github repositroy. The library project contains also a sample app. To enable building on JitPack I followed JitPack's own instructions.

Now that i try build it remotely with JitPack i get following error:

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

Adding maven plugin
Found android library build file in Library
Running: gradle clean -Pgroup=  -Pversion=v1.2 install
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Djavax.xml.accessExternalSchema=all
Gradle version Gradle 3.1

FAILURE: Build failed with an exception.

* What went wrong:
Task 'clean' not found in root project 'build'.

* Try:
Run gradle tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 0.532 secs
EXIT_CODE=1
2017-03-22T19:01:33.352614259Z
Exit code: 1
No build artifacts found

Here is the root build file:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

Build file for the library:

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

group=

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 25
    }

}

Build file for the sample app:

apply plugin: 'com.android.application'

buildscript {
    repositories {
        jcenter()
        maven { url "https://jitpack.io" }
    }

}

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"

    defaultConfig {
        applicationId 
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"


    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])

    compile 'com.android.support:appcompat-v7:25.2.0'

    compile project(':Library')

}
Unbowed answered 22/3, 2017 at 19:29 Comment(0)
F
5

The project is missing a settings.gradle file where you include the library:

include ':Library'

Would also recommend adding the gradle wrapper so that JitPack builds with the correct Gradle version.

Example project: https://github.com/jitpack/android-example

Francis answered 22/3, 2017 at 20:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.