Do you have VS Code set to auto compile Java? I found this to be the issue for me as it was compiling to a higher version of Java than the Mendix application expects. To fix it, just turn off auto compile and let Mendix do that for you when you build the application.
Hi Moritz,
Please see the comment thread under the accepted answer here: https://forum.mendix.com/link/questions/112889.
You should use Eclipse instead of VS Code for Java development with Mendix.