Hi, could you please move such discussion to one of the open source groups
like android-platform, since this is not about developing for the SDK?
Thanks.
On Wed, Dec 10, 2008 at 8:31 PM, GnuHash <[EMAIL PROTECTED]> wrote:
>
> hi
> yes that is correct way.
>
> 1) Make sure you have the lib in /data/app folder. If not, find a way
> to put it there. The lib cant be inside the apk. It has to be outside
> the apk as a separate file so that you can link to it.Figure out a way
> to copy the lib from the apk to outside it.
>
> 2) Use DDMS perspective of eclipse to see what is going on. In DDMS
> you can view the Logcat to get logs to why your application crashed.
> Check if its unsatified link exception. If it is then you application
> was not able to find the lib.
>
> gnuHash
>
> On Dec 11, 4:17 am, Allie <[EMAIL PROTECTED]> wrote:
> > I tried to load a native library from an existing Android application
> > and failed at calling the native function. Do any of you have any
> > advice?
> >
> > 1. I added the following code to android application
> > Lunarlander.java
> > //native method declaration
> > native void hello(String name);
> >
> > static {
> > System.out.println("libhello.so loaded");
> > System.load("/data/app/libhello.so");
> > }
> >
> > I added my libhellp.so to lunalander.apk and then uploaded the apk to /
> > data/app. The application launches ok.
> >
> > 2. I added the following code to android application
> > Lunarlander.java
> > //native method declaration
> > native void hello(String name);
> > static {
> > System.out.println("libhello.so loaded");
> > System.load("/data/app/libhello.so");
> > }
> >
> > …
> > protected void onCreate(Bundle savedInstanceState) {
> > super.onCreate(savedInstanceState);
> > …
> > //test loading hello lib and call hello function
> > LunarLander myLunarLander = new LunarLander();
> > myLunarLander.hello("Hi there!");
> > …
> > }
> >
> > I added my libhellp.so to lunalander.apk and then uploaded the apk to /
> > data/app. The application launches was forced to close and the error
> > message is "The application Lunar lander has stopped unexpectedly.
> > Please try again".
> >
>
--
Dianne Hackborn
Android framework engineer
[EMAIL PROTECTED]
Note: please don't send private questions to me, as I don't have time to
provide private support. All such questions should be posted on public
forums, where I and others can see and answer them.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---