sceneform-android icon indicating copy to clipboard operation
sceneform-android copied to clipboard

Build with Obfuscation crashes due to Filament

Open TogayHanKaya opened this issue 3 years ago • 22 comments

Hi all,

I am getting crash if I enable obfuscation in the project.

Using version 1.20.5

E/Filament: Panic in filament::MaterialParser *filament::createParser(filament::backend::Backend, const void *, size_t):69 reason: Material version mismatch. Expected 17 but received 0.

E/Filament: A/libc: Fatal signal 6 (SIGABRT), code -6 (SI_TKILL) in tid 8292 (.thk.dev), pid 8292 (.thk.dev)

Has anyone faced similar issue?

TogayHanKaya avatar Feb 28 '22 16:02 TogayHanKaya

Hi,

You can have a look in here for excluded rules: https://github.com/SceneView/sceneform-android/blob/master/core/lib-proguard-rules.pro Actually they should already been excluded from your project but I don't know why they are not forwarded form the lib.

ThomasGorisse avatar Feb 28 '22 16:02 ThomasGorisse

Thanks for the fast response Thomas.

Added the two rules: -keep class com.google.ar.core.** { *; } -keep class com.google.android.filament.** { *; }

Unfortunately kept the same error.

Are you facing similar issue on your end?

TogayHanKaya avatar Feb 28 '22 16:02 TogayHanKaya

Does this work?

-keep class com.google.ar.sceneform.** { *; }
-keep class com.google.android.filament.** { *; }
-keep class com.google.ar.core.** { *; }
-keepclassmembers class com.google.ar.sceneform.** { *; }
-keepclassmembers class com.google.android.filament.** { *; }
-keepclassmembers class com.google.ar.core.** { *; }

RGregat avatar Feb 28 '22 16:02 RGregat

Got the same error @RGregat.

TogayHanKaya avatar Feb 28 '22 16:02 TogayHanKaya

  • Can you checkout 1.20.4 and test?
  • Is the error thrown without obfuscation?

It can be total unrelated but E/Filament: Panic in filament::MaterialParser *filament::createParser(filament::backend::Backend, const void *, size_t):69 reason: Material version mismatch. Expected 17 but received 0. looks like that the prebuilt materials are generated with a wrong version of Filamat.

RGregat avatar Feb 28 '22 16:02 RGregat

  • Can you checkout 1.20.4 and test?

Error changed to:

A/libc: Fatal signal 6 (SIGABRT), code -6 (SI_TKILL) in tid 29459 (.thk.dev), pid 29459 (.thk.dev)

E/native: E0228 18:04:33.965109 29898 bundle_adjustment_initializer.cc:704] Measurements not available in all keyframes. At least one keyframe has no features in any of the cameras.

E/native: E0228 18:04:33.967180 29898 vio_initializer.cc:668] generic::internal: [SSBA Initialization] Failed to initialize the network.; Initializer's SSBA failed to produce a valid output.

E/native: E0228 18:04:34.055849 29898 bundle_adjustment_initializer.cc:704] Measurements not available in all keyframes. At least one keyframe has no features in any of the cameras.

  • Is the error thrown without obfuscation? Withoug obfuscation, works as expected on both 1.20.4 and 1.20.5 versions.

TogayHanKaya avatar Feb 28 '22 17:02 TogayHanKaya

Sorry, I didn't see the logs. That's not an obfucation issue but a wrong filamat compiled version.

ThomasGorisse avatar Feb 28 '22 17:02 ThomasGorisse

@ThomasGorisse I am not sure but wanted to learn;

if it is a wrong filamat complied version, shouldn't it be crashing on builds without obfuscation too?

TogayHanKaya avatar Feb 28 '22 17:02 TogayHanKaya

Can you provide some code and your obfuscation rules? It looks like if your rules are excluding the .filamat in the asset folder.

ThomasGorisse avatar Feb 28 '22 18:02 ThomasGorisse

-keep class com.google.ar.sceneform.** { *; } -keep class com.google.android.filament.** { *; } -keep class com.google.ar.core.** { *; } -keepclassmembers class com.google.ar.sceneform.** { *; } -keepclassmembers class com.google.android.filament.** { *; } -keepclassmembers class com.google.ar.core.** { *; }

Could you please lead me what part of the code you need?

TogayHanKaya avatar Feb 28 '22 18:02 TogayHanKaya

Check your build folder to see the obfuscation result. The asset files should be kept and not compressed.

ThomasGorisse avatar Feb 28 '22 18:02 ThomasGorisse

@ThomasGorisse

I am getting the same error when migrating from 1.20.5 -> 1.21.0

E/Filament: Panic in createParser:69 reason: Material version mismatch. Expected 21 but received 17.

With or without obfuscation result is the same and I don't see anything filament related in build folder.

Do you have any idea?

tribetomi avatar Jul 05 '22 13:07 tribetomi

@tribetomi You must recompile your .filamat files with the corresponding Filament version

ThomasGorisse avatar Jul 05 '22 14:07 ThomasGorisse

@tribetomi You must recompile your .filamat files with the corresponding Filament version

Hey Thomas, yes I realise that but as I said I don't have any additional .mat or .filamat files. I am using library itself without any additional materials and I don't have .filamat in build folder for some reason. On version before everything build smoothly.

tribetomi avatar Jul 06 '22 06:07 tribetomi

Do you override the Filament version in your build.gradle?

ThomasGorisse avatar Jul 06 '22 08:07 ThomasGorisse

No, but I use it as api so I share dependancy in several modules. (in none of them .filament is generated tho)

tribetomi avatar Jul 06 '22 09:07 tribetomi

Yep. But Sceneform has its own internal .filamat files that must be used with the same Filament version.

ThomasGorisse avatar Jul 06 '22 09:07 ThomasGorisse

Hm, I'm aware of that but how can I update them?

As I said I'm only using com.gorisse.thomas.sceneform:sceneform:1.20.5 -> trying 1.21.0 Don't have any other filament dependancy where I set version to 17 or any material that I put manually

tribetomi avatar Jul 06 '22 09:07 tribetomi

Can you try running the sample project corresponding to your use case?

ThomasGorisse avatar Jul 06 '22 09:07 ThomasGorisse

I get the same message :/

The only reason why I'm trying to update it to 1.21.0 is because after reopening ArFragment numerous times I get crash

Skipped image because max images have been acquired from ImageReader. A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x8 A/DEBUG: Cause: null pointer dereference

and I hope maybe latest version has ImageReader buffer fixed because of https://github.com/google-ar/arcore-android-sdk/issues/1262

It's the bug that you had last year but as I understand after reading sceneform classes is that fix should be also implemented in 1.20.5?

tribetomi avatar Jul 06 '22 11:07 tribetomi

Sorry about that, but all efforts are now made on SceneView and I'm not sure we will fix it on Sceneform

ThomasGorisse avatar Jul 06 '22 15:07 ThomasGorisse

But is SceneView working with AugmentedFace?

I am asking because https://github.com/SceneView/sceneview-android/issues/74 ?

*(sorry for slight off-topic)

tribetomi avatar Jul 07 '22 07:07 tribetomi

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Aug 17 '23 05:08 github-actions[bot]

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

github-actions[bot] avatar Aug 25 '23 05:08 github-actions[bot]