1

I have made an android library and uploaded to Github. (https://github.com/Shekhar23/TxtLogSdk)

Now I want to add to jitpack.io. But I get an error!

How can I upload to jitpack.io?

Build log : https://jitpack.io/com/github/Shekhar23/TxtLogSdk/2.1/build.log

A problem occurred evaluating project ':app'.

Failed to apply plugin [id 'com.android.internal.version-check'] Minimum supported Gradle version is 6.1.1. Current version is 4.8.1. If using the gradle wrapper, try editing the distributionUrl in /home/jitpack/build/gradle/wrapper/gradle-wrapper.properties to gradle-6.1.1-all.zip

shekhar pande
  • 1,172
  • 1
  • 11
  • 21

2 Answers2

1

Initially I also had this error with Gradle 4.8.1, which was for sure confusing:

Found gradle
Gradle build script
WARNING: gradle/wrapper/gradle-wrapper.jar does not exist! Needs to be committed.
ERROR: Gradle wrapper not found. Please add. Using default gradle to build.
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dhttps.protocols=TLSv1.2
Welcome to Gradle 4.8.1!

See build.log for details.

What I actually missed, is including ./gradlew and ./gradle/wrapper/gradle-wrapper.jar into the git repository. Yes! You should upload these files to github!

After that you can use the latest gradle version, which is awesome! Here is the build log:

Found gradle
Gradle build script
Found gradle version: 6.5.
Using gradle wrapper
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dhttps.protocols=TLSv1.2
Downloading https://services.gradle.org/distributions/gradle-6.5-all.zip
... 
------------------------------------------------------------
Gradle 6.5

See build.log for details.

P.S. Plugin com.github.dcendents.android-maven should be included to two build.gradle-files as described in the manual.

mspnr
  • 416
  • 4
  • 12
0

Did you update your Gradle files?

You should have something similar like the config below:

settings.gradle

include ':app', ':NAME_OF_LIBRARY'
rootProject.name = "NAME_OF_LIBRARY"

build.gradle (module)
Add the plugin, group and version

apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
group = 'com.github.YOURGITHUBNAME'
version = rootProject.ext.versionName
...

build.gradle (project)
Add the github classpath to your dependencies

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.0.0'
        classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        ...
    }
}

ext {
    compileSdkVersion = 29
    buildToolsVersion = '29.0.2'
    versionName = '1.0.0'
    ...
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
SvdTweel
  • 172
  • 1
  • 2
  • 11