Note that there are some explanatory texts on larger screens.

plurals
  1. POCode suggestion in src/test is not working in Android Studio
    primarykey
    data
    text
    <p>I am using Android Studio 0.3.5, and I am having an issue where code suggestion in <code>src/test</code> directly is not working.</p> <p>Whenever I type classes of Robolectric, mockito, or JUnit in any of the files in <code>src/test</code>, it does not give me a code suggestion like it does in <code>src/main</code> directory. In <code>src/main</code>, when I type a name of class that is not included in <code>import</code>, it not only gives me code suggestion, but it also auto add the selected class in <code>import</code> if missing.</p> <p>Is there any way I can enable the functionality in <code>src/test</code>?</p> <p>I am using Android Studio 0.3.5 and here is the my <code>build.gradle</code>:</p> <pre><code>buildscript { repositories { mavenCentral() maven { url "https://oss.sonatype.org/content/repositories/snapshots" } } dependencies { classpath 'com.android.tools.build:gradle:0.6.+' } } apply plugin: 'android' repositories { mavenCentral() } android { compileSdkVersion 19 buildToolsVersion "19" defaultConfig { minSdkVersion 14 targetSdkVersion 19 } buildTypes { debug { packageNameSuffix ".debug" } } } sourceSets { unitTest { java.srcDir file('src/test/java') resources.srcDir file('src/test/resources') } } configurations { unitTestCompile.extendsFrom runtime unitTestRuntime.extendsFrom unitTestCompile } dependencies { compile 'org.roboguice:roboguice:2.0' compile 'com.loopj.android:android-async-http:1.4.4' compile 'com.squareup.retrofit:retrofit:1.2.2' compile 'com.squareup.okhttp:okhttp:1.2.1' unitTestCompile 'org.roboguice:roboguice:2.0' unitTestCompile 'com.loopj.android:android-async-http:1.4.4' unitTestCompile 'org.roboguice:roboguice:2.0' unitTestCompile 'org.mockito:mockito-all:1.9.0' unitTestCompile 'junit:junit:4.10' unitTestCompile 'com.google.android:android:4.0.1.2' unitTestCompile 'org.robolectric:robolectric:2.2' unitTestCompile 'com.squareup.retrofit:retrofit:1.2.2' unitTestCompile 'com.squareup.okhttp:okhttp:1.2.1' unitTestCompile files("$project.buildDir/classes/release") } task unitTest(type:Test, dependsOn: assemble) { description = "run unit tests" testClassesDir = project.sourceSets.unitTest.output.classesDir classpath = project.sourceSets.unitTest.runtimeClasspath } check.dependsOn unitTest </code></pre> <p>and here is the structure of the project</p> <pre><code>. ├── example.iml ├── build.gradle ├── local.properties ├── src │   ├── instrumentTest │   │   └── java │   │   └── com │   │   └──example │   │   └──demo │   │   └── test │   │   └── MainActivityTest.java │   ├── main │   │   ├── java │   │   │   └── com │   │   │   └──example │   │   │   └──demo │   │   │   ... │   └── test │   ├── java │   │   └── com │   │   └──example │   │   └──demo │   │   ├── ui │   │   │   ├── PreferencesActivityTest.java │   │   │... </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload