GithubHelp home page GithubHelp logo

leancloud / java-unified-sdk Goto Github PK

View Code? Open in Web Editor NEW
64.0 19.0 26.0 17.26 MB

LeanCloud Java SDK(兼容 Android)

Home Page: https://leancloud.cn

License: Apache License 2.0

Java 99.80% HTML 0.01% CSS 0.05% JavaScript 0.05% Shell 0.09%
leancloud javasdk android rxjava2

java-unified-sdk's Issues

5.0.10 crash

java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference
at java.net.URI$Parser.parse(URI.java:3050)
at java.net.URI.(URI.java:590)
at java.net.URI.create(URI.java:852)
at cn.leancloud.l.b.b(AVConnectionManager.java:134)
at cn.leancloud.l.b.a(AVConnectionManager.java:37)
at cn.leancloud.l.b$2.a(AVConnectionManager.java:196)
at cn.leancloud.l.b$2.onNext(AVConnectionManager.java:188)
at io.a.e.e.b.f$a.onNext(ObservableMap.java:62)
at io.a.e.e.b.i$a.run(ObservableScalarXMap.java:248)
at io.a.e.e.b.e.b(ObservableJust.java:35)
at io.a.e.a(Observable.java:12090)
at io.a.e.e.b.f.b(ObservableMap.java:32)
at io.a.e.a(Observable.java:12090)
at cn.leancloud.l.b.h(AVConnectionManager.java:188)
at cn.leancloud.l.b.b(AVConnectionManager.java:168)
at cn.leancloud.push.PushService$1.run(PushService.java:100)
at java.lang.Thread.run(Thread.java:761)

会话列表未读消息清空不了

老版本迁移过来,之前用的是带UI的ChatKit没有问题,在chatKit中替换了SDK后,查看了某个会话在退出,列表头像上会有未读消息数量,重刷也一样,退出程序在进也还有。我看文档上说调用 Conversation#read 方法将对话标记为已读 ,试了也没用,是什么问题?。。

如何获取 响应 code ?

override fun signUp(email: String, password: String, callback: Callback) {
        val user = User()
        user.email = email
        user.username = email
        user.password = password
        val subscribe = user.signUpInBackground()
            .subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribeBy(
                onError = {
                    callback.onFailure(it)
                },
                onComplete = {
                    callback.onSuccess()
                }
            )
    }

这个是异步调用。

  1. 我是否需要用RxJava 再切一次线程?
  2. 订阅之后返回的是Throwable对象,如何获取AVException 中的 code ?

PushService.subscribe()方法添加多条订阅的时候崩溃UnsupportedOperationException

Caused by: java.lang.UnsupportedOperationException
at java.util.AbstractList.add(AbstractList.java:148)
at java.util.AbstractList.add(AbstractList.java:108)
at java.util.AbstractCollection.addAll(AbstractCollection.java:342)
at cn.leancloud.ops.AddOperation.apply(AddOperation.java:24)
at cn.leancloud.AVObject.addNewOperation(AVObject.java:399)
at cn.leancloud.AVObject.addUnique(AVObject.java:333)
at cn.leancloud.push.PushService.subscribe(PushService.java:264)
at com.fhedu.student.manage.PushManage$1.onNext(PushManage.java:45)
at com.fhedu.student.manage.PushManage$1.onNext(PushManage.java:26)
at io.reactivex.internal.operators.flowable.FlowableFromObservable$SubscriberObserver.onNext(FlowableFromObservable.java:54)
at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.drainNormal(ObservableObserveOn.java:201)
at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.run(ObservableObserveOn.java:255)

maven 仓库地址怎么配置?

我看你们的sample 使用的是 本地的仓库,那么你给我的maven仓库没有远程的配置么?

 //LeanCloud 的包仓库
        maven {
            url "http://mvn.leancloud.cn/nexus/content/repositories/public"
        }

这个地址并不能找到 storage-android:5.0.7 这个库,我查看了下 ,只有5.0.0-SNAPSHOT 版本

java.lang.NoClassDefFoundError: Failed resolution of: Ljavax/net/ssl/SNIHostName;

使用LeanCloudChatKit-Android项目代码,leancloud sdk升级为5.0.2,
android app build.gradle配置
`
compileSdkVersion 28
buildToolsVersion "28.0.3"

defaultConfig {
    applicationId "cn.leancloud.imkitapplication"
    minSdkVersion 19
    targetSdkVersion 28
    versionCode 1
    versionName "1.0"
    multiDexEnabled true
}

`

Android 项目 cn.leancloud:realtime-android:5.0.2 闪退
build.gradle 配置如下
`
dependencies {
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'

implementation fileTree(dir:"libs", include:["*.jar"])
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'de.greenrobot:eventbus:2.4.0'

implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
implementation("cn.leancloud:realtime-android:5.0.2"){
    exclude group: 'org.ligboy.retrofit2', module: 'converter-fastjson-android'
}
implementation 'com.alibaba:fastjson:1.1.68.android'

}

在Application中初始化
LCChatKit.getInstance().setProfileProvider(CustomUserProvider.getInstance());
AVOSCloud.setLogLevel(AVLogger.Level.DEBUG);
// AVOSCloud.useAVCloudUS();
LCChatKit.getInstance().init(getApplicationContext(), APP_ID, APP_KEY);

PushService.setDefaultPushCallback(this, MainActivity.class);
PushService.setAutoWakeUp(true);
PushService.setDefaultChannelId(this, "default");

AVInstallation.getCurrentInstallation().saveInBackground().subscribe(new Observer<AVObject>() {
  @Override
  public void onSubscribe(Disposable d) {
  }

  @Override
  public void onNext(AVObject avObject) {
    String installationId = AVInstallation.getCurrentInstallation().getInstallationId();
    System.out.println("---  " + installationId);
  }

  @Override
  public void onError(Throwable e) {
    // 保存失败,输出错误信息
    System.out.println("failed to save installation.");
  }

  @Override
  public void onComplete() {

  }
});

`

启动闪退
`
12-27 18:46:10.336 2203-2203/? I/art: Late-enabling -Xcheck:jni
12-27 18:46:10.353 2203-2203/? D/TidaProvider: TidaProvider()
12-27 18:46:10.391 2203-2203/cn.leancloud.imkitapplication W/System: ClassLoader referenced unknown path: /data/app/cn.leancloud.imkitapplication-1/lib/arm64
12-27 18:46:10.395 2203-2203/cn.leancloud.imkitapplication I/MultiDex: VM with version 2.1.0 has multidex support
12-27 18:46:10.396 2203-2203/cn.leancloud.imkitapplication I/MultiDex: Installing application
12-27 18:46:10.396 2203-2203/cn.leancloud.imkitapplication I/MultiDex: VM has multidex support, MultiDex support library is disabled.
12-27 18:46:10.431 2203-2203/cn.leancloud.imkitapplication I/AVOSCloud: [LeanCloud] initialize mainThreadChecker and threadShuttle within AVCallback.
12-27 18:46:10.432 2203-2203/cn.leancloud.imkitapplication D/AVOSCloud: docDir=/data/user/0/cn.leancloud.imkitapplication/app_PaaS, fileDir=/data/user/0/cn.leancloud.imkitapplication/cache/avfile/, cmdDir=/data/user/0/cn.leancloud.imkitapplication/cache/CommandCache, statDir=/data/user/0/cn.leancloud.imkitapplication/cache/Analysis
12-27 18:46:10.464 2203-2203/cn.leancloud.imkitapplication D/AVIMMessageManager: failed to initialize message Fields
12-27 18:46:10.464 2203-2203/cn.leancloud.imkitapplication D/AVIMMessageManager: failed to initialize message Fields
12-27 18:46:10.465 2203-2203/cn.leancloud.imkitapplication D/AVIMMessageManager: failed to initialize message Fields
12-27 18:46:10.465 2203-2203/cn.leancloud.imkitapplication D/AVIMMessageManager: failed to initialize message Fields
12-27 18:46:10.465 2203-2203/cn.leancloud.imkitapplication D/AVIMMessageManager: failed to initialize message Fields
12-27 18:46:10.465 2203-2203/cn.leancloud.imkitapplication D/AVIMMessageManager: failed to initialize message Fields
12-27 18:46:10.466 2203-2203/cn.leancloud.imkitapplication D/AVIMMessageManager: failed to initialize message Fields
12-27 18:46:10.473 2203-2203/cn.leancloud.imkitapplication I/AndroidInitializer: [LeanCloud] initialize mainThreadChecker and threadShuttle within AVIMEventHandler.
12-27 18:46:10.473 2203-2203/cn.leancloud.imkitapplication I/AndroidInitializer: [LeanCloud] initialize mainThreadChecker and threadShuttle within AVLiveQueryEventHandler.
12-27 18:46:10.478 2203-2203/cn.leancloud.imkitapplication D/PushService: setDefaultPushCallback cls=cn.leancloud.chatkitapplication.MainActivity
12-27 18:46:10.481 2203-2245/cn.leancloud.imkitapplication D/PushService: Start service
12-27 18:46:10.482 2203-2203/cn.leancloud.imkitapplication D/PersistenceUtil: obtained read lock for file: /data/user/0/cn.leancloud.imkitapplication/files/installation
12-27 18:46:10.482 2203-2203/cn.leancloud.imkitapplication D/PersistenceUtil: release read lock for file: /data/user/0/cn.leancloud.imkitapplication/files/installation
12-27 18:46:10.493 2203-2203/cn.leancloud.imkitapplication D/AVObject: secondly, save object itself...
12-27 18:46:10.497 2203-2203/cn.leancloud.imkitapplication I/AVObject: saveObject param: {"deviceType":"android","timeZone":"Asia/Shanghai","installationId":"e34725271becb9950eedff98cca441f5"}
12-27 18:46:10.528 2203-2203/cn.leancloud.imkitapplication W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
12-27 18:46:10.541 2203-2203/cn.leancloud.imkitapplication D/AccessibilityManager: current package=cn.leancloud.imkitapplication, accessibility manager mIsFinalEnabled=false, mOptimizeEnabled=false, mIsUiAutomationEnabled=false, mIsInterestedPackage=false
12-27 18:46:10.553 2203-2203/cn.leancloud.imkitapplication I/art: Rejecting re-init on previously-failed class java.lang.Class<android.support.v4.view.ViewCompat$OnUnhandledKeyEventListenerWrapper>
12-27 18:46:10.553 2203-2203/cn.leancloud.imkitapplication I/art: Rejecting re-init on previously-failed class java.lang.Class<android.support.v4.view.ViewCompat$OnUnhandledKeyEventListenerWrapper>
12-27 18:46:10.607 2203-2255/cn.leancloud.imkitapplication D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
12-27 18:46:10.612 2203-2203/cn.leancloud.imkitapplication D/PushService: PushService#onCreate
12-27 18:46:10.613 2203-2257/cn.leancloud.imkitapplication D/AVConnectionManager: start connection...
12-27 18:46:10.614 2203-2257/cn.leancloud.imkitapplication D/AppRouter: fetchRTMServerFromRemote. router=https://dyrq8yfh.rtm.lncld.net, appId=dYRQ8YfHRiILshUnfFJu2eQM-gzGzoHsz
12-27 18:46:10.615 2203-2203/cn.leancloud.imkitapplication D/PushService: PushService#onStartCommand
12-27 18:46:10.617 2203-2203/cn.leancloud.imkitapplication D/PushService: networking is fine and try to start connection to leancloud.
12-27 18:46:10.617 2203-2203/cn.leancloud.imkitapplication D/AVConnectionManager: on starting connection, save callback...
12-27 18:46:10.658 2203-2255/cn.leancloud.imkitapplication I/Adreno: QUALCOMM build : 05151ca, I74772a33ad
Build Date : 09/13/16
OpenGL ES Shader Compiler Version: XE031.08.00.00
Local Branch :
Remote Branch : refs/tags/AU_LINUX_ANDROID_LA.UM.5.3_RB1.06.00.01.211.047
Remote Branch : NONE
Reconstruct Branch : NOTHING
12-27 18:46:10.662 2203-2203/cn.leancloud.imkitapplication D/AVConnectionManager: on starting connection, ignore.
12-27 18:46:10.662 2203-2203/cn.leancloud.imkitapplication D/PushService: Connection resumed with Wifi...
12-27 18:46:10.663 2203-2255/cn.leancloud.imkitapplication I/OpenGLRenderer: Initialized EGL, version 1.4
12-27 18:46:10.685 2203-2255/cn.leancloud.imkitapplication E/HAL: Dawei load: module=/system/lib64/hw/gralloc.msm8953.so
12-27 18:46:10.842 2203-2253/cn.leancloud.imkitapplication D/LoggingInterceptor: Request: curl -X POST
-H Accept: application/json
-H Content-Type: application/json
-H User-Agent: LeanCloud SDK v5.0.3
-H X-LC-Id: {your_app_id}
-H X-LC-Prod: 1
-H X-LC-Session: {your_session}
-H X-LC-Key: {your_app_key}
https://dyrq8yfh.api.lncld.net/1.1/installations?fetchWhenSave=false
12-27 18:46:10.843 2203-2253/cn.leancloud.imkitapplication D/LoggingInterceptor: Response: 201
server: nginx
date: Thu, 27 Dec 2018 10:46:11 GMT
content-type: application/json;charset=utf-8
cache-control: no-cache,no-store
pragma: no-cache
strict-transport-security: max-age=31536000

{"objectId":"WWf9zYCGAw1yTmjDO6kXtGmKnamcaTpV","createdAt":"2018-12-27T09:42:43.062Z","updatedAt":"2018-12-27T10:46:11.829Z"} 

12-27 18:46:10.850 2203-2203/cn.leancloud.imkitapplication D/PersistenceUtil: obtained writeLock for file: /data/user/0/cn.leancloud.imkitapplication/files/installation
12-27 18:46:10.850 2203-2203/cn.leancloud.imkitapplication D/PersistenceUtil: release writeLock for file: /data/user/0/cn.leancloud.imkitapplication/files/installation
12-27 18:46:10.850 2203-2203/cn.leancloud.imkitapplication I/System.out: --- e34725271becb9950eedff98cca441f5
12-27 18:46:10.872 2203-2258/cn.leancloud.imkitapplication D/LoggingInterceptor: Request: curl -X GET
-H Accept: application/json
-H Content-Type: application/json
-H User-Agent: LeanCloud SDK v5.0.3
-H X-LC-Id: {your_app_id}
-H X-LC-Prod: 1
-H X-LC-Session: {your_session}
-H X-LC-Key: {your_app_key}
https://dyrq8yfh.rtm.lncld.net/v1/route?appId=dYRQ8YfHRiILshUnfFJu2eQM-gzGzoHsz&installationId=e34725271becb9950eedff98cca441f5&secure=1
12-27 18:46:10.873 2203-2258/cn.leancloud.imkitapplication D/LoggingInterceptor: Response: 200
server: nginx
date: Thu, 27 Dec 2018 10:46:11 GMT
content-type: application/json
content-length: 169
vary: Accept-Encoding

{"groupId":"g0","server":"wss:\/\/rtm57.leancloud.cn\/","ttl":14400,"secondary":"wss:\/\/cn-n1-cell10.leancloud.cn\/","groupUrl":"https:\/\/router-g0-push.leancloud.cn"} 

12-27 18:46:10.898 2203-2257/cn.leancloud.imkitapplication D/AVConnectionManager: try to connect server: wss://rtm57.leancloud.cn/

--------- beginning of crash

12-27 18:46:10.905 2203-2257/cn.leancloud.imkitapplication E/AndroidRuntime: FATAL EXCEPTION: Thread-14934
Process: cn.leancloud.imkitapplication, PID: 2203
java.lang.NoClassDefFoundError: Failed resolution of: Ljavax/net/ssl/SNIHostName;
at cn.leancloud.websocket.AVStandardWebSocketClient.setSocket(AVStandardWebSocketClient.java:91)
at cn.leancloud.websocket.AVStandardWebSocketClient.(AVStandardWebSocketClient.java:66)
at cn.leancloud.session.AVConnectionManager.initWebSocketClient(AVConnectionManager.java:131)
at cn.leancloud.session.AVConnectionManager.access$400(AVConnectionManager.java:37)
at cn.leancloud.session.AVConnectionManager$2.onNext(AVConnectionManager.java:196)
at cn.leancloud.session.AVConnectionManager$2.onNext(AVConnectionManager.java:188)
at io.reactivex.internal.operators.observable.ObservableMap$MapObserver.onNext(ObservableMap.java:62)
at io.reactivex.internal.operators.observable.ObservableScalarXMap$ScalarDisposable.run(ObservableScalarXMap.java:248)
at io.reactivex.internal.operators.observable.ObservableJust.subscribeActual(ObservableJust.java:35)
at io.reactivex.Observable.subscribe(Observable.java:12090)
at io.reactivex.internal.operators.observable.ObservableMap.subscribeActual(ObservableMap.java:32)
at io.reactivex.Observable.subscribe(Observable.java:12090)
at cn.leancloud.session.AVConnectionManager.startConnectionInternal(AVConnectionManager.java:188)
at cn.leancloud.session.AVConnectionManager.startConnection(AVConnectionManager.java:168)
at cn.leancloud.push.PushService$1.run(PushService.java:100)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.ClassNotFoundException: Didn't find class "javax.net.ssl.SNIHostName" on path: DexPathList[[zip file "/data/app/cn.leancloud.imkitapplication-1/base.apk"],nativeLibraryDirectories=[/data/app/cn.leancloud.imkitapplication-1/lib/arm64, /vendor/lib64, /system/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at cn.leancloud.websocket.AVStandardWebSocketClient.setSocket(AVStandardWebSocketClient.java:91) 
at cn.leancloud.websocket.AVStandardWebSocketClient.(AVStandardWebSocketClient.java:66) 
at cn.leancloud.session.AVConnectionManager.initWebSocketClient(AVConnectionManager.java:131) 
at cn.leancloud.session.AVConnectionManager.access$400(AVConnectionManager.java:37) 
at cn.leancloud.session.AVConnectionManager$2.onNext(AVConnectionManager.java:196) 
at cn.leancloud.session.AVConnectionManager$2.onNext(AVConnectionManager.java:188) 
at io.reactivex.internal.operators.observable.ObservableMap$MapObserver.onNext(ObservableMap.java:62) 
at io.reactivex.internal.operators.observable.ObservableScalarXMap$ScalarDisposable.run(ObservableScalarXMap.java:248) 
at io.reactivex.internal.operators.observable.ObservableJust.subscribeActual(ObservableJust.java:35) 
at io.reactivex.Observable.subscribe(Observable.java:12090) 
at io.reactivex.internal.operators.observable.ObservableMap.subscribeActual(ObservableMap.java:32) 
at io.reactivex.Observable.subscribe(Observable.java:12090) 
at cn.leancloud.session.AVConnectionManager.startConnectionInternal(AVConnectionManager.java:188) 
at cn.leancloud.session.AVConnectionManager.startConnection(AVConnectionManager.java:168) 
at cn.leancloud.push.PushService$1.run(PushService.java:100) 
at java.lang.Thread.run(Thread.java:818) 
Suppressed: java.lang.ClassNotFoundException: javax.net.ssl.SNIHostName
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 17 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
12-27 18:46:10.924 2203-2257/? I/Process: Sending signal. PID: 2203 SIG: 9

`

java.lang.NullPointerException: Attempt to invoke virtual method 'void cn.leancloud.websocket.AVStandardWebSocketClient.send(cn.leancloud.command.CommandPacket)' on a null object reference

调用 avLiveQuery.subscribeInBackground 方法时候

java.lang.NullPointerException: Attempt to invoke virtual method 'void cn.leancloud.websocket.AVStandardWebSocketClient.send(cn.leancloud.command.CommandPacket)' on a null object reference

    at cn.leancloud.session.AVConnectionManager.sendPacket(AVConnectionManager.java:238)

完整

01-20 07:32:02.282 24593-24633/com.cooter.leancloud I/OpenGLRenderer: generate program for key:1800500044, use: 31 ms
01-20 07:32:05.959 24593-24666/com.cooter.leancloud D/LoggingInterceptor: Request: curl -X POST
-H Accept: application/json
-H Content-Type: application/json
-H User-Agent: LeanCloud SDK v5.0.8
-H X-LC-Id: {your_app_id}
-H X-LC-Prod: 1
-H X-LC-Session: {your_session}
-H X-LC-Key: {your_app_key}
https://allcawvw.api.lncld.net/1.1/LiveQuery/subscribe
01-20 07:32:05.962 24593-24666/com.cooter.leancloud D/LoggingInterceptor: Response: 200
server: nginx
date: Sat, 19 Jan 2019 23:32:05 GMT
content-type: application/json;charset=utf-8
vary: Accept-Encoding
cache-control: no-cache,no-store
pragma: no-cache
strict-transport-security: max-age=31536000

{"id":"a3ae5e6b05183f16502d780dab3cbf72","query_id":"4db834d0b95f1e598b701c55ec5654a8"} 

01-20 07:32:06.009 24593-24593/com.cooter.leancloud D/DirectlyOperationTube: loginLiveQuery...
01-20 07:32:06.013 24593-24593/com.cooter.leancloud D/RequestCache: add request cache. client=leancloud_livequery_default_id, conv=null, request=-65535
01-20 07:32:06.058 24593-24593/com.cooter.leancloud W/System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'void cn.leancloud.websocket.AVStandardWebSocketClient.send(cn.leancloud.command.CommandPacket)' on a null object reference
01-20 07:32:06.058 24593-24593/com.cooter.leancloud W/System.err: at cn.leancloud.session.AVConnectionManager.sendPacket(AVConnectionManager.java:238)
01-20 07:32:06.058 24593-24593/com.cooter.leancloud W/System.err: at cn.leancloud.livequery.LiveQueryOperationDelegate.login(LiveQueryOperationDelegate.java:26)
01-20 07:32:06.058 24593-24593/com.cooter.leancloud W/System.err: at cn.leancloud.im.DirectlyOperationTube.loginLiveQueryDirectly(DirectlyOperationTube.java:210)
01-20 07:32:06.058 24593-24593/com.cooter.leancloud W/System.err: at cn.leancloud.im.DirectlyOperationTube.loginLiveQuery(DirectlyOperationTube.java:203)
01-20 07:32:06.058 24593-24593/com.cooter.leancloud W/System.err: at cn.leancloud.livequery.AVLiveQuery.loginLiveQuery(AVLiveQuery.java:189)
01-20 07:32:06.058 24593-24593/com.cooter.leancloud W/System.err: at cn.leancloud.livequery.AVLiveQuery.access$200(AVLiveQuery.java:26)
01-20 07:32:06.058 24593-24593/com.cooter.leancloud W/System.err: at cn.leancloud.livequery.AVLiveQuery$1.onNext(AVLiveQuery.java:161)
01-20 07:32:06.058 24593-24593/com.cooter.leancloud W/System.err: at cn.leancloud.livequery.AVLiveQuery$1.onNext(AVLiveQuery.java:150)
01-20 07:32:06.058 24593-24593/com.cooter.leancloud W/System.err: at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.drainNormal(ObservableObserveOn.java:201)
01-20 07:32:06.058 24593-24593/com.cooter.leancloud W/System.err: at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.run(ObservableObserveOn.java:255)
01-20 07:32:06.058 24593-24593/com.cooter.leancloud W/System.err: at io.reactivex.android.schedulers.HandlerScheduler$ScheduledRunnable.run(HandlerScheduler.java:119)
01-20 07:32:06.058 24593-24593/com.cooter.leancloud W/System.err: at android.os.Handler.handleCallback(Handler.java:739)
01-20 07:32:06.058 24593-24593/com.cooter.leancloud W/System.err: at android.os.Handler.dispatchMessage(Handler.java:95)
01-20 07:32:06.058 24593-24593/com.cooter.leancloud W/System.err: at android.os.Looper.loop(Looper.java:148)
01-20 07:32:06.058 24593-24593/com.cooter.leancloud W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5554)
01-20 07:32:06.058 24593-24593/com.cooter.leancloud W/System.err: at java.lang.reflect.Method.invoke(Native Method)
01-20 07:32:06.058 24593-24593/com.cooter.leancloud W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:935)
01-20 07:32:06.058 24593-24593/com.cooter.leancloud W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:726)

--------- beginning of crash

01-20 07:32:06.059 24593-24593/com.cooter.leancloud E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.cooter.leancloud, PID: 24593
java.lang.NullPointerException: Attempt to invoke virtual method 'void cn.leancloud.websocket.AVStandardWebSocketClient.send(cn.leancloud.command.CommandPacket)' on a null object reference
at cn.leancloud.session.AVConnectionManager.sendPacket(AVConnectionManager.java:238)
at cn.leancloud.livequery.LiveQueryOperationDelegate.login(LiveQueryOperationDelegate.java:26)
at cn.leancloud.im.DirectlyOperationTube.loginLiveQueryDirectly(DirectlyOperationTube.java:210)
at cn.leancloud.im.DirectlyOperationTube.loginLiveQuery(DirectlyOperationTube.java:203)
at cn.leancloud.livequery.AVLiveQuery.loginLiveQuery(AVLiveQuery.java:189)
at cn.leancloud.livequery.AVLiveQuery.access$200(AVLiveQuery.java:26)
at cn.leancloud.livequery.AVLiveQuery$1.onNext(AVLiveQuery.java:161)
at cn.leancloud.livequery.AVLiveQuery$1.onNext(AVLiveQuery.java:150)
at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.drainNormal(ObservableObserveOn.java:201)
at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.run(ObservableObserveOn.java:255)
at io.reactivex.android.schedulers.HandlerScheduler$ScheduledRunnable.run(HandlerScheduler.java:119)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5554)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:935)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:726)

--------- beginning of system

01-20 07:32:06.073 24593-24593/com.cooter.leancloud I/Process: killProcess pid=24593
java.lang.RuntimeException
at android.os.Process.killProcess(Process.java:1142)
at com.android.internal.os.RuntimeInit$UncaughtHandler.uncaughtException(RuntimeInit.java:100)
at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693)
at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690)
at io.reactivex.plugins.RxJavaPlugins.uncaught(RxJavaPlugins.java:429)
at io.reactivex.plugins.RxJavaPlugins.onError(RxJavaPlugins.java:383)
at io.reactivex.android.schedulers.HandlerScheduler$ScheduledRunnable.run(HandlerScheduler.java:121)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5554)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:935)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:726)
01-20 07:32:06.073 24593-24593/com.cooter.leancloud I/Process: Sending signal. PID: 24593 SIG: 9

AVIMMessageOption.setPushData 不符合当初设计的需求

先看看 js 和 objc 的实例代码:

var { Realtime, TextMessage } = require('leancloud-realtime');
var realtime = new Realtime({ appId: '', region: 'cn' });
realtime.createIMClient('Tom').then(function (host) {
    return host.createConversation({
        members: ['Jerry'],
        name: 'Tom & Jerry',
        unique: true
    });
}).then(function (conversation) {
    console.log(conversation.id);
    return conversation.send(new TextMessage('耗子,今晚有比赛,我约了 Kate,咱们仨一起去酒吧看比赛啊?!'), {
        pushData: {
            "alert": "您有一条未读的消息",
            "category": "消息",
            "badge": 1,
            "sound": "声音文件名,前提在应用里存在",
            "custom-key": "由用户添加的自定义属性,custom-key 仅是举例,可随意替换"
        }
    });
}).then(function (message) {
    console.log(message);
}).catch(console.error);
AVIMMessageOption *option = [[AVIMMessageOption alloc] init];
option.pushData = @{@"alert" : @"您有一条未读消息", @"sound" : @"message.mp3", @"badge" : @1, @"custom-key" : @"由用户添加的自定义属性,custom-key 仅是举例,可随意替换"};
[conversation sendMessage:[AVIMTextMessage messageWithText:@"耗子,今晚有比赛,我约了 Kate,咱们仨一起去酒吧看比赛啊?!" attributes:nil] option:option callback:^(BOOL succeeded, NSError * _Nullable error) {
    // 在这里处理发送失败或者成功之后的逻辑
}];

android 的问题

AVIMMessageOption messageOption = new AVIMMessageOption();
messageOption.setPushData("自定义离线消息推送内容");

这里不应该由开发者直接提交一个 string 类型,而应该向 js 和 objc 一样将 push 的内容拆解成一个一个规定的 key-value 的模式。

我现在很怀疑 android 用是不是压根儿没用过这个接口,这个设置成 string 的几乎不可用啊。

android sdk 反序列化老版本 installation 数据的时候会报错

文件内容示例:

{ "@type":"com.avos.avoscloud.AVInstallation","objectId":"4DxgwI9RKKgwVt04VvKKfBKoOGIEQXXB","updatedAt":null,"createdAt":"2018-12-29T01:49:05.561Z","className":"_Installation","serverData":{"@type":"java.util.concurrent.ConcurrentHashMap","deviceType":"android","timeZone":"Asia/Shanghai","installationId":"df0c633543d24e29fd58293c3d07dfda"}}

出错堆栈如下:

com.alibaba.fastjson.JSONException: Attempt to invoke virtual method 'boolean java.lang.Class.isAnnotationPresent(java.lang.Class)' on a null object reference
        at com.alibaba.fastjson.parser.DefaultJSONParser.parseObject(DefaultJSONParser.java:690)
        at com.alibaba.fastjson.parser.DefaultJSONParser.parseObject(DefaultJSONParser.java:659)
        at com.alibaba.fastjson.JSON.parseObject(JSON.java:238)
        at com.alibaba.fastjson.JSON.parseObject(JSON.java:210)
        at com.alibaba.fastjson.JSON.parseObject(JSON.java:169)
        at cn.leancloud.AVObject.parseAVObject(AVObject.java:978)
        at cn.leancloud.AVInstallation.createInstanceFromLocal(AVInstallation.java:65)
        at cn.leancloud.AVInstallation.getCurrentInstallation(AVInstallation.java:50)
        at cn.leancloud.chatkitapplication.App.onCreate(App.java:52)
        at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1118)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5791)
        at android.app.ActivityThread.-wrap1(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1661)
        at android.os.Handler.dispatchMessage(Handler.java:105)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6541)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
     Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Class.isAnnotationPresent(java.lang.Class)' on a null object reference
        at com.alibaba.fastjson.parser.ParserConfig.checkAutoType(ParserConfig.java:368)
        at com.alibaba.fastjson.parser.DefaultJSONParser.parseObject(DefaultJSONParser.java:314)
        at com.alibaba.fastjson.parser.DefaultJSONParser.parseObject(DefaultJSONParser.java:1087)
        at cn.leancloud.ObjectTypeAdapter.deserialze(ObjectTypeAdapter.java:64)

Failed to resolve: cn.leancloud:leancloud-sdk:5.0.0

Gradle 配置
implementation 'cn.leancloud:storage-android:5.0.0'
implementation 'cn.leancloud:storage-android:5.0.1'
implementation 'cn.leancloud:storage-android:5.0.2'
都提示
Failed to resolve: cn.leancloud:leancloud-sdk:5.0.0

增加查看发送消息进度的方法

用户在发送视频消息时有监听进度的需求,OC 中有 progressBlock 可以查看发送消息进度。

- (void)sendMessage:(AVIMMessage *)message
      progressBlock:(void (^)(NSInteger))progressBlock
           callback:(void (^)(BOOL, NSError * _Nullable))callback{
}

AVUser wiki 文档貌似有问题

AVUser.alwaysUseSubUserClass(subUser.class);
这个在文章末尾提到的要想返回的 AVUser 替换成自定义子类 需要设置的方法,貌似在Api中并没有提供

使用AVFile 文件路径中带点将会nullpointer

初始化

AVObject.registerSubclass(WallpaperObject::class.java)
        AVOSCloud.initialize(leanCloudProperties.id, leanCloudProperties.clientKey)
        AVOSCloud.setLogLevel(AVLogger.Level.INFO)
        AVOSCloud.setMasterKey(leanCloudProperties.masterKey)

使用AVFile

    val avFile = AVFile("$imageName.jpeg",imageFile)
                avFile.save()
                return avFile.url

定位是有"."的时候会调用FileUtil中

  public static String getMimeTypeFromLocalFile(String localPath) {
    if (!StringUtil.isEmpty(localPath) && localPath.contains(".")) {
      String extension = localPath.substring(localPath.lastIndexOf('.') + 1);
      if (!StringUtil.isEmpty(extension)) {
        return detector.getMimeTypeFromExtension(extension);
      }
    }
    return "";
  }

我看了FileUtil 中,是config 方法初始化 detector,但是没有任何调用,所以这里一定是为空的

createChatroom 支持 members 参数为 null

目前文档中的示例代码,createChatroom 传入的 members 参数为 null:

