WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Building a exoplayer library for Unity and having issues applying documentation #11217

@Gurwar

Description

@Gurwar

Hello exoplayer community. I am coming from a Unity and c# background and am completely new to Android Studio. I am building a custom exoplayer library and am using available exoplayer resources to do so. Unfortunately they don't apply to building plugins for external use and a lot of the related community discussions are outdated. Here is my code for initializing the player in Java.

public static void initializePlayer(Activity unityPlayer) {
    ExoPlayer player = new ExoPlayer.Builder(unityPlayer).build();
}

Here is the Unity side.

    AndroidJNIHelper.debug = true;
    var playerClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
    AndroidJavaObject activity = playerClass.GetStatic<AndroidJavaObject>("currentActivity");
    Debug.Log("Got activity");
    var plugin = new AndroidJavaClass("com.bmad.exolib.Exo");
    Debug.Log("Found Plugin");
    plugin.CallStatic("test");
    Debug.Log("Found Test");
    plugin.CallStatic("initializePlayer");
    Debug.Log("Found Function");

Unfortunately I hit an error when trying to use the unityPlayer as the context for building the player. Error Unity AndroidJavaException: java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/media3/exoplayer/ExoPlayer$Builder;

Any guidance would be appreciated.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions