automated tests - Android library assembles with Gradle but "package R does not exist" error raise on connectedCheck -
i have android library file structure below.
android_library ├── libs └── src ├── instrumenttest │ ├── assets │ └── java └── main ├── aidl ├── gen ├── java └── res
when assemble library gradle, task runs successfully. however, when try running connectedcheck following errors r file not being found:
:validatedebugsigning :packagedebug :assembledebug :preparetestdependencies :compiletestaidl :processtesttestmanifest :generatetestbuildconfig :mergetestassets :compiletestrenderscript :mergetestresources :processtestresources :compiletest android_library/src/instrumenttest/java/com/example/library/util/utiltests.java:514: error: package r not exist case r.plurals.time_days_ago: { ^ ... note: recompile -xlint:unchecked details. 18 errors :compiletest failed failure: build failed exception. * went wrong: execution failed task ':compiletest'. > compilation failed; see compiler error output details. * try: run --stacktrace option stack trace. run --info or --debug option more log output. build failed
i thought problem in r resource generation, expect fail when assembling.
edit:
i have tried both having , r import statement (which know incorrect) , not having , r import statement. both result in same error.
solved:
thanks @xav's tip (below): i'm extracting library larger project , attempting build on own modular testing.
changing
import com.example.app.r;
statements in library files
com.example.library.r
allows connected check run.
(apparently res files both main app , library same).
additional notes:
since switch statement takes in r id's switch statement works when compiles. however, still unsure of why gradlew assemble
works incorrect import
statements while gradlew connectedcheck
fails.
while seem unrelated error, see doing switch statement using ids coming r class, in library.
this not possible because ids not final.
i'm wondering if that's error compiler confused , outputs different error message.
Comments
Post a Comment