-
Notifications
You must be signed in to change notification settings - Fork 274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ClassCastException: org.slf4j.helpers.SubstituteLogger cannot be cast to ch.qos.logback.classic.Logger #1466
Comments
yes, it’s normal. execute the following. Save the output to a file and post here: $ cd platforms/android
$ ./gradlew app:dependencies |
Thank you for the fast response. I included the dependencies in the bugreport (above the images): And my gradle dependencies are:
|
there's nothing obviously incorrect about your dependencies. I have no idea what causes this. Can you create for me a simple Hello World app which reproduces this? |
Building a Hello World app will take me a lot of time. Maybe another approach first? Because today I found out that when I replace the dependencies with older versions, then the app works again!
with:
So the library is there but the versions are wrong. My app is expecting the older version. Does this mean the wrong / older version of tslocationmanager.aar was loaded? It's hard to explain bacause I have a docker image which starts empty each time. My package.json (and -lock) both point to the 4.17.4 version. Is there a way I can test versions when the app is running? In my project directory /src/platforms/android/app/libs/com/transistorsoft/tslocationmanager/ only 3.6.3 exists, and the tslocationmanager hashes are and match version 3.6.3 which is provided by 4.17.4: |
The reason that there are two versions of
Both versions of the library are compiled with the latest version of These two different versions have nothing to do with the logger ( |
I test the Cordova demo app daily. I have never experienced this problem. |
$ cordova platform
Installed platforms:
android 13.0.0
ios 7.1.1
$ cordova -v
12.0.0 ([email protected]) |
|
So the problem must be then that my app is loading an older version of the tslocationmanager which was compiled against the older versions of slf4j/logback. I can disssamble the resulting .apk and check which version of tslocationmanager had been packed inside the apk? |
I'm facing the same issue, serching on internet and asking to AI it seems that there is an incompatibility between slf4j and logback-android. Slf4j 2.x seems to be not compatible to logback 3.x that instead supports Slf4j 1.x. I'm currently trying this workaround then post here if this is the breakchange or not. |
Chances are you are facing a different (but comparable) issue, and that is this one: You should read and check everything that is asked there. Also checking your gadle dependencies first. There exists a good blog post about this problem to understand what is happening: I fixed my problem by automatically downgrading the slf4j versions in my pipeline. |
Yes sorry, next time i will pay more attention to the older threads. |
I don't think there is a problem with the library. It's almost certainly a problem with your and mine build environment. |
This is really strange, cause i'm working on a production app base (branched that new in a test environment that is the same of production in term of setting, also the computer where i make the build is the same). we've just upgraded the TargetSDK to 34 and consequently the cordova-background-geolocation-lt, then this error started to show up. |
It’s always Cordova that has this problem. React Native, Flutter and Capacitor do not have this issue. |
This issue is stale because it has been open for 30 days with no activity. |
Your Environment
Expected Behavior
Not crashing during startup.
Actual Behavior
I'm having an hardtime figuring out this error:
Steps to Reproduce
Context
The error isn't always thrown. The first time the app is installed everything works perfectly. I can even start background geolocation tracking. But if I force-close the app while background geolocation is off, and then try to restart the app, it crashes. I've tested this on Android 14 (pixel 6 pro) and Android 10 (mate 20 pro).
But the weird thing is the dependencies seem okay, please see attached gradle deps. I've even used jadx-gui to demux the resulting apk and check for the ch.qos.logback.classic.Logger package. And it is indeed present. Also the build.gradle (attached) looks good and does not contain any other slf4j or logback dependencies.
One of the things I noticed was that in
platforms\android\app\libs\com\transistorsoft
there are 3 folders:I was expecting to only see 2 (tsbackgroundfetch+ tslocationmanager-v21) but this might be normal?
I make my android builds inside a docker image. I can completely rebuild this image including all npm/bower/gradle/cordova dependencies/caches and still then the apk has this error in it. I've got no clue anymore what to do. But I must be overlooking something stupid here. So I was hoping you could shed some light on this. Any idea is welcome. I really appreciate it if you could help me on this.
Debug logs
deps.txt
Possible duplicate of (which I read but couldn't help me fix my problem)
#1401
The text was updated successfully, but these errors were encountered: