I compiled a "Hello World" program with ecj. Then I tried to convert it to jar with the following:
dx --dex --output=HelloWorld.jar HelloWorld.class
But it encountered an error:
MdfppReflectionUtils isMdfEnforced encountered an exception. Cause: java.lang.UnsatisfiedLinkError: No implementation found for boolean com.samsung.android.security.CCManager.isMdfEnforced() (tried Java_com_samsung_android_security_CCManager_isMdfEnforced and Java_com_samsung_android_security_CCManager_isMdfEnforced__) Message: null
MdfppReflectionUtils isMdfEnforced encountered an exception. Cause: java.lang.UnsatisfiedLinkError: No implementation found for boolean com.samsung.android.security.CCManager.isMdfEnforced() (tried Java_com_samsung_android_security_CCManager_isMdfEnforced and Java_com_samsung_android_security_CCManager_isMdfEnforced__) Message: null
How to solve this? Thanks
What device and android version you are encountering this error?, also try disabling that device security feature from smart manager app.
Samsung J7 2016 with Android 6.0.1
@Harshiv-Patel How to disable security feature?
No options are available for that I guess, I have no idea about the changes that have happened on Marshmallow6+, you would just clear the data from smart manager app I guess.
I can't find a way to do so too.
Does anyone have an idea what's going on?
There is a reason there is a renewed interest in a real javac. The dx ecj jack etc are really rom dependent if they work or not.
Oh... But the size may be top big.
@Wetitpig,try --verbose option with the dx tool and check where the error occurs. The error suggests that Samsung guys probably forgot to implement a portion of native code, or a misspelled signature in JNI may be.
Also do " cat `which dx` " (without the " " quotes, I might add)and upload the bash script output. I'm not sure but marshmallow's ART might handle things differently than Lollipop.
cat which dx
exec dalvikvm \
-Xmx256m \
-cp /data/data/com.termux/files/usr/share/dex/dx.dex \
com.android.dx.command.Main $@
For being verbose when compiling:
processing HelloWorld.class...
MdfppReflectionUtils isMdfEnforced encountered an exception. Cause: java.lang.UnsatisfiedLinkError: No implementation found for boolean com.samsung.android.security.CCManager.isMdfEnforced() (tried Java_com_samsung_android_security_CCManager_isMdfEnforced and Java_com_samsung_android_security_CCManager_isMdfEnforced__) Message: null
MdfppReflectionUtils isMdfEnforced encountered an exception. Cause: java.lang.UnsatisfiedLinkError: No implementation found for boolean com.samsung.android.security.CCManager.isMdfEnforced() (tried Java_com_samsung_android_security_CCManager_isMdfEnforced and Java_com_samsung_android_security_CCManager_isMdfEnforced__) Message: null
Same result.
Try adding this option to your _~/../usr/bin/dx_ file :
-Xdex2oat this forces vm to use dex2oat tool, maybe it'll solve the issue.
~/../usr/bin/dx would look like this after the change:

Error still encountered.
Try this:
make a symlink to /system/lib/libandroid_runtime.so and put it into ~/../usr/lib.
First go to ~/../usr/lib and then make the symlink:
cd ~/../usr/lib
ln -s /system/lib/libandroid_runtime.so .
may be this will solve it :confused:
Is execution permission required?
Even if copied to $PREFIX/lib and enabling execution permissions, still don't work.
I' ve tried. dx stiall fails with same error. Is is Samsung's fault or dx's fault?
Is execution permission required
Yes, it's needed but normally you don't have to change the permissions, it should be executable. dx is okay but Samsung changed it's security management and almost all samsung marshmallow devices are facing this issue now, I'm glad I rooted my phone and disabled OTA updates. If you have experience, you may want to install a custom ROM like Cynogene mod or downgrade to Lollipop, as it is now, you either have to update your device or change the ROM. Pure Samsung's fault.
But I have to void my warranty then. Maybe can I install JamVM and GNU Classpath to run class files directly?
Yes, warranty is definitely something you would not want to ruin. Give Jam thingi a try, Do post a solution if you find one :smirk:
Of course. Maybe I should include this as a package if possible and move dx to disabled-packages. By the way, is dalvikvm installed by packages or a default program in termux?
dx works fine for lollipop users like me, I wouldn't want dx to be added to disabled packages. dalvikvm is a command probably kept there for backward compatibility, it does use dx2oat tool anyway,it's not installed by termux or any other apps for sure. The culprit here is Samsung, they implemented a _security feature_ which (I believe)is the reason for this problem. I hope @fornwall can solve this issue.
I have found that I have insufficient space for the Dockerfile. How to clean up this mess?
I am building the Dockerfile in the scripts directory on a ubuntu 16.04 w/ around 1GB free space.
@Wetitpig remove ~/.termux-build to free some space and start over. You can run clean.sh otherwise. Just don't try building debug binaries for large packages.
Ok
The docke seems to occupy a huge space ( at least 5GB ). How can I decrease the size?
@Wetitpig try https://github.com/sdrausty/buildAPKs
Let us know how it works for you.
Thanks. I will just close this issue from now on.
I have done a repository to study the issues regarding ecj, dx and dalvikvm: