I’ve not used Android Studio in a while and have forgotten more things about it than I ever knew.
I am working with LibGDX and have some complicated class/methods I’d like to do unit testing on them outside of the graphic environment. On a normal android project, I’d have a structure that looks something like:
But when I generate a LibGDX my structure looks like:
When I go to ‘Generate…’ ‘Tests’ by right clicking on the ClassToTest entry in the java file, I receive the message ‘Create test in the same root?’
No, I don’t want that – I want to have a special folder for tests to be contained away from my main code.
How do I create that folder and have the test generator know where it is?? All the answers I could find looked like they were created for a much older version of Android Studio, since the folder hierarchy was different.
In further looking, it appeared I needed to make some changes to my code build.gradle. I tried the changes suggested, but there was no effect that I could see.
The gradle now looks like:
sourceCompatibility = 1.7 [compileJava, compileTestJava]*.options*.encoding = 'UTF-8' sourceSets.main.java.srcDirs = [ "src/" ] sourceSets.test.java.srcDirs = ["test/"] eclipse.project.name = appName + "-core"
Thanks for any insight you can provide. I am sure I am missing something fairly basic.
Source: Android Studio Questions