Home » Android » android – Gradle error with a dollar sign

android – Gradle error with a dollar sign

Posted by: admin June 15, 2020 Leave a comment


Sorry for my english.

I’m trying to create a new project in the Android Studio with Gradle support, but I can’t correctly build my project. There is a code:

Gradle 'SportManager' project refresh failed:
     Cause: startup failed:
     initialization script 'C:\Users\ponomarev\AppData\Local\Temp\ijinit6732759991667918700.gradle': 33: illegal string body character after dollar sign;
     solution: either escape a literal dollar sign "\" or bracket the value expression "" @ line 33, column 20.
     String[] paths = ["/LOGGER-2/c$/Program Files/android-studio/plugins/gradle/lib/gradle-tooling-extension.jar","/LOGGER-2/c$/Program Files/android-studio/plugins/gradle/lib/gradle-tooling-extension-v1.9.jar","/LOGGER-2/c$/Program Files/android-studio/plugins/gradle/lib/gradle-tooling-extension-v1.11.jar","/LOGGER-2/c$/Program Files/android-studio/plugins/gradle/lib/gradle-tooling-extension-v1.12.jar"]
     1 error

‘LOGGER-2’ is computer’s name in the network.

I see that Gradle don’t understand literal dollar sign $ in the following expression: “/LOGGER-2/c$/Program Files/…”. How I can fix it issue?

How to&Answers:

$ in a double-quoted String literal has a special meaning in Groovy – it’s used for String interpolation. If you want a literal $, either use a single-quoted String literal (e.g. 'foo$bar'), or escape the $ with \ (e.g. "foo\$bar").