In Android Studio I put some drawables that my test need to run in the res folder of the androidTest folder like this:
app/src/androidTest/res/drawable/image.png
I can see the new added drawables marked as drawable/image.png (androidTest) inside Android Studio. But when I try to access the drawable using R.drawable.image can't be found.
Bitmap bm = BitmapFactory.decodeResource(getInstrumentation().getContext().getResources(), R.drawable.image);
Is like the R.drawable of the test its not generated.
How can I access this drawable or do to be generated in R.drawable?
SOLVED: When I compile again the test.R.drawable was generated and I can access correctly. I think something it's not refreshed the first time I did. Now is working OK.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.