StrictMode related exception got on java.util.zip classpath

Hi guys!

I’m trying to get jme3 to run on iOS using MOE because the engine droped support for it when avian vm was fully discontinued. I thought MOE could be a good replacement for that.

I’ve been reading though the samples and libgdx code to get an idea of how it works (sadly there’s a lack of documentation for MOE or at least I didn’t find it…). After some hours of work I ended up having something that I thought should work but when trying it I’m getting a weird exception:

System 5 A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
System 5 java.lang.Throwable: Explicit termination method ‘end’ not called
at dalvik.system.CloseGuard.open(CloseGuard.java:180)
at java.util.zip.Inflater.(Inflater.java:82)
at java.util.jar.StrictJarFile.getZipInputStream(StrictJarFile.java:198)
at java.util.jar.StrictJarFile.getInputStream(StrictJarFile.java:165)
at libcore.io.ClassPathURLStreamHandler$ClassPathURLConnection.getInputStream(ClassPathURLStreamHandler.java:211)
at java.net.URL.openStream(URL.java:470)
at java.lang.ClassLoader.getResourceAsStream(ClassLoader.java:455)
at java.lang.Class.getResourceAsStream(Class.java:1195)
at com.jme3.system.JmeVersion.(JmeVersion.java:51)
at com.jme3.system.AppSettings.(AppSettings.java:280)
at io.github.joliver82.jmeios.ios.MoeIosJmeAppHarness.(MoeIosJmeAppHarness.java:85)
at java.lang.reflect.Constructor.newInstance(Native Method)
at org.moe.natj.objc.map.ObjCObjectMapper.objectToJava(ObjCObjectMapper.java:414)
at org.moe.natj.objc.map.ObjCObjectMapper.toJava(ObjCObjectMapper.java:508)
at org.moe.natj.general.NatJ.toJava(NatJ.java:1180)
at io.github.joliver82.jmeios.ios.MoeIosJmeAppHarness.alloc(Native Method)
at io.github.joliver82.jmeios.ios.DummyMain.applicationDidFinishLaunchingWithOptions(DummyMain.java:40)
at apple.uikit.c.UIKit.UIApplicationMain(Native Method)
at io.github.joliver82.jmeios.ios.DummyMain.main(DummyMain.java:26)
at java.lang.reflect.Method.invoke(Native Method)
at org.moe.IOSLauncher.main(IOSLauncher.java:34)

The DummyMain is the equivalent to samples’ OpenGLBox Main ( moe-samples-java/OpenGLBox/ios/src/main/java/org/moe/samples/openglbox/ios/Main.java at moe-master · multi-os-engine/moe-samples-java · GitHub ) and MoeIosJmeAppHarness is equivalent to samples’s OpenGLBoxController.java ( moe-samples-java/OpenGLBox/ios/src/main/java/org/moe/samples/openglbox/ios/OpenGLBoxController.java at moe-master · multi-os-engine/moe-samples-java · GitHub ) but adding some wrapper methods to call jme3 stuff instead of directly rendering GL and also jme3 initialization.

I’ve been searching about the “Explicit termination method ‘end’ not called” message and it looks like it’s related to the android dalvik vm StringMode

The JmeVersion class is just running

Properties props;

props.load(JmeVersion.class.getResourceAsStream(“version.properties”));

Is there any way I could disable StrictMode or do you think about any other alternative to solve this? Any help is appreciated

Hi @JOliver82 ,
sorry for the late reply. By the looks of it, dalvik is correct in complaining about the unclosed stream?
In any case, dalvik.system.CloseGuard is probably the place you are looking for. It has a setEnabled and a setReporter method.

First of all, thanks for answering :wink:

Yes, indeed a stream was not being properly closed. The problem is that I thought that exception was the one closing the app but it was other error related to jme3 which was not showing any output. Finally I was able to solve both of them.

1 Like