aliyun / aliyun-tablestore-java-sdk

Aliyun TableStore(原OTS) JAVA SDK
https://www.aliyun.com/product/ots/
Apache License 2.0
54 stars 27 forks source link

How to use this in Android ? #13

Closed reeselaye closed 6 years ago

reeselaye commented 6 years ago

Hi,

I'm working on an Android App which uses Aliyun Tablestore as database. But problems occured.

When I place implementation ('com.aliyun.openservices:ots-public:2.2.4') in build.gradle, build and debug the App, exception thrown. Below is the stacktrace:

          java.lang.NoSuchFieldError: No static field INSTANCE of type Lorg/apache/http/message/BasicLineFormatter; in class Lorg/apache/http/message/BasicLineFormatter; or its superclasses (declaration of 'org.apache.http.message.BasicLineFormatter' appears in /system/framework/org.apache.http.legacy.boot.jar)
              at org.apache.http.impl.nio.codecs.DefaultHttpRequestWriterFactory.<init>(DefaultHttpRequestWriterFactory.java:52)
              at org.apache.http.impl.nio.codecs.DefaultHttpRequestWriterFactory.<init>(DefaultHttpRequestWriterFactory.java:56)
              at org.apache.http.impl.nio.codecs.DefaultHttpRequestWriterFactory.<clinit>(DefaultHttpRequestWriterFactory.java:46)
              at org.apache.http.impl.nio.conn.ManagedNHttpClientConnectionFactory.<init>(ManagedNHttpClientConnectionFactory.java:75)
              at org.apache.http.impl.nio.conn.ManagedNHttpClientConnectionFactory.<init>(ManagedNHttpClientConnectionFactory.java:83)
              at org.apache.http.impl.nio.conn.ManagedNHttpClientConnectionFactory.<clinit>(ManagedNHttpClientConnectionFactory.java:64)
              at org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager$InternalConnectionFactory.<init>(PoolingNHttpClientConnectionManager.java:522)
              at org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager.<init>(PoolingNHttpClientConnectionManager.java:161)
              at org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager.<init>(PoolingNHttpClientConnectionManager.java:145)
              at org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager.<init>(PoolingNHttpClientConnectionManager.java:117)
              at org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager.<init>(PoolingNHttpClientConnectionManager.java:111)
              at com.aliyun.openservices.ots.comm.AsyncServiceClient.<init>(AsyncServiceClient.java:44)
              at com.aliyun.openservices.ots.OTSClient.<init>(OTSClient.java:164)
              at com.aliyun.openservices.ots.OTSClient.<init>(OTSClient.java:116)
              at com.aliyun.openservices.ots.OTSClient.<init>(OTSClient.java:56)
              at com.anpeila.dashgomonitorapp.MainActivity.onCreate(MainActivity.java:26)
              at android.app.Activity.performCreate(Activity.java:7081)
              at android.app.Activity.performCreate(Activity.java:7072)
              at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1215)
              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2747)
              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2872)
              at android.app.ActivityThread.-wrap11(Unknown Source:0)
              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1601)
              at android.os.Handler.dispatchMessage(Handler.java:106)
              at android.os.Looper.loop(Looper.java:164)
              at android.app.ActivityThread.main(ActivityThread.java:6600)
              at java.lang.reflect.Method.invoke(Native Method)
              at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:518)
              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:821)

Any help? Thanks!

reeselaye commented 6 years ago

Here a demo is found: https://github.com/reeselaye/alicloud-android-demo/tree/master/ots_android_demo.