gpt4 book ai didi

android-studio - Android Studio构建错误:此版本的Android Studio与所使用的Gradle插件不兼容。尝试禁用即时运行

转载 作者:行者123 更新时间:2023-12-03 13:41:10 25 4
gpt4 key购买 nike

我今天将Android Studio版本从1.5升级到了2.0,出现了问题。
首先,我收到Gradle版本错误,因此我将Gradle版本从2.10更新到了2.12。

# previous
# distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
# current
distributionUrl=https\://services.gradle.org/distributions/gradle-2.12-all.zip

Gradle版本错误已消失。
但是现在当我尝试运行我的项目时出现了这个错误:
Error running app: This version of Android Studio is incompatible with the Gradle Plugin used. Try disabling Instant Run (or updating either the IDE or the Gradle plugin to the latest version)

这是我的Project Gradle.build:
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0'
classpath 'com.google.gms:google-services:2.1.0-alpha1'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'

// 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
}

这是我的module:app Gradle.build文件。
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'android-apt'

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
applicationId "com.example.test"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"

multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
dexOptions {
maxProcessCount = 4 // this is the default value
javaMaxHeapSize "4g"
preDexLibraries = false
}
}

buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
mavenCentral()
}

dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}

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


dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'

compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') { transitive = true; }
compile('com.twitter.sdk.android:twitter:1.12.1@aar') { transitive = true; }

apt 'com.github.hotchemi:permissionsdispatcher-processor:2.1.2'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
compile 'com.android.support:cardview-v7:23.3.0'
compile 'com.android.support:palette-v7:23.3.0'
compile 'com.android.support:recyclerview-v7:23.3.0'
compile 'com.android.support:support-v13:23.3.0'
compile 'com.android.support:support-v4:23.3.0'
compile 'com.android.support:multidex:1.0.0'
compile 'com.google.android.gms:play-services-analytics:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.google.android.gms:play-services-location:8.4.0'
compile 'com.squareup.retrofit2:retrofit:2.0.0-beta4'
compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta4'
compile 'com.facebook.android:facebook-android-sdk:4.6.0'
compile 'com.paypal.sdk:paypal-android-sdk:2.13.3'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.github.hotchemi:permissionsdispatcher:2.1.2'
}

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

我从“首选项”中禁用了“即时运行”,但未进行任何更改。
如何解决此错误?
我挣扎了半天。

最佳答案

我在清理项目后删除了build文件夹,现在一切正常。 :D
我不知道为什么会这样,但是预 build 置可能与新的构 build 置冲突。

关于android-studio - Android Studio构建错误:此版本的Android Studio与所使用的Gradle插件不兼容。尝试禁用即时运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36709514/

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