shelf icon indicating copy to clipboard operation
shelf copied to clipboard

error after Code Obfuscating under release mode

Open hpp0hpp opened this issue 2 years ago • 4 comments

Hi, I am using shelf_plus to respond a text. but if no obfuscating, it runs ok. after I obfuscating the code,

with flutter build apk --obfuscate --split-debug-info=/doubantv/debug-info will reports an error:

Error thrown by handler. NoSuchMethodError: Closure call with mismatched arguments: function 'Oxb' Receiver: Closure: (dva) => Future<CC> Tried calling: Oxb Found: Oxb(dva) => Future<CC>

because it's release mode. I don;t know how to debug the problem, but it seems the error caused here

image

hpp0hpp avatar Aug 14 '22 03:08 hpp0hpp

@mraleph - can you suggest any way to get more information about the failure?

@hpp0hpp - do you have a stack trace? Does it point to anywhere helpful?

natebosch avatar Aug 24 '22 22:08 natebosch

It would help to see the stack trace. The error just indicates a mismatched closure call of some sort. I would not be surprised that maybe something like Type.toString() is used somewhere and things go south.

mraleph avatar Aug 25 '22 11:08 mraleph

@mraleph - can you suggest any way to get more information about the failure?

@hpp0hpp - do you have a stack trace? Does it point to anywhere helpful?

It would help to see the stack trace. The error just indicates a mismatched closure call of some sort. I would not be surprised that maybe something like Type.toString() is used somewhere and things go south.

HI @natebosch @mraleph

Hi I would like to share more information, but the obfuscate only allow under release mode, I don't know how to produce a stack trace for that. this error is reported in logcat.

hpp0hpp avatar Oct 09 '22 15:10 hpp0hpp

Do you get any stack trace printed?

You could just patch shelf code to do print('$stackTrace'); before _logError.

After that you can deobfuscate it using the debug information you split out. See

https://docs.flutter.dev/deployment/obfuscate#reading-an-obfuscated-stack-trace

mraleph avatar Oct 09 '22 15:10 mraleph