android - Android Studio版本与Gradle插件版本之间有什么关系?

标签 android android-studio gradle

我正在使用Android Studio(Canary)2.1 Preview 4。

当我试图改变

classpath 'com.android.tools.build:gradle:2.1.0-alpha4'


classpath 'com.android.tools.build:gradle:2.1.0-alpha3'

我收到对话框消息

"The project is using an incompatible version of the Android Gradle plugin"



Android Studio建议将其更改回alpha4
更新:

但是我可以设置com.android.tools.build:gradle:1.5.0
而且我不能设置com.android.tools.build:gradle:2.0.0

看起来AS版本和Gradle版本之间没有任何关系。
如何在AS 2.1中设置2.0.0 gradle veriosn?

最佳答案

Android Studio 2.0 Beta 7仅与发行版的Android gradle build插件(1.5.0)或2.0.0-beta7一起使用。我假设类似的关系适用于AS 2.1 Preview 4,因此它仅适用于构建插件1.5.0或2.1.0-alpha4。

构建插件2.0和2.1应该与2.1完全相同,但添加了对Android N的支持。AndoridStudio也是如此。

A number of developers have asked what the difference is between 2.0 and 2.1. In short:

  • 2.0 is nearly done; release candidate 1 was posted yesterday
  • 2.1 is basically just 2.0 plus fixes to support the Android N Preview SDK.

资料来源:http://tools.android.com/recent/androidstudio21preview5available

如果要使用2.0构建插件,请安装AS 2.0。
Android Tools project site
Using multiple Android Studio versions

为什么AS版本X仅与构建插件版本X一起使用?
即时运行。由于它是Beta版,因此Instant Run的API和内部结构在不断变化。这是在gradle build插件中完成的。但是,AS使用了不断变化的API,因此也必须对其进行更新。

关于android - Android Studio版本与Gradle插件版本之间有什么关系?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36257689/

相关文章:

android - 找不到 com.android.tools.build :gradle:3. 4.2

spring - 让@Configurable 工作

gradle - 在Debian Linux上全新安装后Gradle无法正常工作

android - 也让 Android "SlidingPaneLayout"推送操作栏

java - 自定义配置后,Cordova 无法为 Android 构建

java - CardView 填充/间距在不同的 API 级别上有所不同

android - Unresolved reference : android build failed with kotlin dsl (reproducible in an empty project)

java - isNetworkUrl 和 isValidUrl 的区别

android - 在现有 View 上显示透明 View

android - 使用 kotlin 的 WebView 中的进度条