React-native-track-player: [BUG] App crashed on android with sdk 26, emulator android 7.0

Created on 27 Mar 2018  Â·  11Comments  Â·  Source: react-native-kit/react-native-track-player

demo - https://github.com/ananevam/RNTrackPlayerCrash
app/build.gradle - https://pastebin.com/hvCYAjrC
app/android/build.gradle - https://pastebin.com/mMb80n4H
adb logcat - https://pastebin.com/r7FD7hE0

TrackPlayer.setupPlayer - crash

03-27 09:52:26.335 26202 26202 D ReactNativeTrackPlayer: Service init
03-27 09:52:26.336 26202 26202 I art : Rejecting re-init on previously-failed class java.lang.Class: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/exoplayer2/ExoPlayer$EventListener;
03-27 09:52:26.336 26202 26202 I art : at void guichaguri.trackplayer.logic.services.PlayerService.onCreate() (PlayerService.java:74)
03-27 09:52:26.336 26202 26202 I art : at void android.app.ActivityThread.handleCreateService(android.app.ActivityThread$CreateServiceData) (ActivityThread.java:3162)
03-27 09:52:26.336 26202 26202 I art : at void android.app.ActivityThread.-wrap5(android.app.ActivityThread, android.app.ActivityThread$CreateServiceData) (ActivityThread.java:-1)
03-27 09:52:26.336 26202 26202 I art : at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1550)
03-27 09:52:26.336 26202 26202 I art : at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
03-27 09:52:26.336 26202 26202 I art : at void android.os.Looper.loop() (Looper.java:154)
03-27 09:52:26.336 26202 26202 I art : at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6077)
03-27 09:52:26.336 26202 26202 I art : at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
03-27 09:52:26.336 26202 26202 I art : at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:866)
03-27 09:52:26.336 26202 26202 I art : at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:756)
03-27 09:52:26.336 26202 26202 I art : Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.exoplayer2.ExoPlayer$EventListener" on path: DexPathList[[zip file "/data/app/com.rntrackplayercrash-1/base.apk"],nativeLibraryDirectories=[/data/app/com.rntrackplayercrash-1/lib/x86, /data/app/com.rntrackplayercrash-1/base.apk!/lib/x86, /system/lib, /vendor/lib]]
03-27 09:52:26.336 26202 26202 I art : at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56)
03-27 09:52:26.336 26202 26202 I art : at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:380)
03-27 09:52:26.336 26202 26202 I art : at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
03-27 09:52:26.336 26202 26202 I art : at void guichaguri.trackplayer.logic.services.PlayerService.onCreate() (PlayerService.java:74)
03-27 09:52:26.336 26202 26202 I art : at void android.app.ActivityThread.handleCreateService(android.app.ActivityThread$CreateServiceData) (ActivityThread.java:3162)
03-27 09:52:26.336 26202 26202 I art : at void android.app.ActivityThread.-wrap5(android.app.ActivityThread, android.app.ActivityThread$CreateServiceData) (ActivityThread.java:-1)
03-27 09:52:26.336 26202 26202 I art : at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1550)
03-27 09:52:26.336 26202 26202 I art : at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
03-27 09:52:26.336 26202 26202 I art : at void android.os.Looper.loop() (Looper.java:154)
03-27 09:52:26.336 26202 26202 I art : at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6077)
03-27 09:52:26.336 26202 26202 I art : at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
03-27 09:52:26.336 26202 26202 I art : at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:866)
03-27 09:52:26.336 26202 26202 I art : at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:756)

All 11 comments

i have the same problem , and its caused by google play services version
i have firebase that uses a version of play services which track player doesn't support

and it is all because of the cast feature , i want to remove it from the module

Same for me. Can't make it work with sdk 26. Worst of all I have both react-native-track-player and react-native-fbsdk. So I can't downgrade sdk, because react-native-fbsdk requires sdk 26.

Just try to remove cast feature. Follow the native event branch
And search the commits for removed cast feature

It is solved for me

On Tue, Mar 27, 2018, 4:01 PM Aleksandr notifications@github.com wrote:

Same for me. Can't make it work with sdk 26. Worst of all I have both
react-native-track-player and react-native-fbsdk. So I can't downgrade sdk,
because react-native-fbsdk requires sdk 26.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/react-native-kit/react-native-track-player/issues/166#issuecomment-376516264,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AIclu3sXrEgx8qTQhQ8xDZz8XaZZ3Hd5ks5tijhGgaJpZM4S8oiS
.

react-native-track-player.zip

remove track player from node modules, and extract this in node modules

@RekarBotany In the dev branch, the Cast support was removed to be moved to a new package.
You can install it running npm install --save react-native-kit/react-native-track-player#dev

The problem seems to be the support lib, which has to be updated to API level 26. I started updating it in #165

just curious, when are we planning to have #165 released?

@Guichaguri Dev branch also didn't wok for me. I think we need #165 as a major fix.

Same for me, Android 8.1.0 API 27

    --------- beginning of crash
07-30 15:25:26.312 10439-10439/com.app.demoE/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.app.demo, PID: 10439
    java.lang.NoSuchMethodError: No direct method <init>(Landroid/content/Context;Ljava/lang/String;)V in class Landroid/support/v4/app/NotificationCompat$Builder; or its super classes (declaration of 'android.support.v4.app.NotificationCompat$Builder' appears in /data/app/com.app.demo-WeU5JdMWjaKCiUYzH-lNLA==/base.apk)
        at guichaguri.trackplayer.metadata.components.MediaNotification.<init>(MediaNotification.java:58)
        at guichaguri.trackplayer.metadata.Metadata.<init>(Metadata.java:59)
        at guichaguri.trackplayer.logic.MediaManager.<init>(MediaManager.java:39)
        at guichaguri.trackplayer.logic.services.PlayerService.onCreate(PlayerService.java:74)
        at android.app.ActivityThread.handleCreateService(ActivityThread.java:3339)
        at android.app.ActivityThread.-wrap4(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1677)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6494)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)


    --------- beginning of system

hi @RekarBotany,
Thank you for your advise, I got same issue, but how can I disable google play services version?
in your zip file, I found that you command the line:
// Google Cast (Update this when RN updates the support library to 25+)
//compile 'com.google.android.gms:play-services-cast-framework:9.4.0'

I don't have this line in my project, still get this issue.

I got this error and it was fixed by adding exoplayer-core to the app level Gradle file:

implementation 'com.google.android.exoplayer:exoplayer-core:r2.4.3'

Then clean your project and build again.

Should not be a problem with v1.0.0

Was this page helpful?
0 / 5 - 0 ratings