gpt4 book ai didi

android - 单击Android Studio中的更新Gradle后无法进行Cant Gradle同步-错误:Gradle 2.14.1需要Android Gradle插件2.1.3(或更高版本)

转载 作者:行者123 更新时间:2023-12-03 05:12:27 30 4
gpt4 key购买 nike

这是我在Gradle Sync中尝试Android Studio时遇到的确切错误。我所做的就是在出现较新版本的Gradle对话框时,单击更新按钮。

Error:Gradle 2.14.1 requires Android Gradle plugin 2.1.3 (or newer) but project is using version 2.1.0.
<a href="fixGradleElements">Upgrade plugin to version 2.3.0 and sync project</a><br><a href="https://developer.android.com/studio/releases/gradle-plugin.html#updating-gradle">Open Documentation</a>

这在我的master分支上,我知道可以与其他人建立/同步。

项目构建文件

// This is used to improve build server performance by disable pre-dexing when building.
// To enable this feature, use "./gradlew clean assemble -PdisablePreDex"
// Refer: http://tools.android.com/tech-docs/new-build-system/tips
project.ext.preDexLibs = !project.hasProperty('disablePreDex')
subprojects {
project.plugins.whenPluginAdded { plugin ->
if ("com.android.build.gradle.AppPlugin".equals(plugin.class.name)) {
project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs
} else if ("com.android.build.gradle.LibraryPlugin".equals(plugin.class.name)) {
project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs
}
}
}

// This is used to control Android properties of all modules from the main project.
// Refer: http://tools.android.com/tech-docs/new-build-system/tips
ext {
compileSdkVersion = 24
buildToolsVersion = '24'
gradleBuildToolClassPath = 'com.android.tools.build:gradle:2.2.2'
}

buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath "io.realm:realm-gradle-plugin:1.2.0"
classpath "com.google.gms:google-services:3.0.0"
}
}

应用程序构建文件
buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath rootProject.ext.gradleBuildToolClassPath
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'realm-android'

repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
flatDir {
dirs 'libs'
}
}

dependencies {
// Projects
releaseCompile project(path: ':LibProjects:Android-Library', configuration: 'release')
debugCompile project(path: ':LibProjects:Android-Library', configuration: 'debug')
compile project(':LibProjects:photoview')
compile project(':LibProjects:viewpagerindicator')

// Maven libraries
compile 'com.google.firebase:firebase-messaging:10.0.1'
compile 'com.android.support:support-v4:24.0.0'
compile 'com.android.support:gridlayout-v7:24.0.0'
compile 'com.android.support:design:24.0.0'
compile 'com.android.support:preference-v7:24.0.0'
compile 'com.android.support:recyclerview-v7:24.0.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.android.gms:play-services-gcm:10.0.1'
compile 'com.google.android.gms:play-services-ads:10.0.1'
compile 'com.google.android.gms:play-services-location:10.0.1'
compile 'com.edmodo:rangebar:1.0.0'
compile 'com.edmodo:cropper:1.0.1'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:+'
compile 'com.tonicartos:stickygridheaders:1.0.1'
compile 'com.intellij:annotations:+@jar'
compile 'com.mixpanel.android:mixpanel-android:4.5.3'
compile 'com.splitwise:tokenautocomplete:2.0.7@aar'
compile('com.crashlytics.sdk.android:crashlytics:2.5.7@aar') { transitive = true; }
compile 'com.github.clans:fab:1.6.4'
compile ('com.facebook.android:audience-network-sdk:4.6.0') { exclude group: 'com.google.android.gms' }
compile('com.mopub:mopub-sdk-base:4.11.0@aar')
compile('com.mopub:mopub-sdk-native-static:4.11.0@aar')

// File libraries
compile fileTree(dir: 'libs', include: '*.jar')
compile(name:'adsnative-sdk-2.5.3', ext:'aar')

// Testing
androidTestCompile 'com.android.support:support-annotations:24.0.0'
androidTestCompile 'com.android.support.test:runner:0.5'
}

android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion

defaultConfig {
applicationId "com.fusionprojects.edmodo"
minSdkVersion 15
targetSdkVersion rootProject.ext.compileSdkVersion
versionCode 50111
versionName "6.5.2"
proguardFile getDefaultProguardFile('proguard-android.txt')
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
}

packagingOptions {
// These statements are required for solving a very annoying gradle build error:
// "Duplicate files copied in APK META-INF/DEPENDENCIES"
// Refer: http://blog.csdn.net/zhouzme/article/details/18923293
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}

sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}

// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')

// Testing
androidTest.setRoot('androidTest')
}

buildTypes {
release {
minifyEnabled false
proguardFile file('proguard-project.txt')
signingConfig signingConfigs.releaseConfig
}
}

dexOptions {
javaMaxHeapSize "4g"
jumboMode true
}

lintOptions {
abortOnError false
}
}

apply plugin: 'com.google.gms.google-services'

Gradle包装器
#Tue Sep 06 16:30:01 PDT 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip

最佳答案

您可以尝试以下方法:

转到-> gradle.wrapper.properties

并将发行版网址替换为:

distributionUrl=https\://services.gradle.org/distributions/gradle-3.4.1-all.zip

希望这可以帮助 !

关于android - 单击Android Studio中的更新Gradle后无法进行Cant Gradle同步-错误:Gradle 2.14.1需要Android Gradle插件2.1.3(或更高版本),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42656118/

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