Skip to content

App crashed on Android with graddle ver. 3.2.1 #3

Description

@doumart

There was first a probleme with

    public List<ViewManager> createJsModules(ReactApplicationContext reactContext) {
      return Collections.emptyList();
 }

I had to remove it since it is no longer a function.

After that i tried your exemple

const openPicker = () => {
    MusicPlayerController.presentPicker(false, (metadata) => {
      // Successfully saved MPMediaItemCollection to NSUserDefaults.
      //    Returns an array of metadata for each track (not all MPMediaItem
      //    fields are copied, only the blantantly needed ones)
      alert(metadata[0].title);
    }, () => {
      // Opened, but user tapped Cancel
      alert('Cancel');
    });
  };
  MusicPlayerController.requestPermission(
    'Permission Required',
    'We need permission to play audio files from your storage. If you decline, you can always toggle this in Settings.',
    () => { // User just tapped to Accept
      openPicker();
    }, () => { // User has already accepted
      openPicker();
    }, () => {

    });

But the app crashes.

E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.scoreboard_mobile, PID: 12369
java.lang.RuntimeException: Illegal callback invocation from native module. This callback type only permits a single invocation from native code.
at com.facebook.react.bridge.CallbackImpl.invoke(CallbackImpl.java:28)
at com.reactlibrary.RNReactNativeMusicplayercontroller$1$1.run(RNReactNativeMusicplayercontroller.java:64)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:159)
at android.app.ActivityThread.main(ActivityThread.java:6146)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

Is this a version mismatch problem or is it me who can't correctly use the lib?

react-native ver = 55.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions