VerifyError when use authenticate function

I got an error when use authenticate

E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.JW.xapp, PID: 21914
java.lang.VerifyError: Verifier rejected class com.JW.xapp.quickstart_call.utils.AuthenticationUtils: void com.JW.xapp.quickstart_call.utils.AuthenticationUtils.authenticate(android.content.Context, java.lang.String, java.lang.String, com.JW.xapp.quickstart_call.utils.AuthenticationUtils$AuthenticateHandler) failed to verify: void com.JW.xapp.quickstart_call.utils.AuthenticationUtils.authenticate(android.content.Context, java.lang.String, java.lang.String, com.JW.xapp.quickstart_call.utils.AuthenticationUtils$AuthenticateHandler): [0x18] register v2 has type Reference: android.content.Context but expected Reference: com.JW.xapp.quickstart_call.utils.AuthenticationUtils (declaration of ‘com.JW.xapp.quickstart_call.utils.AuthenticationUtils’ appears in /data/app/com.JW.xapp-IwgMP98QydUhOtTv62QnpA==/base.apk!classes2.dex)
at com.JW.xapp.quickstart_call.utils.AuthenticationUtils.authenticate(AuthenticationUtils.java:31)
at com.JW.xapp.quickstart_call.main.MainActivity_call.check(MainActivity_call.java:93)
at com.JW.xapp.quickstart_call.main.MainActivity_call.onCreate(MainActivity_call.java:70)
at android.app.Activity.performCreate(Activity.java:7232)
at android.app.Activity.performCreate(Activity.java:7221)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1272)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2965)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3120)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1840)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:6878)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:876)

I use many day but no answer
Does anyone have suggestions
thanks!!

My first guess is that the Verifier is rejecting to compile

java.lang.VerifyError: Verifier rejected class "AuthenticationUtils"

Verifier rejects when there’s anything wrong with types or assignment.

In this case the error seems to be with the AuthenticateHandler method. Apparently one of the parameters is type android.content.Context but the expected one is type Authenticationutils

Can you please check if the parameter types and returning type of that method are correct?

sorry, i didn’t give code

and i didn’t find solution

first

AuthenticationUtils.authenticate(MainActivity_call.this, userId, accessToken, new AuthenticationUtils.AuthenticateHandler() {
@Override
public void onResult(boolean isSuccess) {
if (isSuccess) {
MainActivity_call.this.setResult(RESULT_OK, null);
}
}
});

then call function

package com.JW.xapp.quickstart_call.utils;

public class AuthenticationUtils {

public interface AuthenticateHandler {
    void onResult(boolean isSuccess);
}

public static void authenticate(Context context, String userId, String accessToken, AuthenticateHandler handler) {

  Error as soon as you enter there

    
}

Can you please try changing:

AuthenticationUtils.authenticate(MainActivity_call.this, userId, accessToken, ...

for:

AuthenticationUtils.authenticate(getApplicationContext(), userId, accessToken, ...

If getApplicationContext() does not work for you, try passing the context please.
You are passing an instance of your Activity and not the Context (well, that’s what I understand of it)