Couchbase lite 2.0.0error C4Log.setLevel

I Use Couchbase lite 2.0.0 ,when install at real mobile,it have this error(it have no error at emulator):

E/DB: Cannot load native library
E/art: No implementation found for void com.couchbase.litecore.C4Log.setLevel(java.lang.String, int) (tried Java_com_couchbase_litecore_C4Log_setLevel and Java_com_couchbase_litecore_C4Log_setLevel__Ljava_lang_String_2I)
environment:
Win10 x64,android studio 3.0.1,test real Mobile(it have no error at emulator).

What architecture is the mobile device?

android 6.0 android 7.0 android 8.0

oh,my god,couchbase lite just can run at arm & x86 cpu? I am at china,i use huawei mobile,and it’s cpu is Hisilicon,it’s huawei’s cpu.
Huawei mobile phones are very popular in China. In this case, can’t I use couchbaselite as a local database?

HiSilicon is an ARM manufacturer from what I can tell. Basically Android only runs on ARM and x86 anyway (there is MIPS, but it is deprecated).

But the mobile phone system is also Android, is a custom Android system, so I can not use couchbase lite?

We only support official / stock Android builds from Google. We do not support custom or proprietary forks of Android .

It looks like whatever CPU architecture the device is, it isn’t compatible with the ARM architecture we build for, so JNI can’t load it. You should try to look up what exact CPU architecture your device has, i.e. ARMv7 etc.

But my app is for Internet users. I can’t control the user’s mobile phone architecture. Can’t you compile a version that is not related to the platform architecture?

No, we cannot.

But that being said: https://en.wikipedia.org/wiki/HiSilicon

This shows that all of their processors listed are either ARMv7 or ARMv8 (arm64) which are both supported architectures. Which processor is showing the error for you?

Caused by: java.lang.UnsatisfiedLinkError: No implementation found for void com.couchbase.litecore.C4Log.setLevel(java.lang.String, int) (tried Java_com_couchbase_litecore_C4Log_setLevel and Java_com_couchbase_litecore_C4Log_setLevel__Ljava_lang_String_2I)

Caused by: java.lang.UnsatisfiedLinkError: No implementation found for void com.couchbase.litecore.C4Log.setLevel(java.lang.String, int) (tried Java_com_couchbase_litecore_C4Log_setLevel and Java_com_couchbase_litecore_C4Log_setLevel__Ljava_lang_String_2I)
at com.couchbase.litecore.C4Log.setLevel(Native Method)
at com.couchbase.lite.internal.support.Log.enableLogging(Log.java:431)
at com.couchbase.lite.internal.support.Log.setLogLevel(Log.java:400)
at com.couchbase.lite.AbstractDatabase.(AbstractDatabase.java:69)
at com.secyang.pbdb.base.DMM.(DMM.java:59)
at com.secyang.pbdb.base.DMM.getSharedInstance(DMM.java:204)

the code:
protected DMM(Context context, boolean isGuest) {
loginUserId=“Tom”;
if (isGuest) {

        DatabaseConfiguration config = new DatabaseConfiguration(context);

        // File folder = new File(String.format("%s/guest", context.getFilesDir()));
        config.setDirectory(String.format("%s/guest", context.getFilesDir()));
        try {
            database = new Database("test", config);

        } catch (CouchbaseLiteException e) {
            e.printStackTrace();
        }
    } else {

        File dbFile = new File(context.getFilesDir(), "travel-sample.cblite2");
        if (!dbFile.exists()) {
            DMM.installPrebuiltDatabase(context, "travel-sample.cblite2.zip");
        }
        DatabaseConfiguration config = new DatabaseConfiguration(context);
        try {

            database = new Database("travel-sample", config);
            createFTSQueryIndex();
        } catch (CouchbaseLiteException e) {
            e.printStackTrace();
        }
    }
}


public static DMM getSharedInstance(Context context, boolean isGuest) {
    if (null == instance) {
        synchronized (SynObject) {
            if (null == instance) {
                instance = new DMM(context, isGuest);

            }
        }
    }
    return instance;
}

That’s not the answer to the question we asked. I asked which processor you are running on (what CPU)?

sorry. it’s kirin 955, it’s ARMv8-A architectures.
thank.

@pasin Wasn’t there some issue where loadLibrary was not getting called early enough? Could that be a factor here?

ARMv8-A is one of the architectures we build for, so there is no reason that it shouldn’t work.

The issue happens when trying to set the default log level after loading the native library as the code below:

static {
  NativeLibraryLoader.load();
  Log.setLogLevel(LogDomain.ALL, LogLevel.WARNING);
}

@zxyang178, Is there any errors shown in the Logcat? Can you try to get the CPU arch with the following code and see what it is?

String arch;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP)  {
  arch = Build.SUPPORTED_ABIS[0];
} else {
  arch = Build.CPU_ABI;
} 

Just saw that. This was printed by CBL’s NativeLibraryLoader. This means that the native library cannot be loaded. Not sure why.

@borrrden , @pasin
thanks.

the arch is:
arm64-v8a

Try running the code here to manually load the library and see what exception happens. That should give some more info.

the error info:

E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.yang.pb, PID: 13083
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file “/data/app/com.yang.pb-1/base.apk”],nativeLibraryDirectories=[/data/app/com.yang.pb-1/lib/arm, /data/app/com.yang.pb-1/base.apk!/lib/armeabi, /system/lib, /vendor/lib, /system/vendor/lib, /product/lib]]] couldn’t find “libLiteCoreJNI.so”
at java.lang.Runtime.loadLibrary0(Runtime.java:989)
at java.lang.System.loadLibrary(System.java:1533)
at com.benmu.wx.App.onCreate(App.java:120)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1028)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5658)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1637)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:156)
at android.app.ActivityThread.main(ActivityThread.java:6523)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:942)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:832)