I am new to android development. We have many c++ libraries that we
would like to use on Android.
I am made an interface shared libary that I am able to run in a java
app, but when I attempt to link another so library, the first so
library fails to load.
Here is my andriod.mk file for the java jni so file:
# Copyright (C) 2009 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := XInterface
LOCAL_SRC_FILES := ../src/XInterface.cpp
LOCAL_CPPFLAGS += -D ANDROID
LOCAL_C_INCLUDES :=$(LOCAL_PATH)/../../
LOCAL_SHARED_LIBRARIES := XCalcs
include $(BUILD_SHARED_LIBRARY)
Here is my linked in so library android.mk file for the XCalcs so
library:
# Copyright (C) 2009 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := XCalcs
LOCAL_SRC_FILES := ../src/Location.cpp
LOCAL_CPPFLAGS += -D ANDROID
LOCAL_C_INCLUDES :=$(LOCAL_PATH)/../../
include $(BUILD_SHARED_LIBRARY)
I am using ndk r3 and google version 2.1 of the sdk. What
modifications do I need to make to get these so libaries to load on
the android?
Thanks
Eric
--
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.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.
How can I work around this issue?
Another question, is there a limit on the size of a so file?
Thanks
Eric
> > android-ndk...@googlegroups.com<android-ndk%2Bunsubscribe@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/android-ndk?hl=en.- Hide quoted text -
>
> - Show quoted text -
/Michael
> To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
04-01 15:52:21.333: DEBUG/dalvikvm(237): Trying to load lib /data/data/
com.staudertech/lib/libXInterface.so 0x43d02d68
04-01 15:52:21.364: INFO/dalvikvm(237): Unable to dlopen(/data/data/
com.staudertech/lib/libXInterface.so): Cannot load library:
link_image[1721]: 29 could not load needed library 'libXCalcs.so'
for 'libXInterface.so' (load_library[1051]: Library 'libXCalcs.so' not
found)
04-01 15:52:21.373: WARN/dalvikvm(237): Exception Ljava/lang/
UnsatisfiedLinkError; thrown during Lcom/staudertech/
StauderInterface;.<clinit>
Both the so libraries are in the same location.
Thanks
Eric
> >> >http://groups.google.com/group/android-ndk?hl=en.-Hide quoted text -
>
> >> - Show quoted text -
>
> > --
> > 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.
> > For more options, visit this group athttp://groups.google.com/group/android-ndk?hl=en.- Hide quoted text -
If so how?
Any suggestions would be appreciated.
Thanks
Eric
> > >> >http://groups.google.com/group/android-ndk?hl=en.-Hidequoted text -
>
> > >> - Show quoted text -
>
> > > --
> > > 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.
> > > For more options, visit this group athttp://groups.google.com/group/android-ndk?hl=en.-Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
Thanks
Eric
> > groups.google.com/group/android-ndk?hl=en.-Hide quoted text -
>
> > > > - Show quoted text -- Hide quoted text -
>
> > > - Show quoted text -
>
> > --
> > 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%2Bunsubscribe@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/android-ndk?hl=en.- Hide quoted text -
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
C:\>adb shell ls /data/data/com.staudertech/lib
libXCalcs.so
libXInterface.so
Thanks
Eric
> > > >http://groups.google.com/group/android-ndk?hl=en.-Hide quoted text -
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
C:\>adb shell ls -l /data/data/com.staudertech/lib
-rw-r--r-- system system 72826 2010-04-01 10:46 libXCalcs.so
-rw-r--r-- system system 298112 2010-04-01 10:47
libXInterface.so
C:\>
Is there a size limit on the so files? Should I be doing this linking
another way?
Thanks
Eric
> > > > > >http://groups.google.com/group/android-ndk?hl=en.-Hidequoted text
> > -
>
> > > > > - Show quoted text -
>
> > > > --
> > > > 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%2Bunsubscribe@googlegroups.com>
> > <android-ndk%2Bunsubscribe@googlegroups.com>
> > > > .
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/android-ndk?hl=en.-Hide quoted text -
>
> > > - Show quoted text -
>
> > --
> > 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
>
> ...
>
> read more »- Hide quoted text -
Before some day I had a same problem of dlopen() cant open .so file at
the runtime.
I think,
U just put the libXCalcs.so file in your ndk root android-ndk-r3/build/
platforms/android-5<whatever you use 3-4-5>/arch-arm/usr/lib folder
and try it.
May be It works..
> ...
>
> read more »
Evidently, if you have so files that depend on each other, you have to
add the loadLibary statement for each dependency.
Thanks for your assistance.
Thanks
Eric
> ...
>
> read more »- Hide quoted text -