我正在尝试处理我的android项目,我在2个不同的系统中导入项目,一个是Windows 10,另一个是Mac OS。
Android工作室gradle
在Windows上构建没有问题
但在Mac上,大约1.5小时后,它只显示以下错误
Error:Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the user guide chapter on the daemon at https://docs.gradle.org/3.3/userguide/gradle_daemon.html
Please read the following process output to find out more:
-----------------------
FAILURE: Build failed with an exception.
* What went wrong:
Unable to create daemon log file
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
我在项目org.gradle.jvmargs=-Xmx512m
上添加了gradle.properties
,但现在结果。
我的gradle-wrapper.properties
#Fri Jun 08 19:47:34 IRDT 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
我的系统信息
OS X 10.13.5 (17F77) - High Sierra
Android Studio 3.1.3
Gradle 4.4-all
java version "1.8.0_172"
Java(TM) SE Runtime Environment (build 1.8.0_172-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.172-b11, mixed mode)
目前我的Android Studio返回错误
Root project path of the Gradle project not found for Module:....
我在我的mac上安装了Gradle,并且没有任何问题在命令行中安装 ,但在android studio中...
答案 0 :(得分:0)
尝试在gradle.properties中添加此行代码 org.gradle.jvmargs = -Xmx1024m -XX:MaxPermSize = 512m 并重新启动android studio。
答案 1 :(得分:0)
chmod +x ./gradlew
./gradlew --stop
停止系统中的所有守护进程,它们可以相互冲突./gradlew assembleDebug --dry-run
- 运行以确认gradle文件确实包含任何语法错误include ':app' include ':modules:countries'
/
作为macos和windows的路径分隔符。 (在win \
中是一个路径分隔符):modules:root:sub-lib
文件的结构更深build.gradle
,那么可能会导致问题,尤其是在使用子模块git配置时助手:
def adoptToOs(String path) {
// remove doubled dir separators
path = path.replace("//", "/")
path = path.replace("\\\\", "\\")
if (Os.isFamily(Os.FAMILY_WINDOWS)) { // windows
path = path.replace("/", "\\")
} else if (Os.isFamily(Os.FAMILY_UNIX)) { // linux
path = path.replace("\\", "/")
} else if (Os.isFamily(Os.FAMILY_MAC)) { // mac os
path = path.replace("\\", "/")
}
return path;
}
用法:
def path = """${project.buildDir}/reports/checkstyle/checkstyle.html"""
project.logger.info(' report: ' + adoptToOs(path))