当我尝试获取我的应用的发布apk时,出现此错误。
下面是所有数据。
控制台日志
FAILURE: Build failed with an exception.
* Where:
Build file 'D:\pro\food\android\build.gradle' line: 30
* What went wrong:
A problem occurred evaluating root project 'android'.
> A problem occurred configuring project ':app'.
> Failed to notify project evaluation listener.
> org.gradle.api.file.ProjectLayout.directoryProperty(Lorg/gradle/api/provider/Provider;)Lorg/gradle/api/file/DirectoryProperty;
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 3s
Picked up _JAVA_OPTIONS: -Xms256m -Xmx2048m
Running Gradle task 'assembleRelease'... 4.5s
Gradle task assembleRelease failed with exit code 1
Process finished with exit code 1
android级别的build.gradle文件
buildscript {
repositories {
maven{url 'https://dl.google.com/dl/android/maven2'}
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2.'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.1'
classpath 'com.google.gms:google-services:4.3.3'
}
}
allprojects {
repositories {
maven{
url 'https://maven.gppgle.com'
}
google()
jcenter{ url "http://jcenter.bintray.com/"}
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
渐变包装属性
#Fri Jun 23 08:50:38 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3.2-all.zip
我尝试清除缓存,重新启动android studio。
请有人帮我解决这个问题。
任何帮助将不胜感激。
答案 0 :(得分:1)
在 build.gradle
文件夹中打开您的 android
文件。 (不在应用中)
在 dependency
块内,像这样更新 tools.build.gradle
的 classpath,
dependencies {
classpath 'com.android.tools.build:gradle:4.0.2'
}