rborn Github contribution chart
rborn Github Stats
rborn Most Used Languages

Activity

29 Sep 2022

Rborn

Package react-native-safe-area-context contains invalid configuration: "dependency.platforms.android.libraryName" is not allowed

warn Package react-native-safe-area-context contains invalid configuration: "dependency.platforms.android.libraryName" is not allowed,"dependency.platforms.android.componentDescriptors" is not allowed,"dependency.platforms.android.cmakeListsPath" is not allowed. Please verify it's properly linked using "react-native config" command and contact the package maintainers about this.

Forked On 29 Sep 2022 at 08:13:58

Rborn

yes it is ❤️

Commented On 29 Sep 2022 at 08:13:58

Rborn

Service.startForeground() not allowed due to mAllowStartForeground false

Describe the Bug Production crashes. 99% on Android 12. 100% with the app in the background.

Fatal Exception: java.lang.RuntimeException: Unable to create service com.guichaguri.trackplayer.service.MusicService: android.app.ForegroundServiceStartNotAllowedException: Service.startForeground() not allowed due to mAllowStartForeground false: service com.economist.darwin/com.guichaguri.trackplayer.service.MusicService
       at android.app.ActivityThread.handleCreateService(ActivityThread.java:4567)
       at android.app.ActivityThread.access$1700(ActivityThread.java:256)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2110)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loopOnce(Looper.java:201)
       at android.os.Looper.loop(Looper.java:288)
       at android.app.ActivityThread.main(ActivityThread.java:7870)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003) 
Caused by android.app.ForegroundServiceStartNotAllowedException: Service.startForeground() not allowed due to mAllowStartForeground false: service com.economist.darwin/com.guichaguri.trackplayer.service.MusicService
       at android.app.ForegroundServiceStartNotAllowedException$1.createFromParcel(ForegroundServiceStartNotAllowedException.java:54)
       at android.app.ForegroundServiceStartNotAllowedException$1.createFromParcel(ForegroundServiceStartNotAllowedException.java:50)
       at android.os.Parcel.readParcelable(Parcel.java:3334)
       at android.os.Parcel.createExceptionOrNull(Parcel.java:2421)
       at android.os.Parcel.createException(Parcel.java:2410)
       at android.os.Parcel.readException(Parcel.java:2393)
       at android.os.Parcel.readException(Parcel.java:2335)
       at android.app.IActivityManager$Stub$Proxy.setServiceForeground(IActivityManager.java:7158)
       at android.app.Service.startForeground(Service.java:736)
       at com.guichaguri.trackplayer.service.MusicService.onCreate(MusicService.java:125)
       at android.app.ActivityThread.handleCreateService(ActivityThread.java:4554)
       at android.app.ActivityThread.access$1700(ActivityThread.java:256)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2110)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loopOnce(Looper.java:201)
       at android.os.Looper.loop(Looper.java:288)
       at android.app.ActivityThread.main(ActivityThread.java:7870)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003) 

Steps To Reproduce I haven't been able to reproduce it, but It has happened in production many times.

Code To Reproduce

 private void onStartForeground() {
        try {
            boolean serviceForeground = false;

            if(manager != null) {
                // The session is only active when the service is on foreground
                serviceForeground = manager.getMetadata().getSession().isActive();
            }

            if(!serviceForeground) {
                ReactInstanceManager reactInstanceManager = getReactNativeHost().getReactInstanceManager();
                ReactContext reactContext = reactInstanceManager.getCurrentReactContext();

                // Checks whether there is a React activity
                if(reactContext == null || !reactContext.hasCurrentActivity()) {
                    String channel = Utils.getNotificationChannel((Context) this);

                    // Sets the service to foreground with an empty notification
                    startForeground(1, new NotificationCompat.Builder(this, channel).build());
                    // Stops the service right after
                    stopSelf();
                }
            }
        } catch(Exception ex) {
            // This method shouldn't be throwing unhandled errors even if something goes wrong.
            Log.e(Utils.LOG, "An error occurred while starting foreground", ex);
        }
    } 

Environment Info:

System:
    OS: macOS 12.2.1
    CPU: (10) x64 Apple M1 Max
    Memory: 25.82 MB / 32.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.15.0 - ~/.nvm/versions/node/v14.15.0/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v14.15.0/bin/yarn
    npm: 6.14.8 - ~/.nvm/versions/node/v14.15.0/bin/npm
    Watchman: 2022.07.04.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.11.3 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
    Android SDK: Not Found
  IDEs:
    Android Studio: 2021.2 AI-212.5712.43.2112.8609683
    Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.16 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2 
    react-native: 0.67.4 => 0.67.4 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found 

"react-native-track-player": "2.1.2"

I have patched the package to support SDK 31. The reason was that version 2.2.0 was an RC, so not ready for production. I noticed now there's a 3.1.0, but I tried updating and nothing worked, so I'm guessing it's not retro compatible. Also, I saw many issues related to it, so I decided to wait for a more stable version.

How I can Help I found a bunch of information about it, but now many people saying this can be fixed.

https://stackoverflow.com/questions/70044393/fatal-android-12-exception-startforegroundservice-not-allowed-due-to-mallows https://developer.android.com/guide/components/foreground-services#java https://issuetracker.google.com/issues/229000935

Forked On 28 Sep 2022 at 04:02:31

Rborn

@jspizziri these are reports "in the wild" 😅, I'll try to do do it on an emulator but I don't have too much hope

Commented On 28 Sep 2022 at 04:02:31

Rborn

Service.startForeground() not allowed due to mAllowStartForeground false

Describe the Bug Production crashes. 99% on Android 12. 100% with the app in the background.

Fatal Exception: java.lang.RuntimeException: Unable to create service com.guichaguri.trackplayer.service.MusicService: android.app.ForegroundServiceStartNotAllowedException: Service.startForeground() not allowed due to mAllowStartForeground false: service com.economist.darwin/com.guichaguri.trackplayer.service.MusicService
       at android.app.ActivityThread.handleCreateService(ActivityThread.java:4567)
       at android.app.ActivityThread.access$1700(ActivityThread.java:256)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2110)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loopOnce(Looper.java:201)
       at android.os.Looper.loop(Looper.java:288)
       at android.app.ActivityThread.main(ActivityThread.java:7870)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003) 
Caused by android.app.ForegroundServiceStartNotAllowedException: Service.startForeground() not allowed due to mAllowStartForeground false: service com.economist.darwin/com.guichaguri.trackplayer.service.MusicService
       at android.app.ForegroundServiceStartNotAllowedException$1.createFromParcel(ForegroundServiceStartNotAllowedException.java:54)
       at android.app.ForegroundServiceStartNotAllowedException$1.createFromParcel(ForegroundServiceStartNotAllowedException.java:50)
       at android.os.Parcel.readParcelable(Parcel.java:3334)
       at android.os.Parcel.createExceptionOrNull(Parcel.java:2421)
       at android.os.Parcel.createException(Parcel.java:2410)
       at android.os.Parcel.readException(Parcel.java:2393)
       at android.os.Parcel.readException(Parcel.java:2335)
       at android.app.IActivityManager$Stub$Proxy.setServiceForeground(IActivityManager.java:7158)
       at android.app.Service.startForeground(Service.java:736)
       at com.guichaguri.trackplayer.service.MusicService.onCreate(MusicService.java:125)
       at android.app.ActivityThread.handleCreateService(ActivityThread.java:4554)
       at android.app.ActivityThread.access$1700(ActivityThread.java:256)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2110)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loopOnce(Looper.java:201)
       at android.os.Looper.loop(Looper.java:288)
       at android.app.ActivityThread.main(ActivityThread.java:7870)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003) 

Steps To Reproduce I haven't been able to reproduce it, but It has happened in production many times.

Code To Reproduce

 private void onStartForeground() {
        try {
            boolean serviceForeground = false;

            if(manager != null) {
                // The session is only active when the service is on foreground
                serviceForeground = manager.getMetadata().getSession().isActive();
            }

            if(!serviceForeground) {
                ReactInstanceManager reactInstanceManager = getReactNativeHost().getReactInstanceManager();
                ReactContext reactContext = reactInstanceManager.getCurrentReactContext();

                // Checks whether there is a React activity
                if(reactContext == null || !reactContext.hasCurrentActivity()) {
                    String channel = Utils.getNotificationChannel((Context) this);

                    // Sets the service to foreground with an empty notification
                    startForeground(1, new NotificationCompat.Builder(this, channel).build());
                    // Stops the service right after
                    stopSelf();
                }
            }
        } catch(Exception ex) {
            // This method shouldn't be throwing unhandled errors even if something goes wrong.
            Log.e(Utils.LOG, "An error occurred while starting foreground", ex);
        }
    } 

Environment Info:

System:
    OS: macOS 12.2.1
    CPU: (10) x64 Apple M1 Max
    Memory: 25.82 MB / 32.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.15.0 - ~/.nvm/versions/node/v14.15.0/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v14.15.0/bin/yarn
    npm: 6.14.8 - ~/.nvm/versions/node/v14.15.0/bin/npm
    Watchman: 2022.07.04.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.11.3 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
    Android SDK: Not Found
  IDEs:
    Android Studio: 2021.2 AI-212.5712.43.2112.8609683
    Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.16 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2 
    react-native: 0.67.4 => 0.67.4 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found 

"react-native-track-player": "2.1.2"

I have patched the package to support SDK 31. The reason was that version 2.2.0 was an RC, so not ready for production. I noticed now there's a 3.1.0, but I tried updating and nothing worked, so I'm guessing it's not retro compatible. Also, I saw many issues related to it, so I decided to wait for a more stable version.

How I can Help I found a bunch of information about it, but now many people saying this can be fixed.

https://stackoverflow.com/questions/70044393/fatal-android-12-exception-startforegroundservice-not-allowed-due-to-mallows https://developer.android.com/guide/components/foreground-services#java https://issuetracker.google.com/issues/229000935

Forked On 28 Sep 2022 at 03:10:58

Rborn

@jspizziri I keep having this with the 3.1.0 version. (crashlytics reports)

Android 12 and 13

Fatal Exception: android.app.ForegroundServiceStartNotAllowedException: Service.startForeground() not allowed due to mAllowStartForeground false: service com.letsemjoy.app/com.doublesymmetry.trackplayer.service.MusicService
       at android.app.ForegroundServiceStartNotAllowedException$1.createFromParcel(ForegroundServiceStartNotAllowedException.java:54)
       at android.app.ForegroundServiceStartNotAllowedException$1.createFromParcel(ForegroundServiceStartNotAllowedException.java:50)
       at android.os.Parcel.readParcelable(Parcel.java:3345)
       at android.os.Parcel.createExceptionOrNull(Parcel.java:2432)
       at android.os.Parcel.createException(Parcel.java:2421)
       at android.os.Parcel.readException(Parcel.java:2404)
       at android.os.Parcel.readException(Parcel.java:2346)
       at android.app.IActivityManager$Stub$Proxy.setServiceForeground(IActivityManager.java:8094)
       at android.app.Service.startForeground(Service.java:733)
       at com.doublesymmetry.trackplayer.service.MusicService$observeEvents$4$1.emit(MusicService.kt:374)
       at com.doublesymmetry.trackplayer.service.MusicService$observeEvents$4$1.emit(MusicService.kt:371)
       at kotlinx.coroutines.flow.SharedFlowImpl.collect$suspendImpl(SharedFlow.kt:383)
       at kotlinx.coroutines.flow.SharedFlowImpl$collect$1.invokeSuspend(:15)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
       at android.os.Handler.handleCallback(Handler.java:938)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loopOnce(Looper.java:226)
       at android.os.Looper.loop(Looper.java:313)
       at android.app.ActivityThread.main(ActivityThread.java:8669)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135) 

Commented On 28 Sep 2022 at 03:10:58
Issue Comment

Rborn

Postinstall copy of readme should be removed

This will run on yarn install for consumers of this library. Instead of postinstall we should use prepack.

https://github.com/callstack/react-native-slider/blob/8619daf7518c24ff7fdcfced73111d7dd856f727/package/package.json#L22

I'm getting:

error PROJECT_DIR/node_modules/@react-native-community/slider: Command failed.
Exit code: 254
Command: npx copyfiles "./../README.md" ./README.md
Arguments: 
Directory: PROJECT_DIR/node_modules/@react-native-community/slider
Output:
npm ERR! code ENOENT
npm ERR! syscall lstat
npm ERR! path USER_DIR/.node_modules_global/lib
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, lstat 'USER_DIR/.node_modules_global/lib'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

Forked On 27 Sep 2022 at 02:28:51

Rborn

👋 any way to overcome this? basically it prevents me to run yarn :( 🙏

Commented On 27 Sep 2022 at 02:28:51

Rborn

Fix: move postinstall script to prepack

Created On 27 Sep 2022 at 02:25:54

Rborn

Move postinstall script to prepack

Fixes https://github.com/callstack/react-native-slider/issues/430

Pushed On 27 Sep 2022 at 02:21:31

Rborn

Merge pull request #1 from rborn/rborn-patch-1

Move postinstall script to prepack

Pushed On 27 Sep 2022 at 02:21:31

Rborn

Move postinstall script to prepack

Created On 27 Sep 2022 at 02:21:31

Rborn

Move postinstall script to prepack

Created On 27 Sep 2022 at 01:52:00
Create Branch
Rborn In rborn/react-native-slider Create Branchrborn-patch-1

Rborn

React Native component exposing Slider from iOS and SeekBar from Android

On 27 Sep 2022 at 01:05:34

Rborn

React Native component exposing Slider from iOS and SeekBar from Android

Forked On 27 Sep 2022 at 12:59:23

Rborn

A customizable Next.js and Tailwind blog starter. Designed by the Bejamas agency.

Forked On 24 Sep 2022 at 11:52:22

Rborn

Amplitude events are reported as "outside session"

Hello, I updated the module to v2 but now all the Amplitude events are "outside of session" (green) instead of "inside session" (blue)

https://help.amplitude.com/hc/en-us/articles/229313067-Look-up-event-data-for-individual-users#:~:text=Blue%20events%20in%20a%20session,or%20only%20show%20specific%20events.

  • analytics-react-native version: 2.7.0
  • Integrations versions (if used): analytics-react-native-plugin-amplitude-session": "0.3.1"
  • React Native version: 0.67.4
  • Both iOs and Android

Steps to reproduce

I just updated and adapted the module to version 2 (was 1.x before)

my code:

 Analytics = createClient({
            writeKey: configuration.apiKeys.segmentio,
            autoAddSegmentDestination: true,
            trackAppLifecycleEvents: true,
            trackAttributionData: true,
            debug: debugConfigs.segment,
            flushInterval: Config.APP_TYPE === 'test' || Config.APP_TYPE === 'demo' ? 1 : 20,
            flushAt: Config.APP_TYPE === 'test' || Config.APP_TYPE === 'demo' ? 1 : 20,
            trackDeepLinks: true
        });

        Analytics.add({ plugin: new AmplitudeSessionPlugin() }); 

Expected behavior

Amplitude should receive the events as being part of a session while they seem to be interpreted as being sent server side

Actual behavior

All events show as "outside"

Here is a sample of the difference: Screenshot 2022-08-24 at 16 32 09

We are measuring the time the users are stating in the app, and currently this is broken Screenshot 2022-08-24 at 16 47 12

Thank you ❤️

Forked On 13 Sep 2022 at 03:57:26

Rborn

@alanjcharles hey, yes all seems to be working after the new connection setup. Sorry for not getting back to you in time :(

Commented On 13 Sep 2022 at 03:57:26

Rborn

Another SimpleCache instance uses the folder ... TrackPlayer

On the android-redesign branch, I'm bumping into this error:

10-10 19:33:03.219  1845  1845 E AndroidRuntime: java.lang.IllegalStateException: Another SimpleCache instance uses the folder: /data/user/0/com.xxx.xxx/cache/TrackPlayer
10-10 19:33:03.219  1845  1845 E AndroidRuntime:        at com.google.android.exoplayer2.upstream.cache.SimpleCache.<init>(SimpleCache.java:125)
10-10 19:33:03.219  1845  1845 E AndroidRuntime:        at com.google.android.exoplayer2.upstream.cache.SimpleCache.<init>(SimpleCache.java:112)
10-10 19:33:03.219  1845  1845 E AndroidRuntime:        at com.google.android.exoplayer2.upstream.cache.SimpleCache.<init>(SimpleCache.java:84)
10-10 19:33:03.219  1845  1845 E AndroidRuntime:        at com.guichaguri.trackplayer.service.models.Track.toMediaSource(Track.java:148)
10-10 19:33:03.219  1845  1845 E AndroidRuntime:        at com.guichaguri.trackplayer.service.player.ExoPlayback.add(ExoPlayback.java:74)
10-10 19:33:03.219  1845  1845 E AndroidRuntime:        at com.guichaguri.trackplayer.module.MusicModule.lambda$add$2$MusicModule(MusicModule.java:191)
10-10 19:33:03.219  1845  1845 E AndroidRuntime:        at com.guichaguri.trackplayer.module.MusicModule$$Lambda$2.run(Unknown Source:8)
10-10 19:33:03.219  1845  1845 E AndroidRuntime:        at android.os.Handler.handleCallback(Handler.java:789)
10-10 19:33:03.219  1845  1845 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:98)
10-10 19:33:03.219  1845  1845 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:164)
10-10 19:33:03.219  1845  1845 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:6541)
10-10 19:33:03.219  1845  1845 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
10-10 19:33:03.219  1845  1845 E AndroidRuntime:        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
10-10 19:33:03.219  1845  1845 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) 

Forked On 09 Sep 2022 at 09:12:10

Rborn

@billouboq will test and let you know ❤️

Commented On 09 Sep 2022 at 09:12:10

Rborn

MusicService.onDestroy crashing app at startup (Android)

Describe the Bug Hi guys, great job going on here. So I noticed these crashes upon using version 3.1.0 recently:

Caused by kotlin.UninitializedPropertyAccessException: lateinit property player has not been initialized
       at com.doublesymmetry.trackplayer.service.MusicService.onDestroy (MusicService.kt:471)
       at android.app.ActivityThread.handleStopService (ActivityThread.java:4805) 

and

Caused by kotlin.UninitializedPropertyAccessException: lateinit property player has not been initialized
       at com.doublesymmetry.trackplayer.service.MusicService.onTaskRemoved(MusicService.kt:459)
       at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4696) 

Steps To Reproduce Oh so I noticed this at start up sometimes and the second popped up on firebase crashlytics.

Environment Info: System: OS: macOS 12.5.1 CPU: (8) x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz Memory: 74.93 MB / 16.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 14.17.0 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 6.14.13 - /usr/local/bin/npm Watchman: 2022.03.21.00 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.3 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5 Android SDK: Not Found IDEs: Android Studio: 4.2 AI-202.7660.26.42.7486908 Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild Languages: Java: 11.0.11 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 17.0.2 => 17.0.2 react-native: 0.68.2 => 0.68.2 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found react-native-track-player version 3.1.0 Real device and simulator

How I can Help Now digging through MusicService.kt I believe the faulty lines are:

 @MainThread
    override fun onDestroy() {
        super.onDestroy()
        if (this::player.isInitialized) { // possible fix applied
            player.stop()
        }
    } 

and

 @MainThread
    override fun onTaskRemoved(rootIntent: Intent?) {
        super.onTaskRemoved(rootIntent)

        if (stoppingAppPausesPlayback && this::player.isInitialized) { // possible fix applied
            player.pause()
        }
    } 

Tested on the example app and its gone well. PR #1700. Hoping these can be released soon as it is being experienced in production. Thanks a lot.

Forked On 06 Sep 2022 at 02:51:52

Rborn

I believe was this https://github.com/doublesymmetry/react-native-track-player/pull/1700, same solution as in my comment, only that @praisedavid787 actually put the work and made the PR 😅

Commented On 06 Sep 2022 at 02:51:52

Rborn

MusicService.onDestroy crashing app at startup (Android)

Describe the Bug Hi guys, great job going on here. So I noticed these crashes upon using version 3.1.0 recently:

Caused by kotlin.UninitializedPropertyAccessException: lateinit property player has not been initialized
       at com.doublesymmetry.trackplayer.service.MusicService.onDestroy (MusicService.kt:471)
       at android.app.ActivityThread.handleStopService (ActivityThread.java:4805) 

and

Caused by kotlin.UninitializedPropertyAccessException: lateinit property player has not been initialized
       at com.doublesymmetry.trackplayer.service.MusicService.onTaskRemoved(MusicService.kt:459)
       at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4696) 

Steps To Reproduce Oh so I noticed this at start up sometimes and the second popped up on firebase crashlytics.

Environment Info: System: OS: macOS 12.5.1 CPU: (8) x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz Memory: 74.93 MB / 16.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 14.17.0 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 6.14.13 - /usr/local/bin/npm Watchman: 2022.03.21.00 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.3 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5 Android SDK: Not Found IDEs: Android Studio: 4.2 AI-202.7660.26.42.7486908 Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild Languages: Java: 11.0.11 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 17.0.2 => 17.0.2 react-native: 0.68.2 => 0.68.2 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found react-native-track-player version 3.1.0 Real device and simulator

How I can Help Now digging through MusicService.kt I believe the faulty lines are:

 @MainThread
    override fun onDestroy() {
        super.onDestroy()
        if (this::player.isInitialized) { // possible fix applied
            player.stop()
        }
    } 

and

 @MainThread
    override fun onTaskRemoved(rootIntent: Intent?) {
        super.onTaskRemoved(rootIntent)

        if (stoppingAppPausesPlayback && this::player.isInitialized) { // possible fix applied
            player.pause()
        }
    } 

Tested on the example app and its gone well. PR #1700. Hoping these can be released soon as it is being experienced in production. Thanks a lot.

Forked On 05 Sep 2022 at 01:30:19

Rborn

No worries 🤗

Commented On 05 Sep 2022 at 01:30:19

Rborn

MusicService.onDestroy crashing app at startup (Android)

Describe the Bug Hi guys, great job going on here. So I noticed these crashes upon using version 3.1.0 recently:

Caused by kotlin.UninitializedPropertyAccessException: lateinit property player has not been initialized
       at com.doublesymmetry.trackplayer.service.MusicService.onDestroy (MusicService.kt:471)
       at android.app.ActivityThread.handleStopService (ActivityThread.java:4805) 

and

Caused by kotlin.UninitializedPropertyAccessException: lateinit property player has not been initialized
       at com.doublesymmetry.trackplayer.service.MusicService.onTaskRemoved(MusicService.kt:459)
       at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4696) 

Steps To Reproduce Oh so I noticed this at start up sometimes and the second popped up on firebase crashlytics.

Environment Info: System: OS: macOS 12.5.1 CPU: (8) x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz Memory: 74.93 MB / 16.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 14.17.0 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 6.14.13 - /usr/local/bin/npm Watchman: 2022.03.21.00 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.3 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5 Android SDK: Not Found IDEs: Android Studio: 4.2 AI-202.7660.26.42.7486908 Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild Languages: Java: 11.0.11 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 17.0.2 => 17.0.2 react-native: 0.68.2 => 0.68.2 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found react-native-track-player version 3.1.0 Real device and simulator

How I can Help Now digging through MusicService.kt I believe the faulty lines are:

 @MainThread
    override fun onDestroy() {
        super.onDestroy()
        if (this::player.isInitialized) { // possible fix applied
            player.stop()
        }
    } 

and

 @MainThread
    override fun onTaskRemoved(rootIntent: Intent?) {
        super.onTaskRemoved(rootIntent)

        if (stoppingAppPausesPlayback && this::player.isInitialized) { // possible fix applied
            player.pause()
        }
    } 

Tested on the example app and its gone well. PR #1700. Hoping these can be released soon as it is being experienced in production. Thanks a lot.

Forked On 05 Sep 2022 at 01:28:21

Rborn

Someone with more kotlink knowledge maybe can fix the SimpleCache issue: https://github.com/doublesymmetry/KotlinAudio/issues/9#issuecomment-1237018054 @praisedavid787 😀

Commented On 05 Sep 2022 at 01:28:21
Issue Comment

Rborn

Another SimpleCache instance uses the folder

Hi,

We are facing a cache issue with react-native-trackplayer it's seem the cache not being released before init a new player.

Have you any advice too avoid this?

https://github.com/DoubleSymmetry/KotlinAudio/blob/f06133fa589adabcd20929823af2a33245d9bc77/kotlin-audio/src/main/java/com/doublesymmetry/kotlinaudio/players/BaseAudioPlayer.kt#L112

Forked On 05 Sep 2022 at 01:20:36

Rborn

@jspizziri

It seems that SimpleCache has a isCacheFolderLocked method, so maybe it would be possible to make a singleton in case it already exist?

https://exoplayer.dev/doc/reference/com/google/android/exoplayer2/upstream/cache/SimpleCache.html#isCacheFolderLocked(java.io.File)

Commented On 05 Sep 2022 at 01:20:36

Rborn

MusicService.onDestroy crashing app at startup (Android)

Describe the Bug Hi guys, great job going on here. So I noticed these crashes upon using version 3.1.0 recently:

Caused by kotlin.UninitializedPropertyAccessException: lateinit property player has not been initialized
       at com.doublesymmetry.trackplayer.service.MusicService.onDestroy (MusicService.kt:471)
       at android.app.ActivityThread.handleStopService (ActivityThread.java:4805) 

and

Caused by kotlin.UninitializedPropertyAccessException: lateinit property player has not been initialized
       at com.doublesymmetry.trackplayer.service.MusicService.onTaskRemoved(MusicService.kt:459)
       at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4696) 

Steps To Reproduce Oh so I noticed this at start up sometimes and the second popped up on firebase crashlytics.

Environment Info: System: OS: macOS 12.5.1 CPU: (8) x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz Memory: 74.93 MB / 16.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 14.17.0 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 6.14.13 - /usr/local/bin/npm Watchman: 2022.03.21.00 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.3 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5 Android SDK: Not Found IDEs: Android Studio: 4.2 AI-202.7660.26.42.7486908 Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild Languages: Java: 11.0.11 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 17.0.2 => 17.0.2 react-native: 0.68.2 => 0.68.2 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found react-native-track-player version 3.1.0 Real device and simulator

How I can Help Now digging through MusicService.kt I believe the faulty lines are:

 @MainThread
    override fun onDestroy() {
        super.onDestroy()
        if (this::player.isInitialized) { // possible fix applied
            player.stop()
        }
    } 

and

 @MainThread
    override fun onTaskRemoved(rootIntent: Intent?) {
        super.onTaskRemoved(rootIntent)

        if (stoppingAppPausesPlayback && this::player.isInitialized) { // possible fix applied
            player.pause()
        }
    } 

Tested on the example app and its gone well. PR #1700. Hoping these can be released soon as it is being experienced in production. Thanks a lot.

Forked On 05 Sep 2022 at 01:00:05

Rborn

@arakovskis that's a different bug, more here: https://github.com/doublesymmetry/react-native-track-player/issues/1639#issuecomment-1236852241

Commented On 05 Sep 2022 at 01:00:05

Rborn

Fatal Exception: kotlin.UninitializedPropertyAccessException

Describe the Bug App crash while using react-native-track-player

Steps To Reproduce

Code To Reproduce

TrackPlayer.reset();
TrackPlayer.add([sound1, sound2]);
TrackPlayer.play(); 

Environment Info: react-native: 0.68.2 react-native-track-player: ^2.2.0-rc4 Device: Samsung A8 Tablet OS: Android

Crashlytics log

Fatal Exception: kotlin.UninitializedPropertyAccessException: lateinit property descriptionAdapter has not been initialized
       at com.doublesymmetry.kotlinaudio.notification.NotificationManager$destroy$1.invokeSuspend(NotificationManager.kt:295)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
       at android.os.Handler.handleCallback(Handler.java:938)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:247)
       at android.app.ActivityThread.main(ActivityThread.java:8676)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130) 

Forked On 05 Sep 2022 at 12:59:24

Rborn

Looks like somebody did a PR with this already: https://github.com/doublesymmetry/react-native-track-player/issues/1699

Commented On 05 Sep 2022 at 12:59:24

Rborn

Fatal Exception: kotlin.UninitializedPropertyAccessException

Describe the Bug App crash while using react-native-track-player

Steps To Reproduce

Code To Reproduce

TrackPlayer.reset();
TrackPlayer.add([sound1, sound2]);
TrackPlayer.play(); 

Environment Info: react-native: 0.68.2 react-native-track-player: ^2.2.0-rc4 Device: Samsung A8 Tablet OS: Android

Crashlytics log

Fatal Exception: kotlin.UninitializedPropertyAccessException: lateinit property descriptionAdapter has not been initialized
       at com.doublesymmetry.kotlinaudio.notification.NotificationManager$destroy$1.invokeSuspend(NotificationManager.kt:295)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
       at android.os.Handler.handleCallback(Handler.java:938)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:247)
       at android.app.ActivityThread.main(ActivityThread.java:8676)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130) 

Forked On 05 Sep 2022 at 11:02:49

Rborn

I think I was commenting in the wrong issue 😅 https://github.com/doublesymmetry/react-native-track-player/issues/1633#issuecomment-1235316807 But I think I have a fix for this.

I will paste here the patch file if anyone wants to test - I don't get any more crashes with this error UninitializedPropertyAccessException (I still get the ones with SimpleCache)

diff --git a/node_modules/react-native-track-player/android/src/main/java/com/doublesymmetry/trackplayer/service/MusicService.kt b/node_modules/react-native-track-player/android/src/main/java/com/doublesymmetry/trackplayer/service/MusicService.kt
index 776d260..9e9f31d 100644
--- a/node_modules/react-native-track-player/android/src/main/java/com/doublesymmetry/trackplayer/service/MusicService.kt
+++ b/node_modules/react-native-track-player/android/src/main/java/com/doublesymmetry/trackplayer/service/MusicService.kt
@@ -455,7 +455,7 @@ class MusicService : HeadlessJsTaskService() {
     override fun onTaskRemoved(rootIntent: Intent?) {
         super.onTaskRemoved(rootIntent)
 
-        if (stoppingAppPausesPlayback) {
+        if (stoppingAppPausesPlayback && this::player.isInitialized ) {
             player.pause()        
         }
     }
@@ -468,7 +468,9 @@ class MusicService : HeadlessJsTaskService() {
     @MainThread
     override fun onDestroy() {
         super.onDestroy()
-        player.stop()
+        if (this::player.isInitialized ) {
+            player.stop()
+        }
     }
 
     @MainThread 

Commented On 05 Sep 2022 at 11:02:49

Rborn

[Android] lateinit property player has not been initialized

My users got issue lateinit property player has not been initialized, and Android only

This is my setupPlayer function

 export const setupTrackPlayer = async () => {
    try {
        if (global.isSetupTrackPlayer) {
            // this method will only reject if player has not been setup yet
            await TrackPlayer.getCurrentTrack();
        } else {
            await TrackPlayer.setupPlayer();
            await TrackPlayer.updateOptions({
                stopWithApp: true,
                capabilities: [
                    Capability.Play,
                    Capability.Pause,
                    Capability.SkipToNext,
                    Capability.SkipToPrevious,
                    Capability.Stop,
                ],
                compactCapabilities: [Capability.Play, Capability.Pause],
                progressUpdateEventInterval: 2,
            });
            global.isSetupTrackPlayer = true;
        }
    } catch {
        showToast({ message: 'Setup player fail!', type: 'fail' });
    }
}; 

And I put this function in useEffect of App.js file

Can you guys help me to fix this issue?!

Forked On 02 Sep 2022 at 03:37:51

Rborn

@KrisLau do you have a link ? 🙏 ❤️

Commented On 02 Sep 2022 at 03:37:51

Rborn

[Android] lateinit property player has not been initialized

My users got issue lateinit property player has not been initialized, and Android only

This is my setupPlayer function

 export const setupTrackPlayer = async () => {
    try {
        if (global.isSetupTrackPlayer) {
            // this method will only reject if player has not been setup yet
            await TrackPlayer.getCurrentTrack();
        } else {
            await TrackPlayer.setupPlayer();
            await TrackPlayer.updateOptions({
                stopWithApp: true,
                capabilities: [
                    Capability.Play,
                    Capability.Pause,
                    Capability.SkipToNext,
                    Capability.SkipToPrevious,
                    Capability.Stop,
                ],
                compactCapabilities: [Capability.Play, Capability.Pause],
                progressUpdateEventInterval: 2,
            });
            global.isSetupTrackPlayer = true;
        }
    } catch {
        showToast({ message: 'Setup player fail!', type: 'fail' });
    }
}; 

And I put this function in useEffect of App.js file

Can you guys help me to fix this issue?!

Forked On 02 Sep 2022 at 03:35:06

Rborn

@KrisLau But this is when you use another lib that has exoplayer, in my case I only have RNTP

Commented On 02 Sep 2022 at 03:35:06

Rborn

[Android] lateinit property player has not been initialized

My users got issue lateinit property player has not been initialized, and Android only

This is my setupPlayer function

 export const setupTrackPlayer = async () => {
    try {
        if (global.isSetupTrackPlayer) {
            // this method will only reject if player has not been setup yet
            await TrackPlayer.getCurrentTrack();
        } else {
            await TrackPlayer.setupPlayer();
            await TrackPlayer.updateOptions({
                stopWithApp: true,
                capabilities: [
                    Capability.Play,
                    Capability.Pause,
                    Capability.SkipToNext,
                    Capability.SkipToPrevious,
                    Capability.Stop,
                ],
                compactCapabilities: [Capability.Play, Capability.Pause],
                progressUpdateEventInterval: 2,
            });
            global.isSetupTrackPlayer = true;
        }
    } catch {
        showToast({ message: 'Setup player fail!', type: 'fail' });
    }
}; 

And I put this function in useEffect of App.js file

Can you guys help me to fix this issue?!

Forked On 02 Sep 2022 at 02:21:37

Rborn

@puckey my crashlytics is full of them 😅

Commented On 02 Sep 2022 at 02:21:37

Rborn

[Android] lateinit property player has not been initialized

My users got issue lateinit property player has not been initialized, and Android only

This is my setupPlayer function

 export const setupTrackPlayer = async () => {
    try {
        if (global.isSetupTrackPlayer) {
            // this method will only reject if player has not been setup yet
            await TrackPlayer.getCurrentTrack();
        } else {
            await TrackPlayer.setupPlayer();
            await TrackPlayer.updateOptions({
                stopWithApp: true,
                capabilities: [
                    Capability.Play,
                    Capability.Pause,
                    Capability.SkipToNext,
                    Capability.SkipToPrevious,
                    Capability.Stop,
                ],
                compactCapabilities: [Capability.Play, Capability.Pause],
                progressUpdateEventInterval: 2,
            });
            global.isSetupTrackPlayer = true;
        }
    } catch {
        showToast({ message: 'Setup player fail!', type: 'fail' });
    }
}; 

And I put this function in useEffect of App.js file

Can you guys help me to fix this issue?!

Forked On 02 Sep 2022 at 02:19:41

Rborn

@KrisLau I edited the file directly in my node_modules, cleaned and compiled again. For me the crash was showing on app hot reload reload.

Commented On 02 Sep 2022 at 02:19:41

Rborn

[Android] lateinit property player has not been initialized

My users got issue lateinit property player has not been initialized, and Android only

This is my setupPlayer function

 export const setupTrackPlayer = async () => {
    try {
        if (global.isSetupTrackPlayer) {
            // this method will only reject if player has not been setup yet
            await TrackPlayer.getCurrentTrack();
        } else {
            await TrackPlayer.setupPlayer();
            await TrackPlayer.updateOptions({
                stopWithApp: true,
                capabilities: [
                    Capability.Play,
                    Capability.Pause,
                    Capability.SkipToNext,
                    Capability.SkipToPrevious,
                    Capability.Stop,
                ],
                compactCapabilities: [Capability.Play, Capability.Pause],
                progressUpdateEventInterval: 2,
            });
            global.isSetupTrackPlayer = true;
        }
    } catch {
        showToast({ message: 'Setup player fail!', type: 'fail' });
    }
}; 

And I put this function in useEffect of App.js file

Can you guys help me to fix this issue?!

Forked On 02 Sep 2022 at 10:08:40

Rborn

I believe I found a fix, but my kotlin knowledge is -100 so maybe before making a PR someone could test? @KrisLau @jspizziri

I changed the lines https://github.com/doublesymmetry/react-native-track-player/blob/6b25dfe2eaf8948b8613612cddf5ff6b8aa451ee/android/src/main/java/com/doublesymmetry/trackplayer/service/MusicService.kt#L472-L476

Where we need to check if plater actually is initialised being a lateInit variable to

 @MainThread
    override fun onDestroy() {
        super.onDestroy()
        
        if (this::player.isInitialized ) {
               player.stop()
        }
     
    } 

and I suspect the onTaskRemoved (line 456) also needs this, I added it just in case.

No more crashes for me, but please try and I'll make a PR if all goes well 🙏

Commented On 02 Sep 2022 at 10:08:40

Rborn

requestNotifications doesn't return blocked the first time is called on android 13

Bug summary

I have a weird situation when I call the requestNotifications and the first time I call it, if I click "don't allow" it will return denied instead of blocked.

The next time I call requestNotifications (in the same session), the OS popup shows again and this time on deny it will show blocked

This ( and the fact that android doesn't report blocked on checkNotification) makes the user flows we have impossible.

This happens on an Android Emulator ( don't have a real device)

Any idea what could be wrong?

Library version

3.6.1

Environment info

Node: 16.11.1 
    Yarn: 1.22.18
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
    Android SDK:
      API Levels: 28, 29, 30, 31, 33
      Build Tools: 28.0.2, 28.0.3, 29.0.3, 30.0.2, 30.0.3, 31.0.0, 33.0.0
      System Images: android-29 | Google APIs Intel x86 Atom, android-29 | Google Play ARM 64 v8a, android-29 | Google Play Intel x86 Atom, android-30 | Google Play Intel x86 Atom, android-30 | Google Play Intel x86 Atom_64, android-33 | Google Play Intel x86 Atom_64
      Android NDK: 20.1.5948944

react-native: 0.67.4 

Steps to reproduce

~~I'm really sorry, this is a crazy monorepo and is super hard to create a repro but, the steps are like it follows~~ The flow is as it follows, but I have managed to reproduce is (see next step)

  • install app
  • onboard user
  • ask for push permissions ( will return denied if we don't accept)
  • move to other section of the app where we ask permissions again
  • ask for push permissions ( will return blocked if we don't accept)

The thing is that I want to understand when I can expect to see the OS popup or I need to call openSettings. Right now with the current issue the app will show the popup and then move to openSettings which is bad.

Reproducible sample code

  • npx react-native init rnp --version 0.67.4
  • set in AndroidManifest.xml android:exported="true" for the activity
  • set in android/build.gradle
 buildToolsVersion = "33.0.0"
       minSdkVersion = 26
       compileSdkVersion = 33
       targetSdkVersion = 33
       supportLibVersion = "33.0.0"
       ndkVersion = "21.4.7075529" 
  • npx react-native run-android
  • app.js
import {requestNotifications} from 'react-native-permissions';

...

  const onAsk = async () => {
    const result = await requestNotifications();
    console.log(result);
  }; 

To get the behaviour you need to reinstall the app every time you want to try this

https://user-images.githubusercontent.com/406409/187996865-c72ca62f-5afd-4dd3-b59b-2a33eb29e78e.mov

Forked On 01 Sep 2022 at 07:56:09

Rborn

@zoontek oh, I didn't know you can ask twice, thank you and sorry for the mess 😅

Commented On 01 Sep 2022 at 07:56:09

Rborn

Fatal Exception: kotlin.UninitializedPropertyAccessException

Describe the Bug App crash while using react-native-track-player

Steps To Reproduce

Code To Reproduce

TrackPlayer.reset();
TrackPlayer.add([sound1, sound2]);
TrackPlayer.play(); 

Environment Info: react-native: 0.68.2 react-native-track-player: ^2.2.0-rc4 Device: Samsung A8 Tablet OS: Android

Crashlytics log

Fatal Exception: kotlin.UninitializedPropertyAccessException: lateinit property descriptionAdapter has not been initialized
       at com.doublesymmetry.kotlinaudio.notification.NotificationManager$destroy$1.invokeSuspend(NotificationManager.kt:295)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
       at android.os.Handler.handleCallback(Handler.java:938)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:247)
       at android.app.ActivityThread.main(ActivityThread.java:8676)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130) 

Forked On 31 Aug 2022 at 04:50:25

Rborn

@jspizziri I don't have multiple versions, I'm upgrading the module from an old 2.x version and this shows in a clean andorid 13 emulator. If a hot reload triggers ( Sometimes in my case it will fully reload the app, not only a specific file) the app crashes with this

08-31 18:44:50.325  4562  4562 E AndroidRuntime: FATAL EXCEPTION: main
08-31 18:44:50.325  4562  4562 E AndroidRuntime: Process: com.letsemjoy.app, PID: 4562
08-31 18:44:50.325  4562  4562 E AndroidRuntime: java.lang.IllegalStateException: Another SimpleCache instance uses the folder: /data/user/0/com.letsemjoy.app/cache/TrackPlayer
08-31 18:44:50.325  4562  4562 E AndroidRuntime: 	at com.google.android.exoplayer2.upstream.cache.SimpleCache.<init>(SimpleCache.java:249)
08-31 18:44:50.325  4562  4562 E AndroidRuntime: 	at com.google.android.exoplayer2.upstream.cache.SimpleCache.<init>(SimpleCache.java:229)
08-31 18:44:50.325  4562  4562 E AndroidRuntime: 	at com.google.android.exoplayer2.upstream.cache.SimpleCache.<init>(SimpleCache.java:194)
08-31 18:44:50.325  4562  4562 E AndroidRuntime: 	at com.doublesymmetry.kotlinaudio.players.BaseAudioPlayer.<init>(BaseAudioPlayer.kt:140)
08-31 18:44:50.325  4562  4562 E AndroidRuntime: 	at com.doublesymmetry.kotlinaudio.players.QueuedAudioPlayer.<init>(QueuedAudioPlayer.kt:14)
08-31 18:44:50.325  4562  4562 E AndroidRuntime: 	at com.doublesymmetry.trackplayer.service.MusicService.setupPlayer(MusicService.kt:81)
08-31 18:44:50.325  4562  4562 E AndroidRuntime: 	at com.doublesymmetry.trackplayer.module.MusicModule$onServiceConnected$1.invokeSuspend(MusicModule.kt:56)
08-31 18:44:50.325  4562  4562 E AndroidRuntime: 	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
08-31 18:44:50.325  4562  4562 E AndroidRuntime: 	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
08-31 18:44:50.325  4562  4562 E AndroidRuntime: 	at android.os.Handler.handleCallback(Handler.java:942)
08-31 18:44:50.325  4562  4562 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:99)
08-31 18:44:50.325  4562  4562 E AndroidRuntime: 	at android.os.Looper.loopOnce(Looper.java:201)
08-31 18:44:50.325  4562  4562 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:288)
08-31 18:44:50.325  4562  4562 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:7898)
08-31 18:44:50.325  4562  4562 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
08-31 18:44:50.325  4562  4562 E AndroidRuntime: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
08-31 18:44:50.325  4562  4562 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
08-31 18:44:50.325  4562  4562 E AndroidRuntime: 	Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@38e8365, Dispatchers.Main]
08-31 18:44:50.366   589  4966 I DropBoxManagerService: add tag=data_app_crash isTagEnabled=true flags=0x2 

After I did the change suggested by @mvrty I still have it from time to time, but very rare.

Commented On 31 Aug 2022 at 04:50:25

Rborn

Fatal Exception: kotlin.UninitializedPropertyAccessException

Describe the Bug App crash while using react-native-track-player

Steps To Reproduce

Code To Reproduce

TrackPlayer.reset();
TrackPlayer.add([sound1, sound2]);
TrackPlayer.play(); 

Environment Info: react-native: 0.68.2 react-native-track-player: ^2.2.0-rc4 Device: Samsung A8 Tablet OS: Android

Crashlytics log

Fatal Exception: kotlin.UninitializedPropertyAccessException: lateinit property descriptionAdapter has not been initialized
       at com.doublesymmetry.kotlinaudio.notification.NotificationManager$destroy$1.invokeSuspend(NotificationManager.kt:295)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
       at android.os.Handler.handleCallback(Handler.java:938)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:247)
       at android.app.ActivityThread.main(ActivityThread.java:8676)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130) 

Forked On 31 Aug 2022 at 01:35:18

Rborn

@jspizziri I can confirm this works and that on reload I have the crashes too.
Version 3.1.0

I tried to modify the cacheConfig but my kotlin knowledge is -100 and cannot even make it compile with my changes 😅

Commented On 31 Aug 2022 at 01:35:18

Rborn

Amplitude events are reported as "outside session"

Hello, I updated the module to v2 but now all the Amplitude events are "outside of session" (green) instead of "inside session" (blue)

https://help.amplitude.com/hc/en-us/articles/229313067-Look-up-event-data-for-individual-users#:~:text=Blue%20events%20in%20a%20session,or%20only%20show%20specific%20events.

  • analytics-react-native version: 2.7.0
  • Integrations versions (if used): analytics-react-native-plugin-amplitude-session": "0.3.1"
  • React Native version: 0.67.4
  • Both iOs and Android

Steps to reproduce

I just updated and adapted the module to version 2 (was 1.x before)

my code:

 Analytics = createClient({
            writeKey: configuration.apiKeys.segmentio,
            autoAddSegmentDestination: true,
            trackAppLifecycleEvents: true,
            trackAttributionData: true,
            debug: debugConfigs.segment,
            flushInterval: Config.APP_TYPE === 'test' || Config.APP_TYPE === 'demo' ? 1 : 20,
            flushAt: Config.APP_TYPE === 'test' || Config.APP_TYPE === 'demo' ? 1 : 20,
            trackDeepLinks: true
        });

        Analytics.add({ plugin: new AmplitudeSessionPlugin() }); 

Expected behavior

Amplitude should receive the events as being part of a session while they seem to be interpreted as being sent server side

Actual behavior

All events show as "outside"

Here is a sample of the difference: Screenshot 2022-08-24 at 16 32 09

We are measuring the time the users are stating in the app, and currently this is broken Screenshot 2022-08-24 at 16 47 12

Thank you ❤️

Forked On 25 Aug 2022 at 01:25:40

Rborn

@alanjcharles thanks for looking into this. I think I have found something, we had the Segment/Amplitude connection since 3.5 years ago 😅, but it seems something changed and now there are 2 ways of doing this, "Actions" and "Classic" (we were Classic)

Screenshot 2022-08-25 at 10 58 41

I've redone the connection in the new Action mode and it seems the events start to pickup and be "blue" again. There are still users that keep being "green" but I believe the events will only be considered in a session if there is a session started, so if the users had the app in background probably won't show as blue.

I won't close the ticket for now, but I'll come back in a few days ( we'll make a new release) and update you.

If it turns to be this maybe this is something to mention in the docs?

Thanks for everything 🥰

Commented On 25 Aug 2022 at 01:25:40