Upgrade to gradle from 4.10 to 5.1

upgrade my android gradle plugin to 3.4.1 which uses gradle version 5.1, got following gradle build error,
can anyone help with this ?

Execution failed for task ‘:app:mergeCustomDevDebugAssets’.

No signature of method: org.gradle.api.internal.file.DefaultFilePropertyFactory$DefaultDirectoryVar.getPath() is applicable for argument types: () values:
Possible solutions: getAt(java.lang.String), getClass(), get(), getType(), each(groovy.lang.Closure), iterator()

Please include the script for the “mergeCustomDevDebugAssets” task, it seems there’s a garbage character in your build.gradle judging by the error message

What presents as a garbage character is actually the left square bracket immediately followed by the right square bracket.