Reputation: 2251
I am using retrofit for many android projects. I started to get crash on android 4 devices.When I try to create retrofit object like below.
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(getString(R.string.endpoint))
.addConverterFactory(GsonConverterFactory.create(gson))
//.setConverter(new GsonConverter(gson))
//.setClient(new OkClient(okHttpClient))
.build();
return retrofit.create(WS.class);
Huawei ascend android 4.4. device prints this error
03-24 11:39:24.684 2255-2255/com.mobisem.matkit I/dalvikvm: Could not find method android.content.pm.PackageManager.getPackageInstaller, referenced from method com.google.android.gms.common.zze.zzi
03-24 11:39:24.684 2255-2255/com.mobisem.matkit W/dalvikvm: VFY: unable to resolve virtual method 574: Landroid/content/pm/PackageManager;.getPackageInstaller ()Landroid/content/pm/PackageInstaller;
03-24 11:39:24.704 2255-2255/com.mobisem.matkit I/GMPM: App measurement is starting up, version: 8487
03-24 11:39:24.704 2255-2255/com.mobisem.matkit I/GMPM: To enable debug logging run: adb shell setprop log.tag.GMPM VERBOSE
03-24 11:39:24.749 2255-2255/com.mobisem.matkit W/dalvikvm: VFY: unable to find class referenced in signature (Landroid/view/SearchEvent;)
03-24 11:39:24.749 2255-2255/com.mobisem.matkit I/dalvikvm: Could not find method android.view.Window$Callback.onSearchRequested, referenced from method android.support.v7.view.WindowCallbackWrapper.onSearchRequested
03-24 11:39:24.749 2255-2255/com.mobisem.matkit W/dalvikvm: VFY: unable to resolve interface method 19771: Landroid/view/Window$Callback;.onSearchRequested (Landroid/view/SearchEvent;)Z
03-24 11:39:24.749 2255-2255/com.mobisem.matkit I/dalvikvm: Could not find method android.view.Window$Callback.onWindowStartingActionMode, referenced from method android.support.v7.view.WindowCallbackWrapper.onWindowStartingActionMode
03-24 11:39:24.749 2255-2255/com.mobisem.matkit W/dalvikvm: VFY: unable to resolve interface method 19775: Landroid/view/Window$Callback;.onWindowStartingActionMode (Landroid/view/ActionMode$Callback;I)Landroid/view/ActionMode;
03-24 11:39:24.809 2255-2255/com.mobisem.matkit I/dalvikvm: Could not find method retrofit2.Platform.get, referenced from method retrofit2.Retrofit$Builder.<init>
03-24 11:39:24.809 2255-2255/com.mobisem.matkit W/dalvikvm: VFY: unable to resolve static method 64784: Lretrofit2/Platform;.get ()Lretrofit2/Platform;
03-24 11:39:24.809 2255-2255/com.mobisem.matkit W/dalvikvm: VFY: unable to find class referenced in signature (Lretrofit2/Platform;)
03-24 11:39:24.809 2255-2255/com.mobisem.matkit E/dalvikvm: Could not find class 'retrofit2.BuiltInConverters', referenced from method retrofit2.Retrofit$Builder.<init>
03-24 11:39:24.809 2255-2255/com.mobisem.matkit W/dalvikvm: VFY: unable to resolve new-instance 9323 (Lretrofit2/BuiltInConverters;) in Lretrofit2/Retrofit$Builder;
03-24 11:39:24.809 2255-2255/com.mobisem.matkit I/dalvikvm: Could not find method retrofit2.Utils.checkNotNull, referenced from method retrofit2.Retrofit$Builder.addCallAdapterFactory
03-24 11:39:24.809 2255-2255/com.mobisem.matkit W/dalvikvm: VFY: unable to resolve static method 64816: Lretrofit2/Utils;.checkNotNull (Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;
03-24 11:39:24.809 2255-2255/com.mobisem.matkit I/dalvikvm: Could not find method retrofit2.Utils.checkNotNull, referenced from method retrofit2.Retrofit$Builder.addConverterFactory
03-24 11:39:24.809 2255-2255/com.mobisem.matkit W/dalvikvm: VFY: unable to resolve static method 64816: Lretrofit2/Utils;.checkNotNull (Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;
03-24 11:39:24.809 2255-2255/com.mobisem.matkit I/dalvikvm: Could not find method retrofit2.Utils.checkNotNull, referenced from method retrofit2.Retrofit$Builder.baseUrl
03-24 11:39:24.809 2255-2255/com.mobisem.matkit W/dalvikvm: VFY: unable to resolve static method 64816: Lretrofit2/Utils;.checkNotNull (Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;
03-24 11:39:24.809 2255-2255/com.mobisem.matkit W/dalvikvm: VFY: unable to find class referenced in signature (Lokhttp3/HttpUrl;)
03-24 11:39:24.809 2255-2255/com.mobisem.matkit I/dalvikvm: Could not find method retrofit2.Utils.checkNotNull, referenced from method retrofit2.Retrofit$Builder.baseUrl
03-24 11:39:24.809 2255-2255/com.mobisem.matkit W/dalvikvm: VFY: unable to resolve static method 64816: Lretrofit2/Utils;.checkNotNull (Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;
03-24 11:39:24.809 2255-2255/com.mobisem.matkit E/dalvikvm: Could not find class 'okhttp3.OkHttpClient', referenced from method retrofit2.Retrofit$Builder.build
03-24 11:39:24.809 2255-2255/com.mobisem.matkit W/dalvikvm: VFY: unable to resolve new-instance 9290 (Lokhttp3/OkHttpClient;) in Lretrofit2/Retrofit$Builder;
03-24 11:39:24.809 2255-2255/com.mobisem.matkit I/dalvikvm: Could not find method retrofit2.Platform.defaultCallbackExecutor, referenced from method retrofit2.Retrofit$Builder.build
03-24 11:39:24.809 2255-2255/com.mobisem.matkit W/dalvikvm: VFY: unable to resolve virtual method 64783: Lretrofit2/Platform;.defaultCallbackExecutor ()Ljava/util/concurrent/Executor;
03-24 11:39:24.809 2255-2255/com.mobisem.matkit I/dalvikvm: Could not find method retrofit2.Platform.defaultCallAdapterFactory, referenced from method retrofit2.Retrofit$Builder.build
03-24 11:39:24.809 2255-2255/com.mobisem.matkit W/dalvikvm: VFY: unable to resolve virtual method 64782: Lretrofit2/Platform;.defaultCallAdapterFactory (Ljava/util/concurrent/Executor;)Lretrofit2/CallAdapter$Factory;
03-24 11:39:24.809 2255-2255/com.mobisem.matkit I/dalvikvm: Could not find method retrofit2.Utils.checkNotNull, referenced from method retrofit2.Retrofit$Builder.callFactory
03-24 11:39:24.809 2255-2255/com.mobisem.matkit W/dalvikvm: VFY: unable to resolve static method 64816: Lretrofit2/Utils;.checkNotNull (Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;
03-24 11:39:24.814 2255-2255/com.mobisem.matkit I/dalvikvm: Could not find method retrofit2.Utils.checkNotNull, referenced from method retrofit2.Retrofit$Builder.callbackExecutor
03-24 11:39:24.814 2255-2255/com.mobisem.matkit W/dalvikvm: VFY: unable to resolve static method 64816: Lretrofit2/Utils;.checkNotNull (Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;
03-24 11:39:24.814 2255-2255/com.mobisem.matkit W/dalvikvm: VFY: unable to find class referenced in signature (Lokhttp3/OkHttpClient;)
03-24 11:39:24.814 2255-2255/com.mobisem.matkit I/dalvikvm: Could not find method retrofit2.Utils.checkNotNull, referenced from method retrofit2.Retrofit$Builder.client
03-24 11:39:24.814 2255-2255/com.mobisem.matkit W/dalvikvm: VFY: unable to resolve static method 64816: Lretrofit2/Utils;.checkNotNull (Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;
03-24 11:39:24.814 2255-2255/com.mobisem.matkit W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x415bec50)
It is very annoying!.
Upvotes: 1
Views: 830
Reputation: 431
Use Retrofit version 1.9 and okhttp version 2.3 ,works pretty fine with all devices. Though retrofit 2.0 is promised to be faster but has been changed a lot.Sticking with 1.9 will not have any complications.
Upvotes: 2
Reputation: 2251
I found the solution after many searches. It worked when I changed my application class supertype Application with MultiDexApplication. It worked. It is not directly related to retrofit. It is a gradle and dex problem.
Upvotes: 1