tom.createChatRoom(null, "聊天室", null, ...

并且指出:

聊天室因为没有成员列表,所以创建的时候指定 members 是没有意义的

但是实际上 createChatRoom 最终调用的 createConversation 方法会检查 members 不为空(null 或空列表):

  private void createConversation(final List<String> members, ...) {
    if (null == members || members.size() < 1) {
      if (callback != null) {
        callback.internalDone(null, AVIMException.wrapperAVException(new IllegalArgumentException("members should not be empty")));
      }
...

android-sdk 看起来也有这个问题:

  private void createConversation(final List<String> members, ...) {
    try {
      AVUtils.ensureElementsNotNull(members, AVSession.ERROR_INVALID_SESSION_ID);
    }

论坛相关帖子:https://forum.leancloud.cn/t/java-sdk/20357/17

Build.VERSION.SDK_INT小于23,context.checkSelfPermission全奔溃了

@TargetApi(Build.VERSION_CODES.N)
private static void startServiceIfRequired(Context context,
final java.lang.Class<? extends android.app.Activity> cls) {
if (isStarted) {
return;
}

if (context == null) {
  LOGGER.d("context is null");
  return;
}

if (PackageManager.PERMISSION_GRANTED != context.checkSelfPermission("android.permission.INTERNET")) {

调用AVIMConversationsQuery.findInBackground 必现ANR

版本信息: 即时通讯SDK cn.leancloud:realtime-android:5.0.13
现象: 调用AVIMConversationsQuery.findInBackground API 会导致ANR,
出现概率:必现
调用代码:

 AVIMConversationsQuery query = LCChatKit.getInstance().getClient().getConversationsQuery();
    query.setLimit(20);
    // sdk 的bug ?,如果查询本地数据cache文件失败会导致anr,改用只从网络查询则不会导致ANR
    // query.setQueryPolicy(AVQuery.CachePolicy.NETWORK_ONLY);
    query.findInBackground(new AVIMConversationQueryCallback() {
      @Override
      public void done(List<AVIMConversation> conversations, AVIMException e) {
        if (e != null) {
          Log.e("tag", "conversations error ", e);
        } else {
          Log.e("tag", "conversations done " + conversations, new Exception());
        }
      }
    });

错误堆栈:

"main" prio=5 tid=1 Waiting
  | group="main" sCount=1 dsCount=0 flags=1 obj=0x7482df60 self=0xe425c000
  | sysTid=4058 nice=-10 cgrp=default sched=0/0 handle=0xe8e78494
  | state=S schedstat=( 1656191893 718418542 983 ) utm=126 stm=39 core=0 HZ=100
  | stack=0xff66c000-0xff66e000 stackSize=8MB
  | held mutexes=
  at java.lang.Object.wait(Native method)
  - waiting on <0x0d8c3c9a> (a java.lang.Object)
  at java.lang.Thread.parkFor$(Thread.java:2137)
  - locked <0x0d8c3c9a> (a java.lang.Object)
  at sun.misc.Unsafe.park(Unsafe.java:358)
  at java.util.concurrent.locks.LockSupport.park(LockSupport.java:190)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:868)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1021)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1328)
  at java.util.concurrent.CountDownLatch.await(CountDownLatch.java:232)
  at io.reactivex.internal.observers.BlockingBaseObserver.blockingGet(BlockingBaseObserver.java:71)
  at io.reactivex.Observable.blockingFirst(Observable.java:5047)
  at cn.leancloud.im.v2.AVIMConversationsQuery.queryFromCache(AVIMConversationsQuery.java:554)
  at cn.leancloud.im.v2.AVIMConversationsQuery.findInBackground(AVIMConversationsQuery.java:518)
  at cn.leancloud.chatkit.activity.LCIMConversationListFragment.updateConversationList(LCIMConversationListFragment.java:116)
  at cn.leancloud.chatkit.activity.LCIMConversationListFragment.onActivityCreated(LCIMConversationListFragment.java:63)
  at android.support.v4.app.Fragment.performActivityCreated(Fragment.java:2363)
  at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1442)
  at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1740)
  at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1809)
  at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:799)
  at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2580)
  at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2367)
  at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2322)
  at android.support.v4.app.FragmentManagerImpl.execSingleAction(FragmentManager.java:2199)
  at android.support.v4.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:651)
  at android.support.v4.app.FragmentStatePagerAdapter.finishUpdate(FragmentStatePagerAdapter.java:167)
  at android.support.v4.view.ViewPager.populate(ViewPager.java:1236)
  at android.support.v4.view.ViewPager.populate(ViewPager.java:1084)
  at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1614)
  at android.view.View.measure(View.java:23169)
  at android.widget.LinearLayout.measureVertical(LinearLayout.java:978)
  at android.widget.LinearLayout.onMeasure(LinearLayout.java:704)
  at android.view.View.measure(View.java:23169)
  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6749)
  at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
  at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:139)
  at android.view.View.measure(View.java:23169)
  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6749)
  at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1535)
  at android.widget.LinearLayout.measureVertical(LinearLayout.java:825)
  at android.widget.LinearLayout.onMeasure(LinearLayout.java:704)
  at android.view.View.measure(View.java:23169)
  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6749)
  at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
  at android.view.View.measure(View.java:23169)
  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6749)
  at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1535)
  at android.widget.LinearLayout.measureVertical(LinearLayout.java:825)
  at android.widget.LinearLayout.onMeasure(LinearLayout.java:704)
  at android.view.View.measure(View.java:23169)
  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6749)
  at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
  at com.android.internal.policy.DecorView.onMeasure(DecorView.java:716)
  at android.view.View.measure(View.java:23169)
  at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2718)
  at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1572)
  at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1855)
  at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1460)
  at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7183)
  at android.view.Choreographer$CallbackRecord.run(Choreographer.java:949)
  at android.view.Choreographer.doCallbacks(Choreographer.java:761)
  at android.view.Choreographer.doFrame(Choreographer.java:696)
  at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:935)
  at android.os.Handler.handleCallback(Handler.java:873)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  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)

通过query.get(ObjectId)方法App无响应

通过ObjectId的方法获取AVObject,导致App无响应。

implementation('cn.leancloud:storage-android:5.0.5')
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
implementation 'com.alibaba:fastjson:1.1.70.android'

当执行到:

        AVQuery<AVObject> avQuery = new AVQuery<>("DemoObject");
        AVObject object = avQuery.get("5c31b8df0b616000678ccaf4"); //<==执行到这里的时候

App就开始无响应了

2019-01-06 16:44:45.092 1434-6495/? W/audio_hw_generic: Not supplying enough data to HAL, expected position 21885938 , only wrote 21885840
2019-01-06 16:44:45.875 1434-6495/? W/audio_hw_generic: Hardware backing HAL too slow, could only write 0 of 720 frames
    
    --------- beginning of system
2019-01-06 16:44:46.990 1701-1719/system_process E/BatteryStatsService: modem info is invalid: ModemActivityInfo{ mTimestamp=0 mSleepTimeMs=0 mIdleTimeMs=0 mTxTimeMs[]=[0, 0, 0, 0, 0] mRxTimeMs=0 mEnergyUsed=0}
2019-01-06 16:44:48.304 1434-1608/? W/audio_hw_generic: Not supplying enough data to HAL, expected position 22192293 , only wrote 22039920
2019-01-06 16:44:52.352 1701-1715/system_process E/memtrack: Couldn't load memtrack module
2019-01-06 16:44:52.353 1701-1715/system_process W/android.os.Debug: failed to get memory consumption info: -1
2019-01-06 16:44:52.366 1701-1715/system_process E/memtrack: Couldn't load memtrack module
2019-01-06 16:44:52.366 1701-1715/system_process W/android.os.Debug: failed to get memory consumption info: -1
2019-01-06 16:44:55.690 2596-24754/com.google.android.googlequicksearchbox:search I/EventLogSendingHelper: Sending log events.
2019-01-06 16:44:55.853 2440-24756/com.google.android.gms.persistent I/NetRec: [4814] afrb.a: Refreshing scores for 1 networks.
2019-01-06 16:44:57.782 1701-1715/system_process E/memtrack: Couldn't load memtrack module
2019-01-06 16:44:57.782 1701-1715/system_process W/android.os.Debug: failed to get memory consumption info: -1
2019-01-06 16:44:58.059 2440-24756/com.google.android.gms.persistent W/NetRec: [4814] afrb.a: Timeout after 2201 ms while waiting for score updates. Rescheduling.
2019-01-06 16:44:58.063 2440-24756/com.google.android.gms.persistent I/NetRec: [4814] afrb.a: Still entries pending update, scheduling new refresh_scores_task refresh.
2019-01-06 16:44:58.071 2440-24756/com.google.android.gms.persistent I/NetRec: [4814] afrb.a: Completed refresh_scores_task score refresh task in 2219 ms, returning 1
2019-01-06 16:44:58.074 2440-24283/com.google.android.gms.persistent E/NetworkScheduler: Invalid component specified.

AVInstallation.getCurrentInstallation().remove 的时候崩溃

addNewOperation方法中 Object newValue = op.apply(oldValue);(这句话源码里面直接返回的是空)下面put直接就崩
this.serverData.put(op.getField(), newValue);

Caused by: java.lang.NullPointerException
at java.util.concurrent.ConcurrentHashMap.putVal(ConcurrentHashMap.java:990)
at java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:985)
at cn.leancloud.AVObject.addNewOperation(AVObject.java:400)
at cn.leancloud.AVObject.remove(AVObject.java:350)
at com.fhedu.student.manage.PushManage.subscribeClass(PushManage.java:26)

saveAll

使用AVObject.saveAll如何知道已经保存成功?看到了你们源码,只是调用saveAllInBackground,然后变成阻塞执行。当字段类型错误的时候,也并没有抛出Exception.

feature list

storage core.

  • fetch object
  • save object with primitive k/v type
  • update/remove object with primitive k/v type
  • support acl/role
  • update / remove object with object
  • update / remove relation with object
  • subclass for avobject
  • avuser
  • avfile
  • subclass for avuser
  • avquery
  • installation
  • local persistence
  • support cascading save for AVObject.
  • AVObject.save support SaveOption.
  • AVObject loop-ref detect.

Android SDK需要适配Android P,否则会直接crash

在Android P上,Google移除了apache库,不允许所有的app使用,需要升级项目代码使用HttpUrlConnection,否则项目会直接崩溃,支持Android P的手机马上就要批量上市了,现在Leancloud还没有完成适配,到时候所有使用Leancloud服务的app都会直接闪退!!
可以参考这个文章适配:https://segmentfault.com/a/1190000015276811
以下是报错:

java.lang.NoClassDefFoundError: Failed resolution of: [Lorg/apache/http/Header;
at com.avos.avoscloud.AsyncHttpResponseHandler.getHeaders(AsyncHttpResponseHandler.java:52)
at com.avos.avoscloud.AsyncHttpResponseHandler.onResponse(AsyncHttpResponseHandler.java:42)
at okhttp3.RealCall$AsyncCall.execute(RealCall.java:141)
at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.http.Header" on path: DexPathList[[zip file "/data/app/com.neo.apollo.piratebay-Fh6jQ8nyLdpoPo-ca18r2w==/base.apk"],nativeLibraryDirectories=[/data/app/com.neo.apollo.piratebay-Fh6jQ8nyLdpoPo-ca18r2w==/lib/arm64, /system/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:171)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.avos.avoscloud.AsyncHttpResponseHandler.getHeaders(AsyncHttpResponseHandler.java:52) 
at com.avos.avoscloud.AsyncHttpResponseHandler.onResponse(AsyncHttpResponseHandler.java:42) 
at okhttp3.RealCall$AsyncCall.execute(RealCall.java:141) 
at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
at java.lang.Thread.run(Thread.java:764) 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.