Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to publish Android library project on JitPack

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')

}
like image 325
user1888162 Avatar asked Mar 22 '17 19:03

user1888162


People also ask

How do I publish a library to JitPack?

In order to publish your Android library on JitPack you just need a working build file in your Git repository. Android SDK is available in the build environment and ANDROID_HOME variable is already set when the build starts. Builds are run with Java 8 by default but can be configured using a jitpack.


1 Answers

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

like image 108
Andrejs Avatar answered Sep 23 '22 14:09

Andrejs