java.lang.AssertionError: Instance must be configured before use in VimeoSdl library

生来就可爱ヽ(ⅴ<●) 提交于 2021-01-27 19:15:10

问题


using this https://github.com/vimeo/vimeo-networking-java for vimeo video player.using compile

com.vimeo.networking:vimeo-networking:1.0.1

in build.gradle but still error

Getting error:

FATAL EXCEPTION: main

Process: com.sample.vimeosdkapplication, PID: 2113

    java.lang.AssertionError: Instance must be configured before use
    at com.vimeo.networking.VimeoClient.getInstance(VimeoClient.java:94)
    at com.sample.vimeosdkapplication.MainActivity.<init>(MainActivity.java:28)
    at java.lang.reflect.Constructor.newInstance(Native Method)
    at java.lang.Class.newInstance(Class.java:1572)
    at android.app.Instrumentation.newActivity(Instrumentation.java:1065)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2199)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
    at android.app.ActivityThread.access$800(ActivityThread.java:144)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:135)
    at android.app.ActivityThread.main(ActivityThread.java:5221)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
    07-22 16:56:57.000 2113-2120/com.sample.vimeosdkapplication W/art: Suspending all threads took: 10ms

回答1:


You'll need to initialize the VimeoClient class. You can find out how to do it in this section of the README.

You'll need to build the builder with the options you want for the library and then call initialize.

Here is an example of a builder:

Configuration.Builder configBuilder =
      new Configuration.Builder(clientId, clientSecret, SCOPE,
                                testAccountStore, new AndroidGsonDeserializer())
          .setCacheDirectory(this.getCacheDir())

Then you statically call initialize here:

VimeoClient.initialize(<your builder here>);


来源:https://stackoverflow.com/questions/38526159/java-lang-assertionerror-instance-must-be-configured-before-use-in-vimeosdl-lib

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!