Reputation: 33
I am getting this message which is not allowing my apps to run which contain some native C/C++ files, which I build using NDK. Apps is closing and opening again and crashing in a loop. I am getting below compilation warning after making some awk related changes in android.mk C:/android-ndk-r8/build/core/add-application.mk 128:Android NDK : Warning: APP-PLATFORM android-14 is larger than android:minsdkVersion 8 in ./AndroidManifest.xml
I have checked relevant threads associated with it, but couldn't find anything which can help me. Can anyone please help me, what I am missing here.
Logcat Output:
15:44:15.815: E/Trace(3026): error opening trace file: No such file or directory (2)
05-28 15:44:16.007: D/dalvikvm(3026): Trying to load lib /data/app-lib/com.example.raptorjni-2/libraptorq-test.so 0x40ce6428
05-28 15:44:16.035: D/dalvikvm(3026): Added shared lib /data/app-lib/com.example.raptorjni-2/libraptorq-test.so 0x40ce6428
05-28 15:44:16.035: D/dalvikvm(3026): No JNI_OnLoad found in /data/app-lib/com.example.raptorjni-2/libraptorq-test.so 0x40ce6428, skipping init
05-28 15:44:16.255: D/RaptorQ(3026): Entering the main function
Java main file snippet from where the C function is called :
Log.d(TAG,"isteps Ecoded" + isteps);
/* Call the JNI-ized version of DFRQEncPerfTest */
String res =
resultRQEncPerfString(nSrcSymbols, symbolSize, loss, niter,
mode, 0, header);
.C file function Snippet:
jstring
Java_com_example_raptorjni_RaptorJni_resultRQEncPerfString
(JNIEnv *env, jobject thiz,
jint nSrcSymbols, jint symbolSize, jint lossrate, jint nLoop,
jint mode, jint nRepair, jint header)
{
Implementation ....
Upvotes: 1
Views: 1072
Reputation: 333
JNI_Onload
is optional initialization function introduced since JNI 1.4 (more or less), that allows developers to do some init jobs while library is loaded (for example, register native methods to jvm).
So we really don't need javah or something stupid to implement native java methods in c/c++, just call JNIEnv::registerNatives
inside JNI_Onload
.
For this issue, I think something else was wrong.
Upvotes: 3