Ok, this is clearer, but now I'm finding myself in a similar situation
and doing this is not solving. I added to my Android.mk another
library, which compiles correctly. This is my Android.mk:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := Neptune
LOCAL_SRC_FILES := ...
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := NeptuneWrapper
LOCAL_SRC_FILES := neptunewrapper.cpp
#LOCAL_SHARED_LIBRARIES := Neptune
include $(BUILD_SHARED_LIBRARY)
I would like to create NeptuneWrapper so that I can access the
functions from my java application. I created a simple function just
like the one I had before (taken from the samples):
jstring Java_com_example_helloluca_HelloLuca_stringFromJNI(JNIEnv*
env, jobject thiz) {
return env->NewStringUTF("Hello World!\n");
}
I compiled this with the C++ compiler and not the C compiler as I want
this library to be able to use the other which is C++.
Now, the debugger says the library NeptuneWrapper is correctly found
(and in fact its there), but that it cannot find an implementation for
stringFromJNI. And again the same exception I reported before. Again
this symbol is correctly found:
00000bac T
_Z50Java_com_example_helloluca_HelloLuca_stringFromJNIP7_JNIEnvP8_jobject
Any idea what can I made wrong this time?
Thanks to everyone for the answers!
On Jul 10, 2:24 am, David Turner <
di...@android.com> wrote:
> You need to rebuild the sources with ndk-build, then rebuild the .apk with
> ant or Eclipse, then reinstall it into the emulator.
>
> We plan to integrate the NDK into the SDK in the future, which means that
> you won't have the separate native / .apk steps anymore.
> Until then, however, you'll have to use this.
>
> Hope this helps
>
> On Fri, Jul 9, 2010 at 4:41 PM, Luca Carlon <
carlon.l...@gmail.com> wrote:
> > I solved this problem but I don't know how I did it. It seems that
> > recompiling the C sources was not sufficient to run the program in the
> > simulator correctly. It seems to me it is necessary to clear the
> > project completely after recompiling the C sources and then running
> > it. This way I'm not having that problem anymore...
>
> > Thanks for your answers!
>
> > On Jul 9, 7:08 pm, fadden <
fad...@android.com> wrote:
> > > On Jul 9, 1:56 am, Luca Carlon <
carlon.l...@gmail.com> wrote:
>
> > > > 07-09 08:55:48.043: WARN/dalvikvm(762): No implementation found for
> > > > native Lcom/example/helloluca/HelloLuca;.stringFromJNI ()Ljava/lang/
> > > > String;
> > > ...
> > > > 00000b90 T Java_com_example_helloluca_HelloLuca_stringFromJNI
>
> > > The declarations and generated symbols look right. Are you sure the
> > > library is getting loaded before first use of the method? Put a
> > > JNI_OnLoad function in the shared lib and write some log messages from
> > > there to make sure it's getting loaded.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "android-ndk" group.
> > To post to this group, send email to
andro...@googlegroups.com.
> > To unsubscribe from this group, send email to
> >
android-ndk...@googlegroups.com<
android-ndk%2Bunsu...@googlegroups.com>
> > .