【问题标题】:Not able to upload android library to JitPack.io. Failed to apply plugin [id 'com.android.internal.version-check']无法将 android 库上传到 JitPack.io。无法应用插件 [id 'com.android.internal.version-check']
【发布时间】:2020-12-10 20:20:21
【问题描述】:
【问题讨论】:
标签:
android
github
gradle
jitpack
【解决方案1】:
最初,我在 Gradle 4.8.1 中也遇到了这个错误,这肯定是令人困惑的:
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!
详情请见build.log。
我实际上错过的是将./gradlew 和./gradle/wrapper/gradle-wrapper.jar 包含到git 存储库中。 是的!您应该将这些文件上传到 github!
之后就可以使用最新的 gradle 版本了,太棒了!
这是构建日志:
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
详情请见build.log。
附:如手册中所述,插件com.github.dcendents.android-maven 应包含在两个build.gradle 文件中。
【解决方案2】:
您是否更新了 Gradle 文件?
你应该有类似下面的配置:
settings.gradle
include ':app', ':NAME_OF_LIBRARY'
rootProject.name = "NAME_OF_LIBRARY"
build.gradle(模块)
添加插件、组和版本
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
group = 'com.github.YOURGITHUBNAME'
version = rootProject.ext.versionName
...
build.gradle(项目)
将 github 类路径添加到您的依赖项中
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
}