Sorry, native code is not supported in the current SDK.

On Wed, Dec 10, 2008 at 3:17 PM, 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to