Code Monkey home page Code Monkey logo

Comments (6)

nenick avatar nenick commented on August 23, 2024

This issue is most times related with a not compatible java version. like here http://jira.codehaus.org/browse/GROOVY-6550

Check which java version you use to compile. Then make sure that you use java 7. Neither java 6 nor java 8 will work with the used parts in this template.

from android-gradle-template.

dawidgdanski avatar dawidgdanski commented on August 23, 2024

Ok, works like a charm, thanks a lot!

from android-gradle-template.

mattkranzler5 avatar mattkranzler5 commented on August 23, 2024

I am also having this issue. In my case the project I'm testing is a library project. I can't seem to get past this error. Any suggestions?

Here is my test project gradle file:

buildscript {
    dependencies {
        classpath 'com.android.tools.build:gradle:0.12.+'
        classpath "com.novoda:gradle-android-test-plugin:0.9.9-SNAPSHOT"
    }
}

apply plugin: 'java'

test.reports.html.enabled = false     // just clean up dashboard from not generated reports
test.reports.junitXml.enabled = false // just clean up dashboard from not generated reports

apply plugin: 'android-test'
apply plugin: "jacoco"

android {
    projectUnderTest ':core'
}

dependencies {
    testCompile('junit:junit:4.11') {
        exclude module: 'hamcrest-core'
    }
    testCompile 'org.mockito:mockito-core:1.9.5'
    testCompile('org.robolectric:robolectric:2.3') {
        exclude module: 'classworlds'
        exclude module: 'maven-artifact'
        exclude module: 'maven-artifact-manager'
        exclude module: 'maven-error-diagnostics'
        exclude module: 'maven-model'
        exclude module: 'maven-plugin-registry'
        exclude module: 'maven-profile'
        exclude module: 'maven-project'
        exclude module: 'maven-settings'
        exclude module: 'nekohtml'
        exclude module: 'plexus-container-default'
        exclude module: 'plexus-interpolation'
        exclude module: 'plexus-utils'
        exclude module: 'wagon-file'
        exclude module: 'wagon-http-lightweight'
        exclude module: 'wagon-http-shared'
        exclude module: 'wagon-provider-api'
        exclude module: 'support-v4' // crazy but my android studio don't like this dependency and to fix it remove .idea and re import project
    }
    testCompile('com.squareup:fest-android:1.0.+') {
        exclude module: 'support-v4'
    }
}

apply from: '../scripts/jacoco-support.gradle'
apply from: '../scripts/android-studio-robolectric-support.gradle'

Here is my project under test:

buildscript {
    dependencies {
        classpath 'com.android.tools.build:gradle:' + androidGradlePluginVersion
        classpath 'com.jakewharton.sdkmanager:gradle-plugin:' + sdkManagerPluginVersion
    }
}

apply plugin: 'android-sdk-manager'
apply plugin: 'com.android.library'

final API_HOST = "\"http://api.shifton.us\"";

repositories {
    maven { url 'http://download.crashlytics.com/maven' }
}

android {
    compileSdkVersion projectCompileSdkVersion
    buildToolsVersion projectBuildToolsVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }

    defaultConfig {
        minSdkVersion projectMinSdkVersion
        targetSdkVersion projectTargetSdkVersion
        applicationId "com.shiftconnects.android.core"
        testInstrumentationRunner "com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner"
    }

    buildTypes {
        debug {
            buildConfigField "String", "API_HOST", API_HOST
        }
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
            buildConfigField "String", "API_HOST", API_HOST
        }
    }

    packagingOptions {
        exclude 'META-INF/services/javax.annotation.processing.Processor'
    }

    lintOptions {
        abortOnError true
        disable 'InvalidPackage'
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.crashlytics.android:crashlytics:1.+'
    compile 'com.android.support:support-v4:19.1.+'
    compile 'com.google.android.gms:play-services:5.0.77'
    compile 'com.squareup.retrofit:retrofit:1.6.1'
    compile 'com.squareup.retrofit:retrofit-mock:1.6.1'
    compile 'com.squareup.dagger:dagger:1.2.1'
    compile 'com.squareup.dagger:dagger-compiler:1.2.1'
    compile 'com.squareup.okhttp:okhttp:2.0.0'
    compile 'com.squareup.okhttp:okhttp-urlconnection:2.0.0'
    compile 'com.squareup:tape:1.2.2'
    compile 'com.jakewharton:butterknife:5.1.1'
    compile 'org.apache.commons:commons-lang3:3.3'
    compile 'org.jetbrains:annotations:13.0'
    compile 'com.google.maps.android:android-maps-utils:0.3.1'
}

from android-gradle-template.

nenick avatar nenick commented on August 23, 2024

I don't understand your issue. If you have the same then set java 7 for your development environment and this error should be gone.

from android-gradle-template.

mattkranzler5 avatar mattkranzler5 commented on August 23, 2024

It still errors with Java 7 with the same error.

from android-gradle-template.

nenick avatar nenick commented on August 23, 2024

if you are sure that java 7 is used, then it must be something else.
you use sometimes java 8 or is it installed?
maybe recompile the novoda plugin with java 7?
provide a pull request for a simple library example, so that i can reproduce your issue?

from android-gradle-template.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.