Android Invalid escape sequence at line 1 column 29 path $[0].name错误解决

创建一个简单的HelloWorld安卓项目,在build时报错。

Invalid escape sequence at line 1 column 29 path $[0].name

异常链是

org.gradle.execution.MultipleBuildFailures: Build completed with 1 failures.
	at org.gradle.initialization.DefaultGradleLauncher$ExecuteTasks.run(DefaultGradleLauncher.java:386)
    ...
Caused by: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
    ...
Caused by: com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Invalid escape sequence at line 1 column 29 path $[0].name
	at com.google.gson.Gson.fromJson(Gson.java:902)
     ...

原因是构建项目的com.android.tools.build:gradle与安卓版本不兼容,只需要降级版本就可以解决

编辑项目的build.gradle 文件的buildscript.dependencies.classpath,把classpath 'com.android.tools.build:gradle:3.4.1'版本改为 3.3.0

buildscript {
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.1'
    }
}

重新同步Gradle版本,解决!

你可能感兴趣的:(Android Invalid escape sequence at line 1 column 29 path $[0].name错误解决)