JNI run time error even I use same code and lib as Android source code.

by Jerry Yang » Tue, 24 Feb 2009 09:47:30 GMT

Sponsored Links
 Hi, Marco
I am really new in android develop ment, so where should I check the system
with best wishes


JNI run time error even I use same code and lib as Android source code.

by Jerry Yang » Tue, 24 Feb 2009 15:39:06 GMT

 Hi, Marco and all
Here is the log:

D/AndroidRuntime( 1221):
D/AndroidRuntime( 1221): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
D/AndroidRuntime( 1221): CheckJNI is OFF
I/ActivityThread( 1223): Publishing provider
ider: com.android.vending.SuggestionsProvider
D/AndroidRuntime( 1221): --- registering native functions ---
I/jdwp    ( 1221): received file descriptor 23 from ADB
I/ActivityManager(   52): Stopping service:
I/ActivityManager(   52): Starting activity: Intent { flags=0x10000000
.android.hello/com.android.hello.HelloAndroid} }
I/ActivityManager(   52): Start proc com.android.hello for activity
hello/.HelloAndroid: pid=1240 uid=10023 gids={}
D/AndroidRuntime( 1221): Shutting down VM
D/dalvikvm( 1221): DestroyJavaVM waiting for non-daemon threads to exit
I/dalvikvm( 1221): DestroyJavaVM shutting VM down
D/dalvikvm( 1221): HeapWorker thread shutting down
D/dalvikvm( 1221): HeapWorker thread has shut down
D/jdwp    ( 1221): JDWP shutting down net...
D/jdwp    ( 1221): +++ peer disconnected
I/dalvikvm( 1221): Debugger has detached; object registry had 1 entries
D/dalvikvm( 1221): VM cleaning up
D/dalvikvm( 1221): LinearAlloc 0x0 used 541332 of 4194304 (12%)
I/jdwp    ( 1240): received file descriptor 10 from ADB
D/dalvikvm( 1240): Trying to load lib /system/lib/libhello.so 0x433b50d8
D/dalvikvm( 1240): Added shared lib /system/lib/libhello.so 0x433b50d8
D/dalvikvm( 1240): No JNI_OnLoad found in /system/lib/libhello.so 0x433b50d8
W/ActivityManager(   52): Activity pause timeout for HistoryRecord{435ae750
I/ActivityManager(   52): Displayed activity
com.android.hello/.HelloAndroid: 2025 ms
I/ActivityManager(   52): Stopping service:
D/dalvikvm(   90): GC freed 2431 objects / 127176 bytes in 276ms
D/dalvikvm( 1223): GC freed 2076 objects / 140976 bytes in 128ms
With best wishes


Sponsored Links

JNI run time error even I use same code and lib as Android source code.

by Jerry Yang » Tue, 24 Feb 2009 16:46:17 GMT

 Hi, all
I checked the logcat, I find it cannot find the jni_Onload,
Thanks for your information, I find I forget the function jni_Onload method,
it is a new requirement after jni)1.2
Now my hello world working.
With best wishes


Other Threads

1. Changing one TextView with onSensorChanged without Redrawing the Entire Layout

Hello everyone,

I am having a bit of trouble with my current application.  With a
button at the beginning of my app, I send out Intents for two
activities, one gets a camera object, and starts a preview screen.  On
top of that, in a separate layout, there is an activity with a
translucent view, which shows a resource image (the user is trying to
get the image he is actually taking to align with the translucent
image) and a couple of textviews displaying a target phone orientation
as well as the user's current phone orientation.

Here is my problem:  when I update the text value of one of my text
views in my onSensorChanged() field, the system constantly reallocates
1.22MB and garbage collects it.  I can only assume that this is
because it is redrawing the entire layout with the translucent image
and the text fields, because if I remove the view containing the
translucent image from the layout, my text field updates 10x quicker
and I don't have ridiculous heap growing / garbage collecting.  I am
wondering how to go about getting the text fields to update without
redrawing the entire surface.  I am very new to UI design, and this
code was written by someone else before I took over the project, so I
don't understand much of what is going on in the custom view he wrote
to take care of the translucent image -- called MyView.  I will post
the code for the layout as well as the MyView code below.

A reiteration of my goal -- I want to update the TextView text without
the extraneous allocation / garbage collection that is coming as a
result of having MyView included in the layout.

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/

                android:layout_height="fill_parent" />

        <LinearLayout android:id="@+id/LinearLayout01"
android:layout_height="wrap_content" xmlns:android="http://
schemas.android.com/apk/res/android" android:layout_gravity="bottom">
        <TextView android:id="@+id/TargetDirTextView"
        <TextView android:id="@+id/CurrentDirTextView"


MyView code:
public class MyView extends View{

    public MyView(Context context, int t) {
    public MyView(Context context, AttributeSet attrs)
        super(context, attrs);
    protected void onDraw(Canvas canvas) {

                java.io.InputStream is = null;
                if(Global.imageId == 0) {
                        is = getResources().openRawResource(R.drawable.eeb);
                else if(Global.imageId == 1) {
                        is = getResources().openRawResource(R.drawable.phe);
                else if(Global.imageId == 2) {
                        is = getResources().openRawResource(R.drawable.rth);
                else if(Global.imageId == 3) {
                        is = getResources().openRawResource(R.drawable.eeb);

                BitmapFactory.Options opts = new BitmapFactory.Options();
                Bitmap bm;

                opts.inJustDecodeBounds = true;
                bm = BitmapFactory.decodeStream(is, null, opts);

                // now opts.outWidth and opts.outHeight are the dimension of
                // bitmap, even though bm is null

                opts.inJustDecodeBounds = false;    // this will request the
                opts.inSampleSize = 1;             // scaled down by 4
                bm = BitmapFactory.decodeStream(is, null, opts);

                Bitmap bm2 = bm.copy(Bitmap.Config.ARGB_8888, true);
                int[] pixelArray = new int[bm2.getHeight()*bm2.getWidth
                bm2.getPixels(pixelArray, 0, bm2.getWidth(), 0, 0,
bm2.getWidth(), bm2.getHeight());
                int i;
                for(i=0; i<pixelArray.length; i++) {
                    pixelArray[i] ^= 0x55111111;
                bm2.setPixels(pixelArray, 0, bm2.getWidth(), 0, 0,
bm2.getWidth(), bm2.getHeight());
                canvas.drawBitmap(bm2, 10, 10, null);



2. wifi/wpa_supplicant

I am porting android to ARM platform and have problems with enable/
disable wifi.
Wifi is working but when i disable it wpa_supplicant process is not
being killed, and thus after i re enable wifi another instance of
wpa_supplicant is being created and no connection can be established.

Dhcpcd is killed properly (as i understand it kills itself when wifi
kernel module is removed, at least that what i found during debugging)
but wpa_supplicant process remains running.
I can add of cause the killing of the process inside the
wifi_stop_supplicant() function from libhardware_legacy/wifi.c but i
would rather understand why it is not being killed in the system
I am using propriety wifi chip and kernel module rather then android's
default TI.

Please help!
unsubscribe: android-porting+unsubscr...@googlegroups.com

3. Passing pmem FDs from OMX to MIO

4. creating custom system.img

5. Android/iPhone costs in the UK

6. how to read radio stream for web

7. unable to launch Emulator.