01-07 01:29:19.758 10455-10455/com.tongcheng.transport.flavor.dazhou E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.tongcheng.transport.flavor.dazhou, PID: 10455
java.lang.NoSuchMethodError: No virtual method getMeid()Ljava/lang/String; in class Landroid/telephony/TelephonyManager; or its super classes (declaration of 'android.telephony.TelephonyManager' appears in /system/framework/framework.jar)
at com.github.gzuliyujiang.oaid.DeviceID.getIMEI(DeviceID.java:182)
at com.github.gzuliyujiang.oaid.DeviceID.getUniqueID(DeviceID.java:171)
at com.github.gzuliyujiang.oaid.DeviceID.register(DeviceID.java:65)
// Related project code about this issue
@NonNull
@SuppressWarnings("deprecation")
@SuppressLint({"HardwareIds", "MissingPermission"})
private static String getIMEI(Context context) {
try {
TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
String imei = tm.getImei();
if (TextUtils.isEmpty(imei)) {
imei = tm.getMeid();
}
return imei;
} catch (Exception e) {
OAIDLog.print(e);
return "";
}
}
Should catch Throwable,for some crash caused by java.lang.Error instead for java.land.Exception,both of them extends java.lang.Throwable
And It is also need to replace Exception with Throwable for other method in your project because of android device compatibility problem