'Could not initialize class sun.util.calendar.ZoneInfoFile while using Flutter firebase-notifications

I am developing a Flutter app for Android in Visual Studio Code. I am able to debug the app both on an emulator & physical device -- till I try to add the following dependencies for using firebase to my app in respective build.gradle files.

apply plugin: 'com.google.gms.google-services'   // app-level
classpath 'com.google.gms:google-services:3.2.1'  // Google Services plugin - global

I get the following error when I start debugging:

LogListener.logged threw a non-fatal unchecked exception as follows:

java.lang.NoClassDefFoundError: Could not initialize class sun.util.calendar.ZoneInfoFile
    at java.base/sun.util.calendar.ZoneInfo.getTimeZone(ZoneInfo.java:581)
    at java.base/java.util.TimeZone.getTimeZone(TimeZone.java:577)
    at java.base/java.util.TimeZone.setDefaultZone(TimeZone.java:682)
    at java.base/java.util.TimeZone.getDefaultRef(TimeZone.java:653)
    at java.base/java.util.TimeZone.getDefault(TimeZone.java:642)
    at java.base/java.util.Calendar.defaultTimeZone(Calendar.java:1679)
    at java.base/java.util.Calendar.getInstance(Calendar.java:1629)
    at org.eclipse.osgi.internal.log.EquinoxLogWriter.getDate(EquinoxLogWriter.java:411)
    at org.eclipse.osgi.internal.log.EquinoxLogWriter.getSessionTimestamp(EquinoxLogWriter.java:187)
    at org.eclipse.osgi.internal.log.EquinoxLogWriter.writeSession(EquinoxLogWriter.java:202)
    at org.eclipse.osgi.internal.log.EquinoxLogWriter.log(EquinoxLogWriter.java:300)
    at org.eclipse.osgi.internal.log.EquinoxLogWriter.logged(EquinoxLogWriter.java:760)
    at org.eclipse.osgi.internal.log.ExtendedLogReaderServiceFactory.safeLogged(ExtendedLogReaderServiceFactory.java:110)
    at org.eclipse.osgi.internal.log.ExtendedLogReaderServiceFactory.logPrivileged(ExtendedLogReaderServiceFactory.java:253)
    at org.eclipse.osgi.internal.log.ExtendedLogReaderServiceFactory.log(ExtendedLogReaderServiceFactory.java:225)
    at org.eclipse.osgi.internal.log.ExtendedLogServiceFactory.log(ExtendedLogServiceFactory.java:97)
    at org.eclipse.osgi.internal.log.LoggerImpl.log(LoggerImpl.java:88)
    at org.eclipse.osgi.internal.log.LogServiceManager.frameworkEvent(LogServiceManager.java:185)
    at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:997)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234)
    at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:345)
can't open C:\Program Files\Java\jdk-12.0.1\lib\tzmappings.

[Error - 2:36:57 AM] Connection to server got closed. Server will not be restarted.

My JAVA_HOME seems to be okay since I get the following when I do a basic troubleshooting

Java version in command prompt

I couldn't get relevant information on the net when search for this error (at least in the first 9 pages of search engine results)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source