Rob*_*kus 11 android android-studio build.gradle android-gradle-plugin android-gradle-3.0
遇到迁移到Android gradle插件3.0的问题.
项目根目录下的build.gradle文件
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
Run Code Online (Sandbox Code Playgroud)
Android 应用程序模块build.gradle
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
mavenCentral()
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
classpath testDependencies.spoon
}
}
repositories {
maven { url 'https://maven.fabric.io/public' }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
spoon {
debug = true
grantAllPermissions = true
shard = true
}
android {
compileSdkVersion 25
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
Run Code Online (Sandbox Code Playgroud)
试图编译一个项目.我收到编译错误.
但是,一旦retrolambda再次被添加回来,那么该项目将成功编译和构建.阅读"已知问题"部分,但没有找到解决方法.我希望有人能够体验到这一点,并能提供帮助
如果在更新插件后遇到构建错误,只需在此页面中搜索错误输出或导航到相关主题,然后按照说明解决问题.
例如,请考虑主项目的build.gradle文件中包含的以下类路径依赖项:
buildscript {
...
dependencies {
classpath "com.android.tools.build:gradle:3.0.1"
classpath "me.tatarka:gradle-retrolambda:3.7.0"
}
}
Run Code Online (Sandbox Code Playgroud)
现在考虑复合构建中包含的另一个项目的以下build.gradle文件:
buildscript {
dependencies {
// Note that the order of plugins differs from that
// of the main project's build.gradle file. This results
// in a build error because Gradle registers this as a
// different classloader.
classpath "me.tatarka:gradle-retrolambda:3.7.0"
classpath "com.android.tools.build:gradle:3.0.1"
}
}
Run Code Online (Sandbox Code Playgroud)
确保这些行位于应用程序(模块)级别的 gradle 文件中
构建工具版本
应用程序配置的defaultConfig
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.app"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1426 次 |
| 最近记录: |