I want to convert my jar to dex: dx --dex --output=file.dex file.jar
. In file.jar
exists folder cnf/
which contains configuration files needed for my classes. But there is no folder cnf/
in resulting dex-file.
How to keep all files and folders in dex-file while converting?
You can put cnf/
in APK file. APK is a ZIP archive. After unpacking on device cnf/
folder would be in classpath so it should work the same as inside JAR.
After a build remove MANIFEST.MF and certificates from META-INF folder inside APK;
zip -d file.apk "META-INF/*"
Add your resources (cnf/
) to APK;
aapt add -v file.apk cnf/*
Re-sign APK. Here's an example using the default debug key:
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ~/.android/debug.keystore file.apk androiddebugkey