I'm having trouble referencing a groovy class i've created. Here are the steps:
my build.gradle file has all required dependencies:
apply plugin: 'com.android.application'
apply plugin: 'groovyx.grooid.groovy-android'
android { compileSdkVersion 22 buildToolsVersion "21.1.2"
packagingOptions {
// workaround for http://stackoverflow.com/questions/20673625/android-gradle-plugin-0-7-0-duplicate-files-during-packaging-of-apk
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/groovy-release-info.properties'
}
defaultConfig {
applicationId "com.example.uen.myrxjavaandroidproject"
minSdkVersion 17
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.netflix.rxjava:rxjava-android:0.20.7'
compile 'com.squareup:otto:1.3.5'
compile 'org.codehaus.groovy:groovy:2.4.3:grooid'
}
And gradle is synched successfully.
then i created a folder under main called 'groovy' such that my project structure looks like the following:
notice i have a groovy class called "Hello", it looks like this:
public class Hello {
String name;
public void sayHello() {
System.out.println("Hello "+getName()+"!");
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
}
now in my MainActivity.java class i try to instantiate Hello class but its not being recognized. I am doing this:
Hello myHello = new Hello();
what am i doing wrong ?