我遵循华为开发者网站上关于Cloud DB服务的指南。然后我创建了一个简单的应用程序,尝试从 Cloud DB 查询数据并通过 Android Studio Emulator 对其进行测试。
但我收到以下错误,使应用程序在屏幕上显示消息:ExampleCloudDBApp 不断停止。
Process: com.huawei.agc.clouddb.quickstart, PID: 6400
java.lang.UnsatisfiedLinkError: No implementation found for long com.huawei.agconnect.cloud.database.AGConnectCloudDB.nativeGetInstance(com.huawei.agconnect.cloud.database.CertificateService, java.lang.String, java.lang.String) (tried Java_com_huawei_agconnect_cloud_database_AGConnectCloudDB_nativeGetInstance and Java_com_huawei_agconnect_cloud_database_AGConnectCloudDB_nativeGetInstance__Lcom_huawei_agconnect_cloud_database_CertificateService_2Ljava_lang_String_2Ljava_lang_String_2)
at com.huawei.agconnect.cloud.database.AGConnectCloudDB.nativeGetInstance(Native Method)
at com.huawei.agconnect.cloud.database.AGConnectCloudDB.initialize(AGConnectCloudDB.java:128)
at com.huawei.agc.clouddb.quickstart.model.CloudDBZoneWrapper.initAGConnectCloudDB(CloudDBZoneWrapper.java:103)
at com.huawei.agc.clouddb.quickstart.CloudDBQuickStartApplication.onCreate(CloudDBQuickStartApplication.java:28)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1154)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5871)
at android.app.ActivityThread.access$1100(ActivityThread.java:199)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
CloudDBQuickStartApplication 类的 initAGConnectCloudDB 方法:
public class CloudDBQuickStartApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
//Initialize AGConnectCloudDB
CloudDBZoneWrapper.initAGConnectCloudDB(this);
}
@Override
public void onTerminate() {
super.onTerminate();
}
CloudDBZoneWrapper类内容调用AGConnectCloudDB类的initialize方法:
public static void initAGConnectCloudDB(Context context) {
AGConnectCloudDB.initialize(context);
}