Reputation: 3434
We have three BuildVariants: release
, debug
and develop
. The first are the defaults from AndroidStudio
. The last is for our internal testing. Here are the configs: (There is nothing different than Signing Config
)
We have imports the following in our build.gradle
:
dependencies {
// App dependencies
compile 'com.android.support:support-annotations:22.0.0'
compile 'com.google.guava:guava:18.0'
// Testing-only dependencies
androidTestCompile 'com.android.support.test:runner:0.2'
androidTestCompile 'com.android.support.test:rules:0.2'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.1'
}
Now we've created the androidTest/
folder (where the Espresso-Tests are located). I've looked at the example from the Android-Testing Samples in GitHub.
But AndoridStudio says always "Cannot find Symbole" for AndroidJUnit4.class:
(And now, after a lot of explanation - sorry for that :D)
I found the issue. Our Build Variants was set on Android Instrumented Tests
(which is ok) but the App-Module was on the develop
BuildVariant
. When we have changed it to debug
all was fine.
Now I'm not sure if this a bug or is this normal?! Because we have no different - instead of the Singing Config (but I've tested it, it isn't the problem) - on the BuildVariants. And when it's normal, why?!
Edit:
I've created a AOSP-Ticket too: https://code.google.com/p/android/issues/detail?id=172029
Upvotes: 2
Views: 993
Reputation: 2791
Please see my update on the bug. In short, you need this line:
android {
testBuildType "develop"
}
Upvotes: 2