0

Я пытался ускорить время сборки градиента в Android Studio, и теперь, когда я строю или синхронизирую свой проект, я получите ошибку:Android Studio: Task '-' не найден в корневом проекте '[Название проекта]' после ускорения сборки

Error:FAILURE: Build failed with an exception. 

* What went wrong: 
Task '-' not found in root project '[Project Name]'. 

* Try: 
Run gradle tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. 

После нескольких дней поиска в Интернете я ничего не нашел. Кто-нибудь знает, что могло вызвать эту ошибку, я не могу проверить свой проект сейчас.

В каждом другом вопросе не указывается задача '-', а что-то еще.

Я добавил в «[Название проекта]» для фактического имени проекта.

Мой проект build.gradle является:

// 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.1.3' 

     // 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 
} 

И мой модуль build.gradle является:

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 23 
    buildToolsVersion "23" 

    defaultConfig { 
     applicationId "ca.lakeeffect.scoutingapp" 
     minSdkVersion 15 
     targetSdkVersion 23 
     versionCode 1 
     versionName "1.0" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:appcompat-v7:23.0.0' 
} 

И мой gradle.properties:

# 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. 
# Default value: -Xmx10248m -XX:MaxPermSize=256m 
# org.gradle.j# Project-wide Gradle settings. 

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

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

# The Gradle daemon aims to improve the startup and execution time of Gradle. 
# When set to true the Gradle daemon is to run the build. 
# TODO: disable daemon on CI, since builds should be clean and reliable on servers 
org.gradle.daemon=true 

# Specifies the JVM arguments used for the daemon process. 
# The setting is particularly useful for tweaking memory settings. 
# Default value: -Xmx10248m -XX:MaxPermSize=256m 
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 

# When configured, Gradle will run in incubating parallel mode. 
# This option should only be used with decoupled projects. More details, visit 
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 
org.gradle.parallel=true 

# Enables new incubating mode that makes Gradle selective when configuring projects. 
# Only relevant projects are configured which results in faster builds for large multi-projects. 
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:configuration_on_demand 
org.gradle.configureondemand=truevmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 

# When configured, Gradle will run in incubating parallel mode. 
# This option should only be used with decoupled projects. More details, visit 
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 
# org.gradle.parallel=true 
+1

Вы могли бы показать свой проект и приложение 'build.gradle'? –

+0

добавили его @Alvenir – Ajay

+0

попробуйте 'Invalidate Caches/Restart' Android Studio и перестройте проект без' org.gradle.parallel = true' –

ответ

0

Я не знал, что делать, так в крайнем случае, я сделал новый проект и скопировал свой код. Затем я нажал File > Restart и несколько раз перепроектировал проект. Это сработало! Если кто-то еще найдет реальный ответ, который было бы замечательно знать.