-
Notifications
You must be signed in to change notification settings - Fork 30
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
java.nio.BufferUnderflowException while trying to run android tests with proguarded build on compileSdkVersion 31 #72
Comments
Also, funny thing, this issue blocks us from using M1 Macbooks. Because there is a bug in Room 2.3 that breaks kapt on M1 Macbooks. It is fixed in Room 2.4. To upgrade to Room 2.4 we need to update our compileSdkVersion to 31. And after we update our compileSdkVersion to 31 Flank breaks because of this here issue. |
Sorry for the delay, I'll look into this this week. Interesting that room 2.4 breaks it, could be some code DTP doesn't understand or just a bad transitive dependency. Hopefully that will be enough to repro and dig in |
@kkoser That's because Room's 2.3 SQLite doesn't support M1 chips. See https://stackoverflow.com/questions/68884589/caused-by-java-lang-exception-no-native-library-is-found-for-os-name-mac-and-o. But this Room issue is not related to this here issue. |
The issue we have is that we can't upgrade to |
@kkoser I'm trying to build and run this, but I'm getting this error when I run assembled parser.jar
It looks like this is connected somehow to JVM versions I use to build or run parser.jar. Do you have any quick hint how to get around this? |
Alright, managed to get around this by doing this
|
Can't reproduce this locally without using Flank. Which JDK do you use for building this project? |
Did some investigation today. Removed all the tests from the app. Still got the error. Kept removing code from the androidTest source set. Managed to find out that the cause of the error is withing our Dagger setup. Removing our Dagger setup stops the error from occurring. It will be hard to find the cause of error by bisecting our Dagger setup. Because in Dagger setups everything is interconnected. Next thing I plan to do is to build Flank locally and to try to run it and reproduce the issue with debugger turned on. |
Keep us posted @dmitry-ryadnenko-izettle. I did sanity check that the dex-test-parser tests pass with a vanilla build of 7.1.2, compileSdkVersion 31, and R8 enabled. I'm interested to hear what in the Dagger setup is causing this. |
Alright. So I managed to figure out that the exception (trying to read beyond buffer's limits, @ClassTokenAnnotation(
favoriteClasses = {String.class, int.class, void.class, int[].class, Object[][][].class})
public interface SimplerInterface {
int myField = 1;
} Where public @interface ClassTokenAnnotation {
Class<?>[] favoriteClasses();
} I'm not sure though that these class definitions are 100% the same as in my code. I found class names while debugging the code. And then I searched for these classes and found them on GitHub here. And after a short investigation I still have no idea how these classes ended up in our dex files. Through some dependencies of course, but it's hard to say through which ones. Probably some Dagger stuff. Can you help me with the investigation from this point? It's hard for me to continue the investigation myself because it's hard to navigate through all this byte buffer logic, and I just not familiar enough with the domain to understand what's going on. |
I think I have a fix. Please check the PR above. |
Thanks for the detailed investigation, will take a look at the PR. It's interesting that those classes from Assuming you are using Gradle, if you don't expect that they should be there, you can run |
classAnnotationsOff can be 0 according to this. Missing this check causes the crash in #72. class_annotations_off offset from the start of the file to the annotations made directly on the class, or 0 if the class has no direct annotations. The offset, if non-zero, should be to a location in the data section. The format of the data is specified by "annotation_set_item" below.
Thanks for fixing! Fixed by #73 |
The same as #70.
Reproduced with AGP 7.0.4, 7.1.1. When compileSdkVersion is set to 31. Everything works great when compileSdkVersion is 30.
R8 version is 3.1.51 (AGP 7.1.1 one).
This blocks us from upgrading a lot of dependencies, including upgrading Kotlin to the latest version.
We run Flank using Java 11.
The text was updated successfully, but these errors were encountered: