Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

There is a block of code which is working fine on android 4.1.2 but not on 4.0.3, the crash log is of 4.0.3

I am getting UnsatisfiedLinkError Exception

Please guide me thanks

02-22 12:57:09.319: D/dalvikvm(1312): Trying to load lib /data/data/com.kosh.android/lib/libsqliteX.so 0x41056f48
02-22 12:57:09.319: D/dalvikvm(1312): Added shared lib /data/data/com.kosh.android/lib/libsqliteX.so 0x41056f48
02-22 12:58:02.060: W/dalvikvm(1312): No implementation found for native Lcom/shabdkosh/android/sqlite/CursorWindow;.native_init (Z)V
02-22 12:58:07.624: D/AndroidRuntime(1312): Shutting down VM
02-22 12:58:07.624: W/dalvikvm(1312): threadid=1: thread exiting with uncaught exception (group=0x409961f8)
02-22 12:58:07.767: E/AndroidRuntime(1312): FATAL EXCEPTION: main
02-22 12:58:07.767: E/AndroidRuntime(1312): java.lang.UnsatisfiedLinkError: native_init
02-22 12:58:07.767: E/AndroidRuntime(1312):     at com.kosh.android.sqlite.CursorWindow.native_init(Native Method)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at com.kosh.android.sqlite.CursorWindow.<init>(CursorWindow.java:35)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at org.sqlite.database.sqlite.SQLiteCursor.awc_clearOrCreateWindow(SQLiteCursor.java:139)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at org.sqlite.database.sqlite.SQLiteCursor.fillWindow(SQLiteCursor.java:150)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at org.sqlite.database.sqlite.SQLiteCursor.getCount(SQLiteCursor.java:125)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at android.database.AbstractCursor.moveToPosition(AbstractCursor.java:158)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at android.database.AbstractCursor.moveToFirst(AbstractCursor.java:235)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at com.kosh.android.offline.Handler.newdb1_index0_list(Handler.java:99)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at com.kosh.android.offline.SearchDataDB.getAutoSuggestion(SearchDataDB.java:29)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at com.kosh.android.MainActivity.onQueryTextChange(MainActivity.java:885)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at android.widget.SearchView.onTextChanged(SearchView.java:1081)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at android.widget.SearchView.access$1900(SearchView.java:90)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at android.widget.SearchView$10.onTextChanged(SearchView.java:1536)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at android.widget.TextView.sendOnTextChanged(TextView.java:7577)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at android.widget.TextView.handleTextChanged(TextView.java:7617)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at android.widget.TextView$ChangeWatcher.onTextChanged(TextView.java:7990)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at android.text.SpannableStringBuilder.sendTextChange(SpannableStringBuilder.java:881)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at android.text.SpannableStringBuilder.change(SpannableStringBuilder.java:352)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at android.text.SpannableStringBuilder.change(SpannableStringBuilder.java:266)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:443)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:420)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:29)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at android.text.method.QwertyKeyListener.onKeyDown(QwertyKeyListener.java:218)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at android.text.method.TextKeyListener.onKeyDown(TextKeyListener.java:132)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at android.widget.TextView.doKeyDown(TextView.java:5386)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at android.widget.TextView.onKeyDown(TextView.java:5206)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at android.widget.AutoCompleteTextView.onKeyDown(AutoCompleteTextView.java:682)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at android.view.KeyEvent.dispatch(KeyEvent.java:2533)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at android.view.View.dispatchKeyEvent(View.java:5446)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1248)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1248)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1248)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1248)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1248)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1248)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1248)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1248)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchKeyEvent(PhoneWindow.java:1859)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at com.android.internal.policy.impl.PhoneWindow.superDispatchKeyEvent(PhoneWindow.java:1361)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at android.app.Activity.dispatchKeyEvent(Activity.java:2324)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1806)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at android.view.ViewRootImpl.deliverKeyEventPostIme(ViewRootImpl.java:3300)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at android.view.ViewRootImpl.handleFinishedEvent(ViewRootImpl.java:3273)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2436)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at android.os.Handler.dispatchMessage(Handler.java:99)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at android.os.Looper.loop(Looper.java:137)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at android.app.ActivityThread.main(ActivityThread.java:4340)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at java.lang.reflect.Method.invokeNative(Native Method)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at java.lang.reflect.Method.invoke(Method.java:511)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
02-22 12:58:07.767: E/AndroidRuntime(1312):     at dalvik.system.NativeStart.main(Native Method)

HERE IS MY CLASS

package com.kosh.android.sqlite;

import android.database.CharArrayBuffer;

import android.os.IBinder;
import android.os.Parcel;
import android.os.Parcelable;

/**
* A buffer containing multiple cursor rows.
*/
public class CursorWindow extends android.database.CursorWindow implements Parcelable {
/** The pointer to the native window class */


/** The pointer to the native window class. set by the native methods in
 * android_database_CursorWindow.cpp
 */
private int nWindow;
private int mStartPos;
/**
 * Creates a new empty window.
 *
 * @param localWindow true if this window will be used in this process only
 */

public CursorWindow(boolean localWindow) {
    super(localWindow);
    mStartPos = 0;
    native_init(localWindow);
}

/**
 * Returns the starting position of this window within the entire
 * Cursor's result set.
 *
 * @return the starting position of this window within the entire
 * Cursor's result set.
 */
public int getStartPosition() {
    return mStartPos;
}

/**
 * Set the start position of cursor window
 * @param pos
 */
public void setStartPosition(int pos) {
    mStartPos = pos;
}    

/**
 * Returns the number of rows in this window.
 * 
 * @return the number of rows in this window.
 */
public int getNumRows() {
    acquireReference();
    try {
        return getNumRows_native();
    } finally {
        releaseReference();
    }
}

private native int getNumRows_native();
/**
 * Set number of Columns 
 * @param columnNum
 * @return true if success
 */
public boolean setNumColumns(int columnNum) {
    acquireReference();
    try {
        return setNumColumns_native(columnNum);
    } finally {
        releaseReference();
    }
}

private native boolean setNumColumns_native(int columnNum);

/**
 * Allocate a row in cursor window
 * @return false if cursor window is out of memory
 */
public boolean allocRow(){
    acquireReference();
    try {
        return allocRow_native();
    } finally {
        releaseReference();
    }
}

private native boolean allocRow_native();    

/**
 * Free the last row
 */
public void freeLastRow(){
    acquireReference();
    try {
        freeLastRow_native();
    } finally {
        releaseReference();
    }
}

private native void freeLastRow_native();

/**
 * copy byte array to cursor window
 * @param value
 * @param row
 * @param col
 * @return false if fail to copy
 */
public boolean putBlob(byte[] value, int row, int col) {
    acquireReference();
    try {
        return putBlob_native(value, row - mStartPos, col);
    } finally {
        releaseReference();
    }
}

private native boolean putBlob_native(byte[] value, int row, int col);    

/**
 * Copy String to cursor window
 * @param value
 * @param row
 * @param col
 * @return false if fail to copy
 */
public boolean putString(String value, int row, int col) {
    acquireReference();
    try {
        return putString_native(value, row - mStartPos, col);
    } finally {
        releaseReference();
    }
}

private native boolean putString_native(String value, int row, int col);    

/**
 * Copy integer to cursor window
 * @param value
 * @param row
 * @param col
 * @return false if fail to copy
 */
public boolean putLong(long value, int row, int col) {
    acquireReference();
    try {
        return putLong_native(value, row - mStartPos, col);
    } finally {
        releaseReference();
    }
}

private native boolean putLong_native(long value, int row, int col);


/**
 * Copy double to cursor window 
 * @param value
 * @param row
 * @param col
 * @return false if fail to copy
 */
public boolean putDouble(double value, int row, int col) {
    acquireReference();
    try {
        return putDouble_native(value, row - mStartPos, col);
    } finally {
        releaseReference();
    }
}

private native boolean putDouble_native(double value, int row, int col);    

/**
 * Set the [row, col] value to NULL
 * @param row
 * @param col
 * @return false if fail to copy
 */
public boolean putNull(int row, int col) {
    acquireReference();
    try {
        return putNull_native(row - mStartPos, col);
    } finally {
        releaseReference();
    }
}

private native boolean putNull_native(int row, int col);


/**
 * Returns {@code true} if given field is {@code NULL}.
 * 
 * @param row the row to read from, row - getStartPosition() being the actual row in the window
 * @param col the column to read from
 * @return {@code true} if given field is {@code NULL}
 */
public boolean isNull(int row, int col) {
    acquireReference();
    try {
        return isNull_native(row - mStartPos, col);
    

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
173 views
Welcome To Ask or Share your Answers For Others

1 Answer

This means that the runtime tried to find a matching method but was unsuccessful. Some common reasons for this are:

  • The library isn't getting loaded. Check the logcat output for messages about library loading.
  • The method isn't being found due to a name or signature mismatch.

This is an error that happens quite often. You can find more details about it on:

Whenever doing native code for cross-platform, any detail missing from your toolchain will make your application to crash.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...