JNIEnv::GetStringUTFChars() crashes when Java code is obfuscated

594 views
Skip to first unread message

thedude

unread,
Oct 14, 2011, 7:59:34 PM10/14/11
to android-ndk
I'm getting ready to release my app, and trying out an obfuscated
release build.

When I obfuscate, my native code crashes on calls to
JNIEnv::GetStringUTFChars(). It works perfetly when not obfuscated.
Is there a line I need to add to proguard.cfg to have it avoid
obfuscating stuff used by JNIEnv?

Thanks.
Message has been deleted
Message has been deleted

thedude

unread,
Oct 17, 2011, 6:44:46 PM10/17/11
to andro...@googlegroups.com
UPDATE: 

I have verified that the problem is caused by something being 
obfuscated that shouldn't be. 

When I add the following lines to my proguard.cfg (which obviously 
defeats the purpose of obfuscating, since it prevents anything from being obfuscated) the crash goes away: 

-keep class ** { 
 <methods>; 
 <fields>; 


But I haven't been able to come up with a narrower exclusion that 
prevents JNIEnv::GetStringUTFChars() from crashing. 

If I had the source code to JNIEnv::GetStringUTFChars(), maybe I could 
dig in and figure out which fields or methods it's trying to access. 
I haven't been able to find the source though. 

Help? 

Emile Belanger

unread,
Dec 20, 2014, 8:34:44 AM12/20/14
to andro...@googlegroups.com
Sorry I know this is very old, can you remember if you fixed this, and how?
Thanks!
Reply all
Reply to author
Forward
0 new messages