7

我为 Android 制作了一个小型库,并将其上传到我的公共 Github 存储库中。库项目还包含一个示例应用程序。为了在 JitPack 上进行构建,我按照JitPack 自己的说明进行操作。

现在我尝试使用 JitPack 远程构建它,我收到以下错误:

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

这是根构建文件:

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()
    }
}

库的构建文件:

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
    }

}

示例应用程序的构建文件:

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

}
4

1 回答 1

5

该项目缺少settings.gradle包含库的文件:

include ':Library'

还建议添加 gradle 包装器,以便 JitPack 使用正确的 Gradle 版本构建。

示例项目:https ://github.com/jitpack/android-example

于 2017-03-22T20:06:16.130 回答