gpt4 book ai didi

android - 安卓应用添加优酷播放库

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:03:01 24 4
gpt4 key购买 nike

我必须在我的 Android 应用程序中使用优酷播放器库并完成所需的一切。在我的 Application 类中添加 YoukuPlayerConfig

public class App extends Application {

@Override
public void onCreate() {
super.onCreate();
YoukuPlayerConfig.setLog(false);
YoukuPlayerConfig.setClientIdAndSecret(CLIENT_ID_WITH_AD, CLIENT_SECRET_WITH_AD);
YoukuPlayerConfig.onInitial(this);
}
}

在我的AndroidManifest.xml 文件中添加所有权限

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.android.launcher.permission.READ_SETTINGS" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />

但是收到这个错误:

java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.randa.android-1/base.apk"],nativeLibraryDirectories=[/data/app/com.randa.android-1/lib/x86, /data/app/com.example.android-1/base.apk!/lib/x86, /system/lib, /vendor/lib]]] couldn't find "libnetcache.so"
at java.lang.Runtime.loadLibrary0(Runtime.java:972)
at java.lang.System.loadLibrary(System.java:1530)
at com.youku.uplayer.NetCache.<clinit>(NetCache.java:17)
at com.youku.uplayer.NetCache.SetUserAgent(Native Method)
at com.youku.uplayer.PlayerNetCache.setUserAgent(PlayerNetCache.java:32)
at com.youku.cloud.playercore.PlayerCoreManager.initNetCache(PlayerCoreManager.java:48)
at com.youku.cloud.playercore.PlayerCoreManager.init(PlayerCoreManager.java:21)
at com.youku.cloud.player.YoukuPlayerConfig.onInitial(YoukuPlayerConfig.java:44)
at com.example.android.App.onCreate(App.java:43)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1024)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5361)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1528)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)

有什么建议吗?

最佳答案

我解决了。 YoukuPlayerOpenSDK-release.aar只支持armeabi-v7a。

  1. gradle.properties file add this: android.useDeprecatedNdk=true
  2. build.gradle file setting ndk abiFilters:
   ndk {
abiFilters 'armeabi-v7a'// 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64', 'mips', 'mips64'
}

关于android - 安卓应用添加优酷播放库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52439856/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com