gpt4 book ai didi

java - Gradle Plugin 与 android 发布插件

转载 作者:行者123 更新时间:2023-12-01 10:34:59 26 4
gpt4 key购买 nike

我正在开发一个基于 Android 项目的自定义 gradle 插件。我想通过另一个插件( https://plugins.gradle.org/docs/publish-plugin )发布我的插件,这是我的 build.gradle:

apply plugin: 'com.android.library'
apply plugin: 'maven'
apply plugin: "com.gradle.plugin-publish"

buildscript {
repositories {
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
classpath "com.gradle.publish:plugin-publish-plugin:0.9.3"
}
}

repositories {
jcenter()
}

group = 'com.myplugin'
version = '1.0-SNAPSHOT'

uploadArchives {
repositories {
mavenDeployer {
repository(url: uri('../repo'))
}
}
}

android {
compileSdkVersion 21
buildToolsVersion "22.0.1"

defaultConfig {
minSdkVersion 18
targetSdkVersion 19
}

lintOptions {
abortOnError false
}
}

dependencies {
compile gradleApi()
}

task wrapper(type: Wrapper) {
gradleVersion = '2.3'
}

pluginBundle {
website = 'http://www.example.com/'
description = 'Welcome to bla bla'
tags = ['test', 'test']
plugins {
PluginName {
id = 'com.something'
displayName = 'My Plugin'
}
}
}

当我运行这个时:

./gradlew uploadArchives

我收到此错误:

Parallel execution with configuration on demand is an incubating feature.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'mylib'.
> The 'java' plugin has been applied, but it is not compatible with the Android plugins.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 1.543 secs

最佳答案

抱歉,我真正想做的事情描述如下:

http://code.tutsplus.com/tutorials/creating-and-publishing-an-android-library--cms-24582

发布我的 Android 库,以便任何人都可以通过 gradle 访问它

关于java - Gradle Plugin 与 android 发布插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34814050/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com