Skip to content
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

some crashes with missing virtual method #977

Open
chk2902 opened this issue Dec 18, 2024 · 2 comments
Open

some crashes with missing virtual method #977

chk2902 opened this issue Dec 18, 2024 · 2 comments

Comments

@chk2902
Copy link

chk2902 commented Dec 18, 2024

Some customers of mine start to experience problems with the following stack trace:

STACK_TRACE=java.lang.NoSuchMethodError: No virtual method error(Ljava/lang/Exception;)Lcom/github/kittinunf/result/Result$Failure; in class Lcom/github/kittinunf/result/Result$Companion; or its super classes (declaration of 'com.github.kittinunf.result.Result$Companion' appears in base.apk!classes3.dex) at com.github.kittinunf.fuel.core.DeserializableKt.response(Deserializable.kt:171) at com.github.kittinunf.fuel.core.requests.DefaultRequest.responseObject(DefaultRequest.kt:490) at com.chk.go_elocal.database.flextariff.provider.Tibber.updateStatistics(Tibber.java:201)
caused as you can see by the call of the "request.responseObject" in Java code:

Triple<Request, Response, Result<FuelJson, FuelError>> result = request.responseObject(FuelJsonKt.jsonDeserializer()); Result<FuelJson, FuelError> responseResult = result.getThird();

Version is the current stable version 2.3.1, and it just happens in release builds (on Android).

implementation 'com.github.kittinunf.result:result:5.6.0' implementation "com.github.kittinunf.fuel:fuel:$fuel_version" implementation "com.github.kittinunf.fuel:fuel-android:$fuel_version" implementation "com.github.kittinunf.fuel:fuel-json:$fuel_version"
Strange: The same call works (in some other class) for the same customers when I use a full object path:

Triple<Request, Response, com.github.kittinunf.result.Result<FuelJson, FuelError>> result = request.responseObject(FuelJsonKt.jsonDeserializer()); com.github.kittinunf.result.Result<FuelJson, FuelError> responseResult = result.getThird();
although the "import" in the other class file has the same path.

Does anybody know what could be the reason? Ther was a gradle update at the end of november, but actually I don't know the build process good enough to know whether something like that could cause it...

@chk2902
Copy link
Author

chk2902 commented Dec 18, 2024

BTW: I did not change the Fuel version for a long time, so I guess it will be something in the build process.

Strange is: it works when it's called "manually" (called by a one-time Worker process), but (at least sometimes) it does not work in a scheduled Worker process.

Other idea: can it be that that "missing" method is called when there's a problem with the data passed to it, and I cannot reproduce it (and it has that strange pattern) as the data I get does not have that problem?

@iNoles
Copy link
Collaborator

iNoles commented Jan 5, 2025

Whenever NoSuchMethodError or similar problems come up, it's usually one of two things:

  1. A build problem where the build system uses incompatible intermediate files to building the apk. You can try to fix this (or exclude it as the reason) by fully cleaning your project in Android Studio ("Build -> Clean project") and also running "File -> Invalidate Caches".
  2. An unintended version upgrade of another dependent library that also uses Result or Fuel. Based on your description, this is the likely reason. Gradle updates all Fuel versions in the entire dependency tree to the same version. You can check what gradle is doing by running ./gradlew yourAppGradleTarget:dependencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants