Kamo Spertsyan
03/23/2023, 10:20 AMFatal Exception: java.lang.NoSuchMethodError: No direct method <init>(Lcom/myApp/android/pckg/MyService;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)V in class Lcom/myApp/android/pckg/MyService$doSmth$1; or its super classes (declaration of 'com.myApp.android.pckg.MyService$doSmth$1' appears in /data/app/blahblahblah==/base.apk!classes3.dex)
As far as I understood it should be a constructor call with three arguments (MyService class and two functions with one parameter). But there is no such a call in the line where the error points to and also no such a constructor.
The error points to the line inside the doSmth
method where there is a call to the function private fun executeOnMainThread(request: (ArgumentClass?) -> Unit) {}
which synchronizes the thread by a class lock. By the call I also provide an inline lambda function with the requested signature. Maybe the error for some reason occurs while creating that lambda?
The only hook I have is the signature of the doSmth
method - it accepts two functions with one argument and returns nothing, so if this <init>(Lcom/myApp/android/pckg/MyService;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)V
can be explained as - MyService has a function accepting two functions with one argument and returning Void, then it makes sense. But still I cant understand, what does this class name means: Lcom/myApp/android/pckg/MyService$doSmth$1
- there is no anonymous classes in that method especially at the line pointed by the error. And what is this $1
at the end?
I would appreciate any help in understanding this error.Chrimaeon
03/23/2023, 12:31 PMMcEna
03/24/2023, 6:41 AMKamo Spertsyan
03/24/2023, 7:40 AMdoSmth
consumes two lambdas. And the executeOnMainThread
method either. By the way I still can't understand where is the problem. I will try Christian's suggestion with decompiling to get more info..
Speaking of DI - I don't this it can be the reason as the problem occurs after the direct call. The service is created once per launch and doesn't recreated.