1

I am trying to work on my android project, I import the project in 2 different system, one is windows 10 and another is Mac OS. Android studio gradle build on windows with no problem but on Mac, after about 1.5 hour, it just show bellow error

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.

I add org.gradle.jvmargs=-Xmx512m on my project gradle.properties but now result.

My 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

And my system info

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)

Currently my Android Studio return bellow error

Root project path of the Gradle project not found for Module:....

I install Gradle on my mac and its build by command line without any problem but in android studio ...

Shayan
  • 956
  • 9
  • 20

2 Answers2

0

Try adding this line of code in gradle.properties org.gradle.jvmargs=-Xmx1024m -XX:MaxPermSize=512m and restart android studio.

A.D
  • 356
  • 4
  • 17
0
  • chmod +x ./gradlew
  • Try to run without daemon:
  • ./gradlew --stop Stop all daemons in system, they can conflict to each other
  • ./gradlew assembleDebug --dry-run - run to confirm that gradle files does contain any syntax error
  • confirm that root project contains build.gradle file, confirm that all modules contains build.gradle files
  • check settings.gradle file and how modules included in it, expected something like:
include ':app'
include ':modules:countries'
  • macos and windows has difference in PATH definition, all file path things should be properly changed. use / as a path separator for macos and windows. (in win \ is a path separator)
  • if your modules structure is deeper :modules:root:sub-lib than check on all levels existence of build.gradle file, that may cause a problems, especially when used sub-modules git configurations
  • double check the folder in which you execute the gradle wrapper, you should stay in project root folder

helpers:

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

usage:

def path = """${project.buildDir}/reports/checkstyle/checkstyle.html"""
project.logger.info('  report: ' + adoptToOs(path))
Oleksandr Kucherenko
  • 1,921
  • 1
  • 17
  • 21