首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >Android:计算任务图错误

Android:计算任务图错误
EN

Stack Overflow用户
提问于 2018-06-20 08:20:53
回答 1查看 5.1K关注 0票数 1

在更新项目后,我似乎得到了这个Gradle错误:

代码语言:javascript
复制
Configuration on demand is not supported by the current version of the Android Gradle plugin since you are using Gradle version 4.6 or above. Suggestion: disable configuration on demand by setting org.gradle.configureondemand=false in your gradle.properties file or use a Gradle version less than 4.6.

打开该选项卡以进行进一步检查时,显示如下:

代码语言:javascript
复制
org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':app'.
Caused by: org.gradle.api.GradleScriptException: A problem occurred evaluating project ':app'.
Caused by: org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin [id 'com.android.application']
Caused by: org.gradle.api.tasks.StopExecutionException: Configuration on demand is not supported by the current version of the Android Gradle plugin since you are using Gradle version 4.6 or above. Suggestion: disable configuration on demand by setting org.gradle.configureondemand=false in your gradle.properties file or use a Gradle version less than 4.6.

我已经尝试了两个建议,分别和一起都没有用。请看下面我的Gradle文件。

Gradle项目文件

代码语言:javascript
复制
buildscript {
ext.kotlin_version = '1.2.50'
repositories {
    google()
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.1.3'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    classpath "io.realm:realm-gradle-plugin:5.0.0"
    classpath 'com.google.gms:google-services:4.0.0'




    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
allprojects {
repositories {
    google()
    jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

Gradle模块文件

代码语言:javascript
复制
apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

apply plugin: 'realm-android'

apply plugin: 'kotlin-kapt'
android {
useLibrary 'org.apache.http.legacy'
compileSdkVersion 27
defaultConfig {
    applicationId "com.example.blah.blah"
    minSdkVersion 21
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        postprocessing {
            removeUnusedCode false
            removeUnusedResources false
            obfuscate false
            optimizeCode false
            proguardFile 'proguard-rules.pro'
        }
    }
}}
dependencies {
implementation 'com.stripe:stripe-android:6.1.2'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'junit:junit:4.12'
implementation "cz.msebera.android:httpclient:4.4.1.2"

implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:support-core-utils:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation  'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation files('libs/stripe-java-5.23.1.jar')
implementation  'com.android.volley:volley:1.0.0'
implementation  'com.google.code.gson:gson:2.8.2'}

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

Gradle属性文件

代码语言:javascript
复制
# Project-wide Gradle settings.

# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.

# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
#org.gradle.parallel=true

我希望有人能开导我。如果你需要的话,我会上传更多的文件数据。

EN

回答 1

Stack Overflow用户

发布于 2019-07-26 09:34:36

点击Android Studio菜单列表上的文件缓存,选择Invalidate ,然后会出现一个对话框,点击Invalidate并重新启动。这对我很管用。此外,我已经在您的gradle.properties中设置了org.gradle.configureondemand=false,正如Pavneet_Singh在使缓存无效之前所说的那样。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50938561

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档