-
Notifications
You must be signed in to change notification settings - Fork 303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG: use gradle:3.6.0-rc01 Didn't find class "androidx.appcompat.R #817
Comments
doesnt look like a objectbox problem? |
I also encountered this problem. How did you solve it? |
Thanks for reporting. Though you missed to mention some important info: This happens when running the app built with Android Gradle Plugin Syncing and building works fine. Though AS asked to install NDK (Side by side) 20.0.5594570 (revision: 20.0.5594570) because the stripDebugDebugSymbols task FAILED for some reason. A clean project without ObjectBox is fine, so this may be an issue with the dependencies or R8 rules of the ObjectBox library. Investigating... |
Turns out that all R classes, including androidx.appcompat.R are stripped when ObjectBox is added. I suspect this has something to do with the new "simplified R class generation". https://developer.android.com/studio/preview/features#simplified-r-class Not sure how to fix this, yet. Or if this is an actual bug. |
I reported this to the Android Studio team as I'm at a loss of what we are (or not?) doing wrong here. https://issuetracker.google.com/147968317 Edit: Please star it if you are affected. |
Hey there, I work on AGP on the resources pipeline. Looking at the bug and the linked issue, it does sound like a bug in the objectbox caused by the recent changes in AGP. In 3.6 the change that could be affecting the objectbox is the compile classpath R class flow. Previously we used to re-generate an R class for each dependency at every single module. This meant that if you had App -> Lib A -> Lib B -> AAR, in Lib B we'd generate 2 R classes, in Lib A 3 R classes and in app 4 R classes... And as projects have multiple remote AAR dependencies and often dozens of local modules, this wasn't ideal. In 3.6 we started generating an R class per module and per AAR, and re-using them whenever possible (in libraries). That reduced the number of R classes from n^2 to linear. We still have to re-generate all R classes only at app level, since they need to use final resource IDs (in libraries they were non-final and mock values). To re-use these R classes we add them to the compile classpath, and this is why previously R classes would be visible to all consumers transitively, but now they're only visible (at compile time) to consumers that have direct dependency on that module/AAR or the dependencies are "api" (transitive) and not "implementation". Another change is that we generate the R classes bytecode directly (skipping R.java completely), but it is unlikely to be related to this issue. I'm not sure what the objectbox does that could have been affected by this change, especially since this issue seems to be happening at app module. If you could explain how the flow of classes is affected by objectbox then we can work together to find the cause of this issue. |
@imorlowska Thanks for your response! I initially thought this was due to our Not applying the |
Turns out this is an issue with our But with Android Gradle Plugin 3.6.0 there is now a JAR containing the R classes in Example of the fix: override fun transform(info: TransformInvocation) {
info.inputs.forEach { transformInput ->
// Ensure JARs are copied as well:
transformInput.jarInputs.forEach {
it.file.copyTo(
info.outputProvider.getContentLocation(it.name, inputTypes, scopes, Format.JAR),
overwrite = true
)
}
}
} The wrong implementation was due to the misinterpretation that using an input type of This will be fixed in an upcoming release! Edit: fixed example code. |
Please check with the just released 2.5.1 and let us know if it works for you. Thanks again! |
I was having a similar issue, thank you for pointing me in the right direction |
Windows 10
Android Studio 3.6. RC1
objectboxVersion: 2.5.0
classpath 'com.android.tools.build:gradle:3.6.0-rc01'
The text was updated successfully, but these errors were encountered: