Hi, since native code is not currently supported in the SDK, this post is not appropriate for this group. Please post on one of the open-source platformg groups such as android-platform.
On Fri, Dec 12, 2008 at 1:53 AM, kevin_fan <kevin....@gmail.com> wrote: > > Hi Group! > > I created my own android application using eclipse+ADT. Inside the > application, there is a class called "UniFNativeInterface", it loads > the library "libUniFNativeCode.so" and contains a few "native" > methods, which means it is simply a wrapper of native features. The > libray - "libUniFNativeCode.so" is for the native implementation. Of > course, before I run my application, I push the lib into to the > emulator. > This is scenario one, and everything worked fine. > > > Because of my curiosity, I tried to integrate the package > "com.android.unif"(where class "UniFNativeInterface" lives in) into > the platform, I simply locate the package folder under "D:\SourceCode > \android\mydroid\frameworks\base\core\java\com\android\", to make it a > part of framework.jar, and then rebuild everything. > When I reboot the emulator with the newly - built images, and invoked > the use of class "UniFNativeInterface", VM crashed with the below > log: > > ..... > D/dalvikvm( 227): Trying to load lib /system/lib/libUniFNativeCode.so > 0x0 > D/dalvikvm( 227): Added shared lib /system/lib/libUniFNativeCode.so > 0x0 > W/dalvikvm( 227): JNI WARNING: JNI method called with exception > raised > W/dalvikvm( 227): in Ljava/lang/Runtime;.nativeLoad > (Ljava/lang/String;Ljava/lang/ClassLoader;)Z (RegisterNatives) > W/dalvikvm( 227): Pending exception is: > I/dalvikvm( 227): Ljava/lang/NoClassDefFoundError;: > com.android.unif.UniFNativeInterface > I/dalvikvm( 227): at java.lang.Runtime.nativeLoad(Native Method) > I/dalvikvm( 227): at java.lang.Runtime.loadLibrary(Runtime.java:380) > I/dalvikvm( 227): at java.lang.System.loadLibrary(System.java:458) > I/dalvikvm( 227): at com.android.unif.UniFNativeInterface.<clinit> > (UniFNativeInterface.java:113) > ..... > > My code was built into the platform(framework.jar, more precisely) > successfully, otherwise libUniFNativeCode.so wouldn't be loaded > (crap...); > and the library was correctly found; > > > I think the problem took place when the native library tried to the > register native methods to class com.android.unif.UniFNativeInterface, > but Runtime could not find the definition of that class. However, we > can see from the log that the package and class name is exactly the > same as it is supposed to be, then why this happened....I saw there > are a few usages of JNI in framework, was there anything I missed?? > > The only difference I can see of above two scenarios are the > environment, any idea? > > any suggestions will be appreciated!!! thanks in advance!!! > > > > -- Dianne Hackborn Android framework engineer hack...@android.com 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---