简体   繁体   中英

Run groovy shell in Android Studio Gradle project

When I try to start the Groovy shell in an Android Studio gradle project I get the error

Exception in thread "main" java.lang.ClassNotFoundException: org.codehaus.groovy.tools.GroovyStarter
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:115)

I'm running Android Studio 0.3.7 on a MacBook Pro.

Any ideas how to fix that?

Try to add groovy in your buildscript classpath dependencies:

buildscript {
    dependencies {
        ...
        classpath 'org.codehaus.groovy:groovy-all:1.8.6'
    }
}

That fixed the error for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM