Fixed
Status Update
Comments
xa...@google.com <xa...@google.com>
je...@google.com <je...@google.com>
im...@google.com <im...@google.com> #2
Hi there, thank you for reporting the issue.
I verified that the R class is being generated, the issue is that in the build.gradle a custom package was declared using "testApplicationId 'com.trello.myapplication.tests'". Normally this should work, but for some reason, this made the R class disappear from the classpath (even though it was still generated).
If you remove the custom package for android test (above), the default package will be "com.trello.myapplication.test" (note the singular "test" not "tests"), and if you update the Java/Kotlin code to reference this R class, the tests are passing correctly.
I verified that the R class is being generated, the issue is that in the build.gradle a custom package was declared using "testApplicationId 'com.trello.myapplication.tests'". Normally this should work, but for some reason, this made the R class disappear from the classpath (even though it was still generated).
If you remove the custom package for android test (above), the default package will be "com.trello.myapplication.test" (note the singular "test" not "tests"), and if you update the Java/Kotlin code to reference this R class, the tests are passing correctly.
da...@gmail.com <da...@gmail.com> #3
Is this going to be fixed, or should we just change the test application ID to match convention?
da...@gmail.com <da...@gmail.com> #4
Oh, also, worth noting that I tried the workaround and it does work now.
an...@google.com <an...@google.com> #5
The following changes were cherrypicked through
Release Track:
Changes: ag/12398171
an...@google.com <an...@google.com> #6
The following changes were cherrypicked through
Release Track:
Changes: ag/12398171
im...@google.com <im...@google.com> #7
This (and the related issue https://issuetracker.google.com/164163031 ) have been fixed and will be released in the next AGP release (4.2.0-alpha10), and have also been cherry picked into 4.1
po...@gmail.com <po...@gmail.com>
lj...@gmail.com <lj...@gmail.com> #9 Restricted+
Restricted+
Comment has been deleted.
Description
In AGP 4.1, tests can no longer access their own R files.
See attached project for repro. When built using AGP 4.0.1,
./gradlew connectedCheck
runs fine. But if you upgrade to AGP 4.1.0-beta05, you get this compiler error:Build: AI-201.8538.31.41.6692364, 202007191539,
AI-201.8538.31.41.6692364, JRE 1.8.0_242-release-1644-b3-6222593x64 JetBrains s.r.o, OS Mac OS X(x86_64) v10.15.6, screens 2560x1440
AS: 4.1 Beta 5; Kotlin plugin: 1.3.72-release-Studio4.1-5; Android Gradle Plugin: 4.1.0-beta05; Gradle: 6.5; NDK: from local.properties: (not specified), latest from SDK: (not found); LLDB: pinned revision 3.1 not found, latest from SDK: (package not found); CMake: from local.properties: (not specified), latest from SDK: (not found), from PATH: 3.17.3