# Getting "unresolved reference" error when the reference can be resolved

**URL:** <https://discuss.gradle.org/t/getting-unresolved-reference-error-when-the-reference-can-be-resolved/38994>\
**Category:** Help/Discuss\
**Created:** [February 10, 2021, 1:20am UTC](https://discuss.gradle.org/t/getting-unresolved-reference-error-when-the-reference-can-be-resolved/38994 "2021-02-10T01:20:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ReneSpies](https://avatars.discourse-cdn.com/v4/letter/r/d2c977/32.png) [@ReneSpies](https://discuss.gradle.org/u/ReneSpies)\
**Post date:** [February 10, 2021, 1:20am UTC](https://discuss.gradle.org/t/getting-unresolved-reference-error-when-the-reference-can-be-resolved/38994/1 "2021-02-10T01:20:21Z")

</div>

I am developing and Android app using Android Studio. While trying to run some JUnit tests for my database, I am getting multiple “unresolved reference” errors:

```gradle
e: C:\Users\Rene\AndroidStudioProjects\count13\app\src\test\java\me\renespies\count13\Count13DatabaseUnitTest.kt: (5, 17): Unresolved reference: test
e: C:\Users\Rene\AndroidStudioProjects\count13\app\src\test\java\me\renespies\count13\Count13DatabaseUnitTest.kt: (6, 17): Unresolved reference: test
e: C:\Users\Rene\AndroidStudioProjects\count13\app\src\test\java\me\renespies\count13\Count13DatabaseUnitTest.kt: (25, 10): Unresolved reference: AndroidJUnit4
e: C:\Users\Rene\AndroidStudioProjects\count13\app\src\test\java\me\renespies\count13\Count13DatabaseUnitTest.kt: (25, 10): An annotation argument must be a compile-time constant
e: C:\Users\Rene\AndroidStudioProjects\count13\app\src\test\java\me\renespies\count13\Count13DatabaseUnitTest.kt: (36, 17): Unresolved reference: ApplicationProvider

```

All dependencies are added and up to date and I can use all references - imports as well as classes - from above errors without any problems.

The first to errors point to two imports

```gradle
import androidx.test.core.app.ApplicationProvider
import androidx.test.ext.junit.runners.AndroidJUnit4

```

which produce no error before building.

And the other two unresolved references, `AndroidJUnit4` and `ApplicationProvider`, are classes I use to test my database, which work fine (also auto completion).

The `annotation argument` error is a byproduct of the “missing” `AndroidJUnit4` reference.

How can this be? If the dependencies were missing, I would not be able to use auto completion, as Android Studio would not know about the classes and their functions, would it? How can I resolve this error and make my tests run?

---

<div class="post-metadata">

**Author:** ![treslines](https://avatars.discourse-cdn.com/v4/letter/t/c68b51/32.png) [@treslines](https://discuss.gradle.org/u/treslines)\
**Post date:** [September 10, 2021, 1:42pm UTC](https://discuss.gradle.org/t/getting-unresolved-reference-error-when-the-reference-can-be-resolved/38994/2 "2021-09-10T13:42:47Z")

</div>

Hi @ReneSpies Did you solve it? i got the same errors! What i did was move my test from the “test” folder to the “AndroidTest” and after that it went just fine. (although in the official google doc it says it should run in “test” too)
