question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Gradle using Java 8 - Any gradle build script error returns as a StreamCorruptedException with no useful content instead of the actual gradle exception

See original GitHub issue

When using Gradle with java.configuration.runtimes set to a JavaSE-1.8 JVM, any problems in a build.gradle script will come up with a java.io.StreamCorruptedException instead of the actual exception.

This can be very painful to debug, because it might happen that when executing gradle manually via command line, you might find that the build itself will go through with one of the default targets, but if one of the sub projects is executed it will throw an error.

Environment
  • Operating System: Centos 7
  • JDK version: 1.8.0b252
  • Visual Studio Code version: 1.48.1
  • Java extension version: 0.65.0
Steps To Reproduce
  1. Write a gradle script with any sort of gradle parsing error
  2. See problems menu that only describes the error as
java.io.StreamCorruptedException: invalid type code: 00
invalid type code: 00

Example script:

this is just random text in a build.gradle
Current Result

Returns blank exception

Expected Result
  • What went wrong: Could not compile build file ‘build.gradle’.

startup failed: build file ‘build.gradle’: 1: unexpected token: in @ line 1, column 26. this is just random text in a build.gradle

Additional Informations

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:16 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
snjezacommented, Oct 12, 2020

Ok I see now. Invalid build.gradle errors don’t bubble up as diagnostics. Buildship reports it properly, so we must be something wrong:

I can’t reproduce the issue. @fbricon @jakegt1 Could you attach a project example?

gradle

0reactions
jakegt1commented, Jul 14, 2022

@CsCherrYY Can verify this now works - Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Building with gradle fails log shows java.io ...
properties file and IJ log shows "java.io.StreamCorruptedException: invalid type code: 00" indicating some kind of JVM mismatch. Using the ...
Read more >
Gradle error: could not execute build using gradle distribution
I had the same issue, can't say I know what caused it, but I just closed Android Studio, renamed the c:\users\MY USERNAME\.gradle directory ......
Read more >
Gradle reports java.io.StreamCorruptedException and freezes ...
I am getting the dreaded java.io.StreamCorruptedException when running Gradle tests. I understand that this happens if you System.exit() in your tests but ...
Read more >
Consolidated JDK 8 Release Notes - Oracle
This page contains all of the release notes for General Availability (GA) releases and Bundled Patch Release (BPR) builds of JDK 8.
Read more >
How to Fix java.io.StreamCorruptedException: invalid type ...
StreamCorruptedException : invalid type code in Java? ... using serialization, writing the file will be done successfully without any error.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found