Question

i'm trying to make .so file but it gives following error ndroid-ndk-r9\ndk-build.cmd all make: Nothing to be done forall'. `

In jni folder i have all these files

intarray.c
intarray.h
jni_setup.h
sqlite_extension_example.c
sqlite3_wrap_manual.c
sqlite3_wrap_manual.h
sqlite3.c
sqlite3.h
sqlite4java-android.cpp
Android.mk

Till now i'm able to generate .a file i.e libsqlite3.a under obj folder

Below is the code

package com.example.sqlite4;

import java.io.File;
import java.util.ArrayList;

import com.almworks.sqlite4java.SQLiteConnection;
import com.almworks.sqlite4java.SQLiteStatement;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.Toast;

public class MainActivity extends Activity {
ArrayList<String> orders = new ArrayList<String>();
@Override
protected void onCreate(Bundle savedInstanceState) 
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    try {
        System.loadLibrary("sqlite4java-android");
        SQLiteConnection db = new SQLiteConnection(new File("/storage/sdcard1/sk.db"));
        db.open(true);
        SQLiteStatement st = db.prepare("select C0,C1,C2,C3,C4 from T0 where C0= ?");
        try {

            String minimumQuantity = "'2907'";
            st.bind(1, minimumQuantity);
            while (st.step()) {
                orders.add(st.columnString(0));
                orders.add(st.columnString(1));
                orders.add(st.columnString(2));
                orders.add(st.columnString(3));
            }
        } finally {
            st.dispose();
        }
        db.dispose();
    } catch (Exception e) 
    {
        e.printStackTrace();
    }

    Toast.makeText(getBaseContext(),orders.toString() , Toast.LENGTH_LONG).show();
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
}
}

This is the log

02-28 12:51:11.846: E/AndroidRuntime(8357): FATAL EXCEPTION: main
02-28 12:51:11.846: E/AndroidRuntime(8357): java.lang.UnsatisfiedLinkError: Couldn't load sqlite4java-android: findLibrary returned null
02-28 12:51:11.846: E/AndroidRuntime(8357):     at java.lang.Runtime.loadLibrary(Runtime.java:365)
02-28 12:51:11.846: E/AndroidRuntime(8357):     at java.lang.System.loadLibrary(System.java:535)
02-28 12:51:11.846: E/AndroidRuntime(8357):     at com.example.sqlite4.MainActivity.onCreate(MainActivity.java:22)
02-28 12:51:11.846: E/AndroidRuntime(8357):     at android.app.Activity.performCreate(Activity.java:5020)
02-28 12:51:11.846: E/AndroidRuntime(8357):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
02-28 12:51:11.846: E/AndroidRuntime(8357):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
02-28 12:51:11.846: E/AndroidRuntime(8357):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2211)
02-28 12:51:11.846: E/AndroidRuntime(8357):     at android.app.ActivityThread.access$600(ActivityThread.java:149)
02-28 12:51:11.846: E/AndroidRuntime(8357):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1300)
02-28 12:51:11.846: E/AndroidRuntime(8357):     at android.os.Handler.dispatchMessage(Handler.java:99)
02-28 12:51:11.846: E/AndroidRuntime(8357):     at android.os.Looper.loop(Looper.java:153)
02-28 12:51:11.846: E/AndroidRuntime(8357):     at android.app.ActivityThread.main(ActivityThread.java:4987)
02-28 12:51:11.846: E/AndroidRuntime(8357):     at java.lang.reflect.Method.invokeNative(Native Method)
02-28 12:51:11.846: E/AndroidRuntime(8357):     at java.lang.reflect.Method.invoke(Method.java:511)
02-28 12:51:11.846: E/AndroidRuntime(8357):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:821)
02-28 12:51:11.846: E/AndroidRuntime(8357):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)
02-28 12:51:11.846: E/AndroidRuntime(8357):     at dalvik.system.NativeStart.main(Native Method)

My Android.mk file

LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)

# If using SEE, uncomment the following:
# LOCAL_CFLAGS += -DSQLITE_HAS_CODEC

LOCAL_CFLAGS += -DHAVE_CONFIG_H -DKHTML_NO_EXCEPTIONS -DGKWQ_NO_JAVA
LOCAL_CFLAGS += -DNO_SUPPORT_JS_BINDING -DQT_NO_WHEELEVENT -DKHTML_NO_XBL
LOCAL_CFLAGS += -U__APPLE__
LOCAL_CFLAGS += -Wno-unused-parameter -Wno-int-to-pointer-cast
LOCAL_CFLAGS += -Wno-maybe-uninitialized -Wno-parentheses
LOCAL_CPPFLAGS += -Wno-conversion-null


ifeq ($(TARGET_ARCH), arm)
LOCAL_CFLAGS += -DPACKED="__attribute__ ((packed))"
else
LOCAL_CFLAGS += -DPACKED=""
endif

LOCAL_SRC_FILES:=sqlite3.c
LOCAL_C_INCLUDES += $(LOCAL_PATH) $(LOCAL_PATH)/native/
LOCAL_MODULE:= sqlite4java-android
LOCAL_LDLIBS += -ldl -llog

include $(BUILD_SHARED_LIBRARY)

Please help me out

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top