适用于Android的AppleMusicKit库

8yparm6h  于 2023-03-11  发布在  Android
关注(0)|答案(1)|浏览(173)

我正在开发一个android应用程序的形式AppleMusicKit。我已经取得了用户播放列表和专辑使用API的。但现在我试图播放一首歌曲使用代码

val tokenProvider = object : TokenProvider {
                override fun getDeveloperToken(): String = token.developerToken
                override fun getUserToken(): String = token.userToken
            }
            val applePlayerController = MediaPlayerControllerFactory.createLocalController(applicationContext, tokenProvider)
            val queueProviderBuilder = CatalogPlaybackQueueItemProvider.Builder()
            queueProviderBuilder.containers(MediaContainerType.PLAYLIST, id)

当icreateLocalController应用程序崩溃时。这是我得到的异常

java.lang.UnsatisfiedLinkError: No implementation found for int com.apple.android.music.foothill.javanative.FootHillConfig.config(java.lang.String) (tried Java_com_apple_android_music_foothill_javanative_FootHillConfig_config and Java_com_apple_android_music_foothill_javanative_FootHillConfig_config__Ljava_lang_String_2)
                                                                                                        at com.apple.android.music.foothill.javanative.FootHillConfig.config(Native Method)
                                                                                                        at com.apple.android.music.playback.c.g.a(MusicSDK:23)
                                                                                                        at com.apple.android.music.playback.c.b.<init>(MusicSDK:182)
                                                                                                        at com.apple.android.music.playback.c.f.a(MusicSDK:48)
                                                                                                        at com.apple.android.music.playback.controller.a.<init>(MusicSDK:159)
                                                                                                        at com.apple.android.music.playback.controller.MediaPlayerControllerFactory.createLocalController(MusicSDK:62)

我不知道我在这里错过了什么。我也在权限中添加了FOREGROUND_SERVICE。

anhgbhbe

anhgbhbe1#

我已通过添加以下行修复了此问题

static {

        try {
            // Adding these two lines will prevent the OOM false alarm
            System.setProperty("org.bytedeco.javacpp.maxphysicalbytes", "0");
            System.setProperty("org.bytedeco.javacpp.maxbytes", "0");

            System.loadLibrary("c++_shared");
            System.loadLibrary("appleMusicSDK");
        } catch (final Exception e) {
            Log.e(TAG, "Could not load library due to: " + Log.getStackTraceString(e));
            throw e;
        }
    }

相关问题