大佬教程收集整理的这篇文章主要介绍了Android Studio 3.0 Canary 5中的Gradle Sync失败,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { ext.kotlin_version = "1.1.1" ext.supportLibVersion = "25.3.0" repositories { jcenter() } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version" classpath 'com.android.tools.build:gradle:3.0.0-alpha5' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { String osName = System.getProperty("os.name").toLowerCase(); if (osName.contains("windows")) { buildDir = "C:/tmp/${rootProject.namE}/${project.namE}" } repositories { jcenter() } } task clean(type: Delete) { delete rootProject.buildDir }
这是build.gradle(模块:app):
apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' android { compileSdkVersion 25 buildToolsVersion "25.0.2" defaultConfig { applicationId "com.example.android.datafrominternet" minSdkVersion 10 targetSdkVersion 25 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false } } } dependencies { compile fileTree(dir: 'libs',include: ['*.jar']) compile 'com.android.support:appcompat-v7:25.1.0' // TODO (32) Remove the ConsTraintLayout dependency as we aren't using it for these simple projects compile 'com.android.support.consTraint:consTraint-layout:1.0.0-beta4' implementation 'com.android.support.consTraint:consTraint-layout:1.0.2' implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7: $kotlin_version" }
这个错误信息:
Error:Unable to find method 'com.android.build.gradle.internal.variant.baseVariantData.getOutputs()Ljava/util/List;'.
此意外错误的可能原因包括:> Gradle的依赖性缓存可能已损坏(这有时会在网络连接超时后发生.)
重新下载依赖项和同步项目(需要网络)> Gradle构建过程(守护程序)的状态可能已损坏.停止所有Gradle守护进程可以解决此问题.
停止Gradle构建过程(需要重新启动)>您的项目可能正在使用第三方插件,该插件与项目中的其他插件或项目请求的Gradle版本不兼容.如果Gradle进程损坏,您可以还尝试@L_616_14@IDE然后杀死所有Java进程.
buildscript { repositories { mavenCentral() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.0.0-beta5' }
然后在ur app / gradle和project gradle中检查gradle插件的版本.或者尝试将此块添加到app / gradle顶部.
以上是大佬教程为你收集整理的Android Studio 3.0 Canary 5中的Gradle Sync失败全部内容,希望文章能够帮你解决Android Studio 3.0 Canary 5中的Gradle Sync失败所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。