Status Update
Comments
an...@google.com <an...@google.com> #2
Can you specify how you're adding app/src/androidTest/res/values/strings.xml
? The UI doesn't seem to let you do this; when adding new resource files (even when right-clicking on the androidTest folder), it still drops the files under the standard source location.
You may be able to manually create a strings.xml
file in that location, but I don't think it'll build correctly.
It may be helpful if you could attach an example project that showcases this issue.
ga...@google.com <ga...@google.com> #3
Here is a project that reproduces the issue. Please use F Beta1 to open it and run ExampleInstrumentedTest
. It'll print something like:
01-19 11:42:40.068 7889 7913 I TestRunner: started: useAppContext(com.example.myapplication.ExampleInstrumentedTest)
01-19 11:42:40.074 7889 7913 I System.out: HelloTestApp
01-19 11:42:40.074 7889 7913 I TestRunner: finished: useAppContext(com.example.myapplication.ExampleInstrumentedTest)
WRT adding app/src/androidTest/res/values/strings.xml
, the instrumented test resources are supported by AGP and the platform. Also, do note that we support symbol resolution (com.example.myapplication.test.R.string.test_app_name
resolves).
Sidenote: the fact that UI does not list androidTest source set (it only suggests main
, debug
, relase
) is another bug -
Description
AS: F canary 11 AGP: 8.0.0-alpha11
Create a default project and add:
app/src/androidTest/res/values/strings.xml
with<string name="text_in_test">text in test</string>
app/src/androidTest/java/com/example/test/Repro.kt
add a reference tocom.example.app.test.R.string.text_in_test
Notice that symbol resolution works, but:
text_in_test
inRepro.kt
does not workstrings.xml
looking for usages oftext_in_test
gives 0 results