"error: cannot find symbol" When using dep android library resource.
Created by: sean-kenny
It seems that we are not able to access a dependent android library resource from within another android library.
In this scenario we have two android libraries in the libs
folder:
lib1
lib2
lib1
depends on lib2
for a resource, which it accesses directly via R. For example (excerpt from this file)
// lib_two_value comes from lib2 but is available via R in lib1 when using gradle
context.getString(R.string.lib_two_value)
When accessing a lib2
resource like this and running buck build //libs/lib1:lib
, we get the following output:
> buck build //libs/lib1:lib
[-] PROCESSING BUCK FILES...FINISHED 0.2s [100%]
[+] DOWNLOADING... (0.00 B/S, TOTAL: 0.00 B, 0 Artifacts)
[+] BUILDING...1.0s [50%] (4/5 JOBS, 0 UPDATED, 0.0% CACHE MISS)
|=> //libs/lib1:lib... 0.5s (running javac[0.4s])
|=> IDLE
|=> IDLE
|=> IDLE
|=> IDLE
/Users/seank/repo/buck-tests/BuckScenarioLibraryResourceMerging/libs/lib1/src/main/java/com/buckbuild/scenario/lib1/subpackage1/LibOneHelper.java:14: error: cannot find symbol
return context.getString(R.string.lib_two_value);
^
symbol: variable lib_two_value
location: class com.buckbuild.scenario.lib1.R.string
Errors: 1. Warnings: 0.
To help as much as possible, I've created a test buck scenario with additional documentation on the problem here
Perhaps our buck configuration is not correct, or maybe buck does not provide the same lib1 -> lib2 resource merging as Gradle like we would normally expect.