I have a Gradle project with the following structure:
project/
src/
androidTest/
java/
main/
java/
res/
AndroidManifest.xml
build.gradle
Now I want to add a unit test which uses a resource (either "raw" or "asset").
I put my resource into project/androidTest/assets/test_file
and access it with getContext().getResources().getAssets().open("test_file");
(in an AndroidTestCase
).
However, this gives me a FileNotFoundException
. How can I fix this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…