【问题标题】:Unable to publish Android library project on JitPack无法在 JitPack 上发布 Android 库项目
【发布时间】:2017-08-15 02:50:11
【问题描述】:

我为 Android 创建了一个小型库,并将其上传到我的公共 Github 存储库。库项目还包含一个示例应用程序。为了在 JitPack 上进行构建,我关注了 JitPack's own instructions.

现在我尝试使用 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')

}

【问题讨论】:

    标签: android gradle jitpack


    【解决方案1】:

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

    include ':Library'
    

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

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

    【讨论】:

      猜你喜欢
      • 2018-09-30
      • 1970-01-01
      • 2021-02-18
      • 1970-01-01
      • 2018-04-28
      • 2023-04-02
      • 2022-01-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多