Closed GdGohan closed 1 year ago
find and check all calls getResourceAsStream(String)
- they MUST NOT be called on system classes
InputStream is = "".getClass().getResourceAsStream("/file"); // incorrectly (used system classloader for find resource)
InputStream is = this.getClass().getResourceAsStream("file"); // correctly (used app classloader for find resource)
InputStream is = <MidletOwnClass>.class.getResourceAsStream("file"); // correctly (used app classloader for find resource)
InputStream is = AppClassLoader.getResourceAsStream(null, "/file"); // correctly (used emulator api for find resource)
InputStream is = AppClassLoader.getResourceAsStream(<ReferencedClass>.class, "file"); // correctly (used emulator api for find resource)
If you are using jar (not source code) - you need to patch it via ASM-java like emulator converter:
https://github.com/nikita36078/J2ME-Loader/tree/master/dexlib/src/main/java/org/microemu/android/asm
find and check all calls
getResourceAsStream(String)
- they MUST NOT be called on system classesInputStream is = "".getClass().getResourceAsStream("/file"); // incorrectly (used system classloader for find resource) InputStream is = this.getClass().getResourceAsStream("file"); // correctly (used app classloader for find resource) InputStream is = <MidletOwnClass>.class.getResourceAsStream("file"); // correctly (used app classloader for find resource) InputStream is = AppClassLoader.getResourceAsStream(null, "/file"); // correctly (used emulator api for find resource) InputStream is = AppClassLoader.getResourceAsStream(<ReferencedClass>.class, "file"); // correctly (used emulator api for find resource)
If you are using jar (not source code) - you need to patch it via ASM-java like emulator converter: https://github.com/nikita36078/J2ME-Loader/tree/master/dexlib/src/main/java/org/microemu/android/asm
"If you are using jar (not source code) - you need to patch it via ASM-java like emulator converter: https://github.com/nikita36078/J2ME-Loader/tree/master/dexlib/src/main/java/org/microemu/android/asm" example? i'm using android studio so if i can load the class will it be able to detect the other files or do i need to put them in the assets folder? for example: I have the .class and the files "1;2;3;4........." should they be outside or inside the assets folder? And android studio manages to decompile the jar and put the codes in the dex file in the apk
I'm not a programmer, just a curious researcher :)
Probably a bit late here, but still. The most obvious solution for your case is to convert the game in J2ME Loader, put all resources in the project and set it up as said here. Also you need to put converted.dex in the apk too and modify MicroLoader accordingly to load it.
Description of the issue: I'm trying to make an apk port of a j2me game (SonicRacing) the problem is that I don't know how to load the files inside the jar, what I get is a black screen and "Error reading resource file".