I am trying to write some instrumented tests in th...
# multiplatform
j
I am trying to write some instrumented tests in the
androidInstrumentedTest
sourceset. I’m also trying to add resource files (drawable) to be accessed in the test, but the generated R class doesn’t contain the drawable. Folder layout:
Copy code
:some-library
   - src
     - androidInstrumentedTest
        - kotlin
          - MyTest.kt
        - res
          - drawable-nodpi
             - photo.jpg
I’m assuming there is something I need to add to my
build.gradle.kts
but I just can’t figure it out.
e
what version of Kotlin? the default layout and the way it interacts with AGP has changed over releases
j
kotlin 1.9.10 and AGP 8.1.1
e
hmm I'd expect that to work by default. what happens if you put resources where the AGP used to pick them up from,
some-library/src/androidTest/res/drawable-nodpi/photo.jpg
?
j
Hrmm doesn’t seem to work either
e
oh btw, you are aware that the test manifest has a different package name than main, right? (and so the R class is in a different package as well)
the defaults around that also changed around AGP 8 IIRC
e.g. if you use
my.package.R
in androidMain, see if
my.package.test.R
works in androidInstrumentedTest
j
🤦‍♂️
That was it!
Thanks for your help 👍