Comments (6)
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.
Ok, works like a charm, thanks a lot!
from android-gradle-template.
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.
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.
It still errors with Java 7 with the same error.
from android-gradle-template.
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)
- Project Structure Question HOT 1
- When using this template, I've faced some problems HOT 3
- jacoco with espresso, task jacocoTestReport skipped HOT 6
- Error Illegal use of non virtual function call HOT 4
- Maybe switch to JCAndKSolutions/android-unit-test
- 'android' or 'android-library' plugin is required HOT 8
- Illegal use of nonvirtual function call HOT 2
- Collect code coverage during manual testing? HOT 2
- Update to latest version of Espresso and Mockito? HOT 3
- Voting: Which is your favourite way to support robolectric? HOT 5
- Can not compile success in the environment Android Studio1.0+ gradle2.2.1+build gradle1.0 HOT 3
- Unexpected top-level exception when running app HOT 2
- Could not find com.novoda:gradle-android-test-plugin:0.10.3. HOT 3
- run-tests.sh needs a simple fix HOT 1
- Android Studio 1.4 Java modules cannot depend on Android modules HOT 2
- FileNotFound Exception HOT 8
- Running / debugging Unit or Component tests in Android Studio HOT 3
- Unable to import project HOT 5
- oops
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from android-gradle-template.