Android studio Android Studio构建错误:此版本的Android Studio与使用的Gradle插件不兼容。尝试禁用即时运行
今天我将Android Studio版本从1.5升级到2.0,但出现了一些问题。Android studio Android Studio构建错误:此版本的Android Studio与使用的Gradle插件不兼容。尝试禁用即时运行,android-studio,gradle,version,Android Studio,Gradle,Version,今天我将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/gradl
首先我得到了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
渐变版本错误已消失。但是现在,当我尝试运行我的项目时,出现了以下错误:
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)
这是我的项目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
}
这是我的模块: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'
我禁用了“从首选项即时运行”,但没有任何更改。
如何解决此错误?
我挣扎了半天。在清理项目后,我删除了构建文件夹,现在一切正常D
我不知道为什么会发生这种情况,但可能预构建设置与新构建设置冲突。我使用的是Android Studio 2.2,对我来说。。。 清理项目并删除生成文件夹解决了此问题 我和你只有一个不同的想法。我把它建起来了,格雷德尔。
classpath'com.android.tools.build:gradle:+'在android 2.0及以上版本上 1-在
设置中
->构建、执行、部署
选项->即时运行
2-清除启用即时运行到热插拔代码
3-清洁工程
p/s:它应该完全可以工作。我在将Android Studio升级到2.3之后遇到了这个问题! 我没有删除任何文件 刚刚清理了项目成功了
Plugin version Required Gradle version
1.0.0 - 1.1.3 2.2.1 - 2.3
1.2.0 - 1.3.1 2.2.1 - 2.9
1.5.0 2.2.1 - 2.13
2.0.0 - 2.1.2 2.10 - 2.13
2.1.3 - 2.2.3 2.14.1+
2.3.0+ 3.3+
e、 g.在Gradle-wrapper.properties文件中将Gradle版本设置为3.3
...
distributionUrl = https\://services.gradle.org/distributions/gradle-3.3-all.zip
...
从build.Gradle文件将Gradle的Android插件设置为2.3.0版:
buildscript {
...
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
}
}
此外,您还必须通过检查确保没有碰撞:
文件
->项目结构
->(点击)项目
在这种情况下,清除项目(构建->清理项目)是正确的做法。确保Android Studio是最新的
AndroidStudio帮助检查更新…我删除了构建文件夹并清理了项目,但对于Gradle 2.0+遵循@Tran Duc Huy仍然存在相同的错误。为meDisabling Instant Run工作不是一个解决方案。对于某人,“对于Gradle 2.0+遵循@Tran Duc Huy。为我工作”