I am trying to build an app in android studio and I am encountering an error which has only started to come up recently. As far as I am aware I have not changed any settings or amended any system files which would cause the error to happen. I have tried reinstalling android studio but the error is still happening so I am starting to think it is a coding issue. The error is below:
Gradle task[clean, :app:generateDebugSources,:app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :appcompileDebugSources, :app:complieDebugSources, :app: compileDebugAndroidTestSources, :app:compileDebugUnitTestSources]
C:\Users\Stuart\Documents\TourApp\App\src\androidTest\java\com\example\android\tourapp\ExampleInstrumentedTest.java
error: package android.support.test does not exist
error: package android.support.test.runner does not exist
error: package android org.junit does not exist
error: package android org.junit.runner does not exist
error: package android org.junit does not exist
error: cannot find symbol class RunWith
error: cannot find symbol class Test
error: cannot find symbol variable InstrumentationRegistry
Execution failed for task ':app:compileDebugAndroidTestJavaWithJavac'.
Compilation failed; see the compiler error output for details.
Any ideas what could be causing this?
Try adding following lines under dependencies section in app/build.gradle
file
dependencies {
testImplementation 'junit:junit:4.12'
//androidTestCompile 'junit:junit:4.12'
}
Also, you can use androidTestCompile 'junit:junit:4.12'
as an alternate.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With