当我尝试将我的模型库上传到jcenter时,运行gradle install
,这是完整的提示信息
Caused by: java.lang.RuntimeException: Minimum supported Gradle version is 3.3. Current version is 2.14.1. If using the gradle wrapper, try editing the distributionUrl in /Users/huanjulu/Documents/PermissionHandler/PermisisonHandler/gradle/wrapper/gradle-wrapper.properties to gradle-3.3-all.zip
这是我的gradle-wrapper.properties
:
#DATE
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
这是我的项目build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.2.0'
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7'
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()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
这是我的app build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "huanjulu.runtimepermission.com"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
jackOptions {
enabled true
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile project(':permissionhandler')
}
确定我在Open File>中使用默认的gradle包装器设置>构建,执行,部署>构建工具>摇篮。
答案 0 :(得分:2)
运行gradle install
时,不使用gradle包装器,而是使用本地安装的gradle版本。
改为:
gradlew install
或在Linux上
./gradlew install
答案 1 :(得分:0)
您需要从https://gradle.org/releases下载最后一个版本,然后转到文件/项目结构/项目并将新版本放入gradle版本
答案 2 :(得分:0)
变化:
在gradle-wrapper.properties
:
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
与
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
在project
级别build.gradle
:
classpath 'com.android.tools.build:gradle:2.3.3'
与
classpath 'com.android.tools.build:gradle:3.0.1'
在project
级别build.gradle
:
在 google()
块下添加repositories{}