</p>

I have this code in my Android Studio’s gradle file:

</p>

javaCompileOptions {
    annotationProcessorOptions {
        arguments = [ targetModuleName : 'Base',
                      assetsDir : "$projectDir/src/main/assets"
        ]
    }
}

Then the IDE throws this error message to me when I sync the project:

Error:Cause: org.codehaus.groovy.runtime.GStringImpl cannot be cast to java.lang.String

Possible causes for this unexpected error include:<ul><li>Gradle’s dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)

Why? As “” will product a GStringImpl, but not a String object.

How to fix it? Follow a workaround in this bug: https://github.com/flyway/flyway/issues/690, then finally code is this:</p>

javaCompileOptions {
    annotationProcessorOptions {
        arguments = [ targetModuleName : 'Base',
                      assetsDir : "$projectDir/src/main/assets".toString()
        ]
    }
}

</p>

</body></html>

转载请注明:WebLogic Android 博客 » Fix problem: GStringImpl cannot be cast to java.lang.String