can someone please help me, I can't get the step definitions to work. I've took a screen shot of the Andoid Studio work place, as i thought it be easier then explaining it all. Basically I want to run the feature file myfeature.feature and when i do i want it to pick up the steps that are defined in the MyStepdef Class. I'm sure it an easy fix but this has not worked for me for a number of days
UPDATE!
I downloaded the skeleton class (as suggested) and even managed to run it in its own android workspace. Tried to implement with my program, using the classes from the skeleton, same feature, same set up but cannot run it.
I tried to create the feature file from scratch, the using android to set the stepdefintions from that feature file and still cannot run it
My thoughts are that I have the gradle set up to run an other automated test, in which i had complication, now I got them perfect with the "solution" i posted [//stackoverflow.com/questions/36968728/android-studio-testing-library-dependencies-that-have-been-compiled-using-java/36975041#36975041]
I have a feeling that the automated test setup that works well with expresso will not run well for the cucumber feature tests.
Anytime I add the jvm (0.5) and delete the exclude statements the old error comes bacK
This is caused by library dependencies that have been compiled using Java 8 or above.
If you are using the 'java' gradle plugin in a library submodule add
targetCompatibility = '1.7'
sourceCompatibility = '1.7'
to that submodule's build.gradle file.
Error:1 error; aborting
:app:transformClassesWithDexForDebugAndroidTest FAILED
Error:Execution failed for task ':app:transformClassesWithDexForDebugAndroidTest'.
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_74\bin\java.exe'' finished with non-zero exit value 1*
Anytime I apply the exclude cucumber-jvm-deps on to a dependecny, I can run the espresso tests but not the cucumber.feature - either it does not recognise steps or if run using the JUnit (as in the skeleton) setup I get a completely new error
"C:\Program Files\Java\jdk1.8.0_91\bin\java" -ea -Didea.launcher.port=7533 "-Didea.launcher.bin.path=C:\Program Files\Android\Android Studio\bin" -Didea.junit.sm_runner -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Android\Android Studio\lib\idea_rt.jar;C:\Program Files\Android\Android Studio\plugins\junit\lib\junit-rt.jar;C:\Users\hbill\AppData\Local\Android\sdk\platforms\android-23\android.jar;C:\Users\hbill\AppData\Local\Android\sdk\platforms\android-23\data\res;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\classes\debug;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\info.cukes\cucumber-html\0.2.3\624a0c986088e32910336dd77aee5191c04a8201\cucumber-html-0.2.3.jar;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support.test\runner\0.5\jars\classes.jar;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support.test\runner\0.5\res;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support.test.espresso\espresso-idling-resource\2.2.2\res;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support.test.espresso\espresso-idling-resource\2.2.2\jars\classes.jar;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\org.hamcrest\hamcrest-library\1.3\4785a3c21320980282f9f33d0d1264a69040538f\hamcrest-library-1.3.jar;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\org.hamcrest\hamcrest-integration\1.3\5de0c73fef18917cd85d0ab70bb23818685e4dfd\hamcrest-integration-1.3.jar;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support\support-v4\23.3.0\jars\classes.jar;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support\support-v4\23.3.0\jars\libs\internal_impl-23.3.0.jar;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support\support-v4\23.3.0\res;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\com.google.code.findbugs\jsr305\2.0.1\516c03b21d50a644d538de0f0369c620989cd8f0\jsr305-2.0.1.jar;C:\Users\hbill\AppData\Local\Android\sdk\extras\android\m2repository\com\android\support\support-annotations\23.3.0\support-annotations-23.3.0.jar;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support\support-vector-drawable\23.3.0\jars\classes.jar;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support\support-vector-drawable\23.3.0\res;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support\animated-vector-drawable\23.3.0\jars\classes.jar;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support\animated-vector-drawable\23.3.0\res;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\info.cukes\gherkin\2.12.2\17138631fa20fd0e44a13e50d6b7be59cee1a94\gherkin-2.12.2.jar;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.3.0\res;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.3.0\jars\classes.jar;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support.test.espresso\espresso-core\2.2.2\res;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support.test.espresso\espresso-core\2.2.2\jars\classes.jar;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support.test\exposed-instrumentation-api-publish\0.5\jars\classes.jar;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support.test\exposed-instrumentation-api-publish\0.5\res;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support.test\rules\0.5\res;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support.test\rules\0.5\jars\classes.jar;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\javax.annotation\javax.annotation-api\1.2\479c1e06db31c432330183f5cae684163f186146\javax.annotation-api-1.2.jar;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\javax.inject\javax.inject\1\6975da39a7040257bd51d21a231b76c915872d38\javax.inject-1.jar;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\info.cukes\cucumber-core\1.2.4\72790b1da44d8d3d2764c6aef29865ee228bbeb1\cucumber-core-1.2.4.jar;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\com.google.guava\guava\17.0\9c6ef172e8de35fd8d4d8783e4821e57cdef7445\guava-17.0.jar;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\info.cukes\cucumber-junit\1.2.4\8a57b68486cff4da4f10019cb9c62c597a6d2861\cucumber-junit-1.2.4.jar;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\info.cukes\cucumber-android\1.2.4\cf6fd6b0de808c6b28bf8e9d22f6572a180930a3\cucumber-android-1.2.4.jar;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\com.squareup\javawriter\2.1.1\67ff45d9ae02e583d0f9b3432a5ebbe05c30c966\javawriter-2.1.1.jar;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\org.hamcrest\hamcrest-core\1.3\42a25dc3219429f0e5d060061f71acb49bf010a0\hamcrest-core-1.3.jar;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\info.cukes\cucumber-java\1.2.4\57cca534b7abe43f6dd7624b90d3d97d33d3023d\cucumber-java-1.2.4.jar;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\junit\junit\4.12\2973d150c0dc1fefe998f834810d68f278ea58ec\junit-4.12.jar;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\info.cukes\cucumber-jvm-deps\1.0.3\cccdeff234db8b12e91ae2529812f1240b4d5603\cucumber-jvm-deps-1.0.3.jar" com.intellij.rt.execution.application.AppMain com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 boo.thefoodhunt.RunCukesTest
!!! JUnit version 3.8 or later expected:
java.lang.RuntimeException: Stub!
at junit.runner.BaseTestRunner.<init>(BaseTestRunner.java:5)
at junit.textui.TestRunner.<init>(TestRunner.java:54)
at junit.textui.TestRunner.<init>(TestRunner.java:48)
at junit.textui.TestRunner.<init>(TestRunner.java:41)
at com.intellij.rt.execution.junit.JUnitStarter.junitVersionChecks(JUnitStarter.java:205)
at com.intellij.rt.execution.junit.JUnitStarter.canWorkWithJUnitVersion(JUnitStarter.java:188)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:65)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Process finished with exit code -3
Now i hate to be defeated, but I think im just going to have to leave it and go around it somehow (even though its for testing coursework :/) because this has took so much out of my time, and eating in to my revision.
I have took the screen shots of my settings (in case of quick fix, silly mistake)
JUnit - Run Setup
Cucumber Feature Setup
TBH the suggestion below regarding the CLI, I'm not sure what is meant as this is the first time I tried to setup a testing enviroment, I understand it to be the set as a type of Main activity for the test to be ran? , but i do not know how to set it any other way.
The grade build dependcies :
compile 'com.android.support:appcompat-v7:23.3.0'
androidTestCompile('info.cukes:cucumber-java:1.2.4') {
exclude module: 'cucumber-jvm-deps'
}
androidTestCompile('info.cukes:cucumber-junit:1.2.4') {
exclude module: 'cucumber-jvm-deps'
}
androidTestCompile('info.cukes:cucumber-core:1.2.4') {
exclude module: 'cucumber-jvm-deps'
}
androidTestCompile 'junit:junit:4.12'
compile 'com.android.support:support-annotations:23.3.0'
compile 'com.google.guava:guava:17.0'
androidTestCompile 'com.android.support:support-annotations:23.3.0'
compile 'info.cukes:gherkin:2.12.2'
// androidTestCompile 'com.android.support.test:runner:0.4.1'
androidTestCompile('info.cukes:cucumber-android:1.2.4') {
exclude module: 'cucumber-jvm-deps'
}
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
androidTestCompile 'info.cukes:cucumber-jvm:1.2.4'
androidTestCompile('info.cukes:cucumber-html:0.2.3') {
exclude module: 'cucumber-jvm-deps'
}
compile 'info.cukes:cucumber-jvm-deps:1.0.3'
The message you see is that the steps are undefined but have implemented the stubs.
This tells me that the place you have implemented the stubs are not in the correct part of the classpath. There is probably something wrong with your glue.
You want the steps to be in the same package, or a sub-package, as the test runner. That is the class where you invoke the Cucumber runner.
I would consider adding a JUnit class annotated as in the https://github.com/cucumber/cucumber-java-skeleton to run Cucumber.
#RunWith(Cucumber.class)
public class RunCukesTest {
}
Note that this class has to be in the test classpath.
This is different from your current approach where you are using the CLI to invoke Cucumber.
Related
Groovy version: 2.5.1
Java version: 10.0.2
Trying to launch the groovyConsole I get the following:
$ groovyConsole
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v7.Java7$1 (file:/usr/local/opt/groovy/libexec/lib/groovy-2.5.1.jar) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int)
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.vmplugin.v7.Java7$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:114)
at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:136)
Caused by: java.lang.NoClassDefFoundError: Unable to load class org.apache.groovy.jaxb.extensions.JaxbExtensions due to missing dependency javax/xml/bind/Unmarshaller
at org.codehaus.groovy.vmplugin.v5.Java5.configureClassNode(Java5.java:407)
at org.codehaus.groovy.ast.ClassNode.lazyClassInit(ClassNode.java:280)
at org.codehaus.groovy.ast.ClassNode.getMethods(ClassNode.java:400)
at org.codehaus.groovy.macro.transform.MacroMethodsCache.scanExtClasses(MacroMethodsCache.java:88)
at org.codehaus.groovy.macro.transform.MacroMethodsCache.access$000(MacroMethodsCache.java:45)
at org.codehaus.groovy.macro.transform.MacroMethodsCache$2.onModule(MacroMethodsCache.java:69)
at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanExtensionModuleFromProperties(ExtensionModuleScanner.java:87)
at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanExtensionModuleFromMetaInf(ExtensionModuleScanner.java:81)
at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanClasspathModulesFrom(ExtensionModuleScanner.java:63)
at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanClasspathModules(ExtensionModuleScanner.java:54)
at org.codehaus.groovy.macro.transform.MacroMethodsCache.getMacroMethodsFromClassLoader(MacroMethodsCache.java:76)
at org.codehaus.groovy.macro.transform.MacroMethodsCache$1.provide(MacroMethodsCache.java:53)
at org.codehaus.groovy.macro.transform.MacroMethodsCache$1.provide(MacroMethodsCache.java:50)
at org.codehaus.groovy.runtime.memoize.ConcurrentCommonCache.getAndPut(ConcurrentCommonCache.java:147)
at org.codehaus.groovy.runtime.memoize.ConcurrentCommonCache.getAndPut(ConcurrentCommonCache.java:123)
at org.codehaus.groovy.macro.transform.MacroMethodsCache.get(MacroMethodsCache.java:50)
at org.codehaus.groovy.macro.transform.MacroCallTransformingVisitor.findMacroMethods(MacroCallTransformingVisitor.java:118)
at org.codehaus.groovy.macro.transform.MacroCallTransformingVisitor.visitMethodCallExpression(MacroCallTransformingVisitor.java:89)
at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:70)
at org.codehaus.groovy.ast.CodeVisitorSupport.visitExpressionStatement(CodeVisitorSupport.java:122)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitExpressionStatement(ClassCodeVisitorSupport.java:197)
at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42)
plus more.......................................
Also got the same issue when using java 11.0.2 and groovy 2.5.5 in IntelliJ.
Found this post that helps! https://www.logicbig.com/tutorials/misc/groovy/intellij.html
Basically have to add JAXB dependencies
Also you have to add JAXB dependencies if you are using Groovy 2.5.3 + Java 11 (also check out Java 11 related change). Groovy comes with extra JAXB Jars so we can add them. Open 'Project Structure' dialog, then select 'Dependencies' tab and add the dependencies as shown
Three suggestions are in the release notes for 2.5.1:
http://groovy-lang.org/releasenotes/groovy-2.5.html#Groovy2.5releasenotes-Addendum251
In 2.5.2, probably a week or two away, you won't need to do them - grab the snapshot version from the CI server if you want to try it out now.
I've also got this when I debugged some my groovy scripts with groovy 2.5.4 and java 10.
Setting JAVA_OPTS=--add-modules java.xml.bind solved the mentioned problem for me.
I was able to solve this by adding the jaxb module to my gradle file. I like this solution because it changes your project configuration file instead of going into the IDE settings.
dependencies {
implementation group: 'org.codehaus.groovy', name: 'groovy-all', version: '3.0.1'
implementation group: 'org.codehaus.groovy', name: 'groovy-jaxb', version: '3.0.1'
}
In case someone has had the same problem and other solutions didn't help, here what helped me:
Added "jaxb" dependency to my project.
Go to Run -> Edit configurations -> Templates -> Gradle -> In Gradle Project choose your own application.
Could anyone help me out with the following error. When i clean the project, it doesn't show any error but every time i try to run i get this message.
Error:Execution failed for task ':app:dexDebug'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_45\bin\java.exe'' finished with non-zero exit value 2
The application was running with no errors but as my system crashed and restarted android studio i had few updates for Android API 22. After the update the application keep giving me this error message. I downloaded JDK 8 and tried to run but didn't work. Later i downgraded to JDK 7 after this stack post but still has not fixed it.
Is it possible to use Java 8 for Android development?
I have looked through numerous similar question but none works for me. Some similar issues found on stack were
why java.exe exit with value 1 in android studio
Error:Execution failed for task ':app:dexDebug'. > comcommand finished with non-zero exit value 2
Java finished with non-zero exit value 2 - Android Gradle
java.exe finished with non-zero exit value 2
Process 'command' C: \ Program Files \ Java \ jdk1.8.0_31 \ bin \ java.exe '' finished with a non -zero exit value 2
I have looked through dependencies in gradle built to see if there were any conflict but found none.
I even tried to copy the code into a new project and run it but still no success. Anyone who has faced the same issue and solved it please help me out.
After days of trying out finally could fix the issue. The problem with one of my .jar files. I had to remove each jar and check one by one until i found it. I removed the .jar file and cleaned my project and ran successfully. If any one should face similar issue check your jar file one by one.
I had the same error
app:dexDebug ExecException finished with non-zero exit value 2
i solve it by adding this line of code
defaultConfig {
multiDexEnabled true
}
The reason is that i was using too many libraries
Hope this post will help anyone
I had the same problem when I compiled google play services to my dependencies.
My mistake was I was compiling the enitre package like this
compile 'com.google.android.gms:play-services:8.3.0'
Instead when I tried the selective compile, it worked.In my case I was using for google sign in,so it had just had to be
compile 'com.google.android.gms:play-services-auth:8.3.0'.
More details are in the documentaion. https://developers.google.com/android/guides/setup#split
Hope this will be of a little help to someone someday :)
I know it's late.
But that's what actually worked for me.
1. Build > Clean Project
2. Close gradle daemon processes (ps -e| grep gradle //this will list gradle processes)
3. File > Invalidate caches & Restart
I hope this will work for everyone.
For future readers. If you're using your own AARs and upgraded one that has a shared dependency, you can also just try cleaning the project. In Android Studio "Build" -> "Clean Project".
This solved the issue for me, so I'd recommend giving it a quick try before you start digging for dependencies.
For me the solution was to remove an unnecessary/duplicate dependency entries. This is a similar solution others offered here that makes sense, but not exactly the same solution as those offered by others.
Since I was already including *.jar files in the list of files to be compiled, there was no need for additional entries in the dependencies list.
Before:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.parse.bolts:bolts-android:1.+'
compile fileTree(dir: 'libs', include: 'Parse-*.jar')
}
After:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
}
Remove
compile 'com.parse:parse-android:1.+'
add this linecompile fileTree(dir: 'libs', include: ['Parse-*.jar'])
Finally, it will look like this
dependencies {
compile fileTree(dir: 'libs', include: ['Parse-*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.facebook.android:facebook-android-sdk:4.5.0'
compile 'com.android.support:design:22.2.0'
compile 'com.parse.bolts:bolts-android:1.+'
}
I had the same problem, just i did Biuld--> Rebiuld project and it works again ;)
I was using the robolectric dependency in my android project. I removed all robolectric dependencies in gradle and deleted all my robolectric tests, then I built the app and finally I could run the android project. Hope this can work for us.
I faced the same problem when trying to add the SignalR Java client library to my project's dependencies. I first changed the target JDK of my app from 1.8.0_XX to 1.7.0_XX, but it didn't work. Then I changed the SignalR project to target 1.7.0_XX as well, rebuilt and added it to my project's libs folder instead of the first build (which was in 1.8.0_XX), and that miraculously worked.
For me, the problem was that I was using different versions of "Google Play services sub API's"
Before:
Click to see the image
After:
Click to see the image
Check if there are 2 classes with same name. Each class name should be unique.
maybe for this issue you got means you added same liberay file in more than one time
I am trying to run ./gradlew in jhipster project and getting next error with ':bower' task:
:cleanResources
:bootBuildInfo
:bower FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':bower'.
> A problem occurred starting process 'command 'bower''
.......
Caused by: net.rubygrapefruit.platform.NativeException: Could not start 'bower'
at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:27)
at net.rubygrapefruit.platform.internal.WrapperProcessLauncher.start(WrapperProcessLauncher.java:36)
at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:68)
... 2 more
Caused by: java.io.IOException: Cannot run program "bower" (in directory "/Users/vovkvlad/coding/learning/Java/jHipProj"): error=2, No such file or directory
at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:25)
... 4 more
I have seen similar problems on stackoverflow:
Running JHipster Gradle task from Intellij IDEA
jhipster - error executing task :bower
But first link complains only about failure in IntelliJ (and in my case the same error occurs in the terminal)
And second link gives pretty strange answer with removing node which seems strange to me, and may be not applicable since 2 years have past.
So, do anyone have a key to what am I doing wrong?
I will be grateful for any kind of help/hint.
Thanks in advance for help!
EDIT: I have bower installed globally, so that it can be found under one of the paths in $PATH. And bower is recognized from the terminal.
I was having this same issue. I was able to fix it by stopping the gradle daemon using ./gradlew --stop. Here is a link to a post where I found the solution.
i got the same issue, and fixed it with command below.
gradle --stop
In my case, i use Eclipse with Buildship plugin, it starts a Grade Daemon to build project by itself, and the classpath of NodeJS & Bower is difference when running application in terminal.
Weird bug with Android Studio 2.2 when running a single test directly in IDE - I'll either have "No tests found" or run my previously compiled test.
Example:
#Test
fun testyTest() {
}
I'll create this test, and get the "No tests found". So I restart, and test is found! Obviously, the above test passes because it's empty. Next, I want my test to fail. So I manually throw an exception and add one line of code, below.
#Test
fun testyTest() {
throw RuntimeException()
}
Now I recompile, and this test passes too, because IntelliJ is for some reason has cached the previous test and reruns that. To get this test to properly fail - I must restart the IDE.
Anyone know what's going on? Note - I'm using Kotlin pretty heavily in this project.
EDIT 2: This is a JVM test (non-android, src/test/java) in an android library project.
EDIT: here's a full test class
package com.example.zak
import org.junit.Before
import org.junit.Test
class ExampleTest {
#Before
fun setUp() {
}
#Test
fun testyTest() {
//throw RuntimeException()
}
}
Found the fix...the issue only occurs when there's a variant selection conflict. Removing the conflict fixed the issue.
Check if you're have all these dependencies:
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
testCompile 'junit:junit:4.11'
testCompile "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
}
Also as you're using Kotlin please disable entirely Instant Run in File -> Preferences.
EDIT: You're talking about tests in library - do modules and project has these dependencies and proper configuration.
It looks like after Gradle rebuilding, test works fine.
I found this bug description in the JetBrains IntelliJ bug tracking system. Here is the URL:
https://youtrack.jetbrains.com/issue/IDEA-149275
It discusses a change that was made to classloading that may impact Junit test execution. A workaround is suggested by adding a line to the options.xml config file. Here is an example workaround for Windows boxes - change as necessary for your platform. The version of Android below is the current 2.2 release:
1) exit Android studio
2) navigate to the config/options directory for your Android version:
e.g. C:\Users\YourNameHere\.AndroidStudio2.2\config\options
3) then add the "<property name="idea.dynamic.classpath.jar" value="false" />" line inside the component block of the options.xml file:
<component name="PropertiesComponent">
<property name="idea.dynamic.classpath.jar" value="false" />
Start Android Studio and try running local Junit tests.
I guess you use gradle in your project? I had the exact same problem and the solution was to use gradle to execute tests (inside the gradle task list) instead of using the menu (right click on the test file and run tests).
I use AS 0.4.2 then imported GMS as described in doc:
https://developer.android.com/google/play-services/setup.html
dependencies {
compile 'com.android.support:support-v4:19.0.0'
compile 'com.android.support:appcompat-v7:+'
compile 'com.android.support:support-v13:13.0.+'
compile 'com.google.android.gms:play-services:4.0.30' }
all what is detected by IDE is R class, but rest of code is invisible.
On the other hand I put following code:
import com.google.android.gms.common.GooglePlayServicesUtil;
(...)
private void connectGms(){
Log.d(MbcConstants.TAG,
"check for gms"+ GooglePlayServicesUtil.
isGooglePlayServicesAvailable(this));
}
And it works, but IDE still shows class name in red, but properly shows the params and returned type for method.
Ok - it seems like a bug in Android studio.
What I've done do fix it:
remove all dependencies (use F4 key) from project and the module
delete files from projectroot/.idea/libraries
open the module gradle.buld
add back all dependencies that are needed by your project to work. In my case:
dependencies {
compile 'com.android.support:support-v4:19.0.0'
compile 'com.android.support:appcompat-v7:19.0.0'
compile 'com.google.android.gms:play-services:4.0.30'
}
Synchronize gradle.build once again
Continue your adventure of love and hate or return to eclipse.
All you needed to do was hit the Sync Project with Gradle Files button after editing the build.gradle file by hand.