UnsatisfiedLinkError in native method

前端 未结 3 718
[愿得一人]
[愿得一人] 2020-12-16 06:58

I m getting unsatisfied link error in native method

Logcat main exception

UnsatisfiedLinkError: Native method not found: rg.sqlite.database.sqlite.S         


        
3条回答
  •  抹茶落季
    2020-12-16 07:15

    I have resolved this issue my self by adding

    System.loadLibrary("sqliteX");
    

    To each method where they are created

    LIKE THIS:

    public HashMap> word_quiz(String qry) {
        System.loadLibrary("sqliteX");
        ArrayList list1 = new ArrayList();
        ArrayList list2 = new ArrayList();
        SQLiteDatabase db = SQLiteDatabase.openOrCreateDatabase(DB_PATH+ "/sk1.db", null);
        Cursor mcursor = db.rawQuery(qry, null);
        try {
            mcursor.moveToFirst();
            do {
                list1.add(mcursor.getString(0));
                list2.add(mcursor.getString(1));
            } while (mcursor.moveToNext());
    
        } catch (IndexOutOfBoundsException e) {
            if (MainActivity.logcat_status) {
                Log.e("Error", e + "");
            }
        }
        mcursor.close();
        mcursor = null;
        HashMap> final_list = new HashMap>();
        final_list.put("list1", list1);
        final_list.put("list2", list2);
        db.close();
        return final_list;
    
    }
    

    Now its working fine

    I think I can also use a constructor to load the library "sqliteX"

    Thanks guys for considering my question :)

提交回复
热议问题