title: Run groovy script from MainActivity/Activity
body: <p>I'm currently trying to run a groovy script in my MainActivity.</p>
  
  <h1>build.gradle</h1>
  
  <pre><code>apply plugin: 'com.android.application'
  apply plugin: 'groovyx.grooid.groovy-android'
  
  buildscript {
      repositories {
          jcenter()
      }
      dependencies {
          classpath 'com.android.tools.build:gradle:1.5.0'
          classpath 'org.codehaus.groovy:gradle-groovy-android-plugin:0.3.8'
  
      }
  }
  
  android {
      compileSdkVersion 23
      buildToolsVersion "23.0.2"
  
      defaultConfig {
          applicationId "com.example.muco.staemme"
          minSdkVersion 19
          targetSdkVersion 23
          versionCode 1
          versionName "1.0"
          multiDexEnabled true
      }
  
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
          }
      }
  
  dexOptions {
      incremental true
      javaMaxHeapSize "4g"
  }
  }
  
  
  dependencies {
      testCompile 'junit:junit:4.12'
      compile 'com.android.support:appcompat-v7:23.2.1'
  
      compile "org.gebish:geb-core:0.13.1"
      compile "org.seleniumhq.selenium:selenium-firefox-driver:2.52.0"
      compile "org.seleniumhq.selenium:selenium-support:2.52.0"
  
  }
  
  android.packagingOptions {
      exclude 'META-INF/services/org.codehaus.groovy.transform.ASTTransformation'
      exclude 'META-INF/services/org.codehaus.groovy.runtime.ExtensionModule'
      exclude 'META-INF/LICENSE.txt'
  }
  </code></pre>
  
  <h1>Gebbi.groovy (experimental, first i want to make sure, that it runs)</h1>
  
  <pre><code>package com.example.muco.staemme
  
  import android.util.Log
  import geb.Browser
  
  
  class Gebbi extends Script{
  
      public String run() {
          Browser.drive {
              go "https://www.die-staemme.de/"
              $("#login_form").with {
                  user = "..."
                  password = "..."
                  cookie = false
              }
  
              $("span", class: "button_middle").click()
              Log.i("groovy",$("span", class: "button_middle"))
          }
      }
  }
  </code></pre>
  
  <p>I want to run this code in my MainActivity(Java), but i always get Errors like</p>
  
  <pre><code>java.lang.ExceptionInInitializerError
  </code></pre>
  
  <p>and</p>
  
  <pre><code>java.lang.NoClassDefFoundError: org.codehaus.groovy.control.io.NullWriter
  </code></pre>
  
  <p>with</p>
  
  <pre><code>GroovyShell shell = new GroovyShell()
  </code></pre>
  
  <p>or</p>
  
  <pre><code>GroovyClassLoader gcl = new GroovyClassLoader()
  </code></pre>
  
  <p>etc. </p>
  
  <p>So can someone pls tell me, how to call the groovy script from JavaActivity? I also tried to call groovy script from java on desktop, it runs there. I searched all topics in Stackoverflow and here the from <a href="http://docs.groovy-lang.org/latest/html/documentation/index.html#_integrating_groovy_in_a_java_application" rel="nofollow">doc</a>.</p>
  
  <p>Greetings</p>