Class not found when using Android Studio

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Class not found when using Android Studio

Efi Merdler-Kravitz
Hello Guys,

I've been using Spock + Maven for a year an half now on my Android project. I've recently started a new project and this time I'm using Android studio. I've tried adding spock to my project, however whenever running a specification I'm getting
Class not found: "my.package.test.MyClass".

Here is my configuration:

dependencies {
classpath 'com.android.tools.build:gradle:1.3.1'
classpath 'com.google.gms:google-services:1.4.0-beta3'
classpath 'org.moallemi.gradle.advanced-build-version:gradle-plugin:1.5.1'
classpath 'org.codehaus.groovy:gradle-groovy-android-plugin:0.3.6'

}

apply plugin: 'groovyx.grooid.groovy-android'

compile 'org.codehaus.groovy:groovy:2.4.3:grooid'
testCompile "org.spockframework:spock-core:1.0-groovy-2.4"


I've made sure that my working directory is "$MODULE_DIR$" and the test itself is located under test/groovy/

What am I missing ?



--
You received this message because you are subscribed to the Google Groups "Spock Framework - User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Class not found when using Android Studio

Marek Bachorski
I think this is a problem with new Android Studio since version 1.5 or applied groovy plugin with this version of Android Studio.
I've been using similar configuration and it was working up to Android Studio stable version 1.4.1 (still latest stable), but since 1.5 I have the same error.

my configuration:

project's build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        jcenter()
        maven {
            // for spock
            url "https://oss.sonatype.org/content/repositories/snapshots"
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.3.0'

        classpath 'org.codehaus.groovy:gradle-groovy-android-plugin:0.3.6'
    }
}

allprojects {
    repositories {
        jcenter()
        maven {
            // for spock
            url "https://oss.sonatype.org/content/repositories/snapshots"
        }
    }
}



module's build.gradle:

apply plugin: 'com.android.library'
apply plugin: 'groovyx.grooid.groovy-android'
...

...
android{
...
compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
}

dependencies{
    testCompile 'org.codehaus.groovy:groovy-all:2.4.3'
    testCompile 'org.spockframework:spock-core:1.0-groovy-2.4'
}

tests are under module/src/test/my_package/<groovy class>



W dniu niedziela, 22 listopada 2015 05:46:28 UTC+1 użytkownik Efi Merdler-Kravitz napisał:
Hello Guys,

I've been using Spock + Maven for a year an half now on my Android project. I've recently started a new project and this time I'm using Android studio. I've tried adding spock to my project, however whenever running a specification I'm getting
Class not found: "my.package.test.MyClass".

Here is my configuration:

dependencies {
classpath 'com.android.tools.build:gradle:1.3.1'
classpath 'com.google.gms:google-services:1.4.0-beta3'
classpath 'org.moallemi.gradle.advanced-build-version:gradle-plugin:1.5.1'
classpath 'org.codehaus.groovy:gradle-groovy-android-plugin:0.3.6'

}

apply plugin: 'groovyx.grooid.groovy-android'

compile 'org.codehaus.groovy:groovy:2.4.3:grooid'
testCompile "org.spockframework:spock-core:1.0-groovy-2.4"


I've made sure that my working directory is "$MODULE_DIR$" and the test itself is located under test/groovy/

What am I missing ?



--
You received this message because you are subscribed to the Google Groups "Spock Framework - User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.