Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android error on reading gltf files when minify is enabled #116

Closed
SakiiCode opened this issue Oct 27, 2023 · 5 comments
Closed

Android error on reading gltf files when minify is enabled #116

SakiiCode opened this issue Oct 27, 2023 · 5 comments

Comments

@SakiiCode
Copy link

I am having this fatal exception on Android if minifyEnabled true is set in build.gradle

10-27 15:38:55.052 16208 16231 E AndroidRuntime: w0.l: w0.l: Couldn't load dependencies of asset: tiles/desert.gltf
10-27 15:38:55.052 16208 16231 E AndroidRuntime: 	at r.d.O(Unknown Source:64)
10-27 15:38:55.052 16208 16231 E AndroidRuntime: 	at r.d.b0(Unknown Source:55)
10-27 15:38:55.052 16208 16231 E AndroidRuntime: 	at r.d.D(Unknown Source:7)
10-27 15:38:55.052 16208 16231 E AndroidRuntime: 	at q2.b.o(Unknown Source:2)
10-27 15:38:55.052 16208 16231 E AndroidRuntime: 	at p2.n.i(Unknown Source:766)
10-27 15:38:55.052 16208 16231 E AndroidRuntime: 	at v.t.onSurfaceChanged(Unknown Source:28)
10-27 15:38:55.052 16208 16231 E AndroidRuntime: 	at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1557)
10-27 15:38:55.052 16208 16231 E AndroidRuntime: 	at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1272)
10-27 15:38:55.052 16208 16231 E AndroidRuntime: Caused by: w0.l: Couldn't load dependencies of asset: tiles/desert.gltf
10-27 15:38:55.052 16208 16231 E AndroidRuntime: 	at r.c.b(Unknown Source:67)
10-27 15:38:55.052 16208 16231 E AndroidRuntime: 	at r.c.g(Unknown Source:10)
10-27 15:38:55.052 16208 16231 E AndroidRuntime: 	at r.d.c0(Unknown Source:14)
10-27 15:38:55.052 16208 16231 E AndroidRuntime: 	at r.d.b0(Unknown Source:33)
10-27 15:38:55.052 16208 16231 E AndroidRuntime: 	... 6 more
10-27 15:38:55.052 16208 16231 E AndroidRuntime: Caused by: w0.l: w0.k0: Error reading file: tiles/desert.gltf
10-27 15:38:55.052 16208 16231 E AndroidRuntime: 	at x0.b.a(Unknown Source:14)
10-27 15:38:55.052 16208 16231 E AndroidRuntime: 	at r.c.b(Unknown Source:32)
10-27 15:38:55.052 16208 16231 E AndroidRuntime: 	... 9 more
10-27 15:38:55.052 16208 16231 E AndroidRuntime: Caused by: w0.k0: Error reading file: tiles/desert.gltf
10-27 15:38:55.052 16208 16231 E AndroidRuntime: 	at w0.r.f(Unknown Source:35)
10-27 15:38:55.052 16208 16231 E AndroidRuntime: 	at c4.b.e(Unknown Source:7)
10-27 15:38:55.052 16208 16231 E AndroidRuntime: 	at c4.a.h(Unknown Source:12)
10-27 15:38:55.052 16208 16231 E AndroidRuntime: 	at c4.a.a(Unknown Source:2)
10-27 15:38:55.052 16208 16231 E AndroidRuntime: 	at r.c.a(Unknown Source:29)
10-27 15:38:55.052 16208 16231 E AndroidRuntime: 	at r.c.call(Unknown Source:0)
10-27 15:38:55.052 16208 16231 E AndroidRuntime: 	at x0.a$b.call(Unknown Source:2)
10-27 15:38:55.052 16208 16231 E AndroidRuntime: 	at java.util.concurrent.FutureTask.run(FutureTask.java:264)
10-27 15:38:55.052 16208 16231 E AndroidRuntime: 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
10-27 15:38:55.052 16208 16231 E AndroidRuntime: 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
10-27 15:38:55.052 16208 16231 E AndroidRuntime: 	at java.lang.Thread.run(Thread.java:1012)
10-27 15:38:55.052 16208 16231 E AndroidRuntime: Caused by: w0.k0: Field not found: asset (r3.a)
10-27 15:38:55.052 16208 16231 E AndroidRuntime: Serialization trace:
10-27 15:38:55.052 16208 16231 E AndroidRuntime: {}.asset
10-27 15:38:55.052 16208 16231 E AndroidRuntime: 	at w0.r.o(Unknown Source:94)
10-27 15:38:55.052 16208 16231 E AndroidRuntime: 	at w0.r.p(Unknown Source:462)
10-27 15:38:55.052 16208 16231 E AndroidRuntime: 	at w0.r.f(Unknown Source:10)
10-27 15:38:55.052 16208 16231 E AndroidRuntime: 	... 10 more

This is the top of desert.gltf

{
    "asset" : {
        "generator" : "Khronos glTF Blender I/O v3.3.32",
        "version" : "2.0"
    },
    "scene" : 0,
    "scenes" : [
        {
            "name" : "Scene",
            "nodes" : [
                0,
                1,
                2,
                3
            ]
        }
    ],
    "nodes" : [
        {
            "mesh" : 0,
            "name" : "Circle"
        },
...

w0.k0 is com.badlogic.gdx.utils.SerializationException
r3.a is net.mgsx.gltf.data.GLTF
w0.r.o is com.badlogic.gdx.utils.Json.readFields(JsonValue)

If I set minifyEnabled false everything works.
Tried "2.1.0" and "-SNAPSHOT" versions both give this error

@SakiiCode
Copy link
Author

I am not sure if this is the correct way but as a workaround put

-keep class net.mgsx.gltf.data.** {
	public *;
}

in the proguard-rules.pro file

If this is actually the best solution, I suggest adding it to the install part of the readme

@mgsx-dev
Copy link
Owner

Hi, i tried using proguard for a desktop application some times ago and end up with a configuration like this :

keep 'class com.badlogic.gdx.** { *; }'
keep 'class net.mgsx.gltf.** { *; }'
keepattributes 'Signature'

TBH, there is no point to obfuscate open source library code (libgdx, gdx-gltf, and others...) only your own game code matters.

Please try this configuration and if it works for you i'll add it to the documentation.

@NickPilipenko
Copy link

Please try this configuration and if it works for you i'll add it to the documentation.

I have the same issue with proguard using, the proposed solution resolves it.
Thanks

@SakiiCode
Copy link
Author

TBH, there is no point to obfuscate open source library code (libgdx, gdx-gltf, and others...) only your own game code matters.

I strongly disagree, as little as possible should be put into the proguard rules, otherwise you will miss out on the size reduction, reverse engineering protection, code optimization benefits.

@mgsx-dev
Copy link
Owner

fixed by 8507a98

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants