-
Notifications
You must be signed in to change notification settings - Fork 66
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
三星手机上获取OAID会崩溃,而且是偶发的,发生在APP版本更新后,而且一旦出现一次就是必现。 #12
Comments
获取 OAID 之前先判断下 com.samsung.android.deviceidservice 包是否存在,然后再获取 |
看报错日志 // IDeviceIdService.aidl
package com.samsung.android.deviceidservice;
// Declare any non-default types here with import statements
interface IDeviceIdService {
String getID();
} 通过AIDL的方式直接在Java层面调用三星远程服务获取OAID,不用C/C++那一层,能很大层度商提升稳健性: Intent intent = new Intent();
intent.setClassName("com.samsung.android.deviceidservice", "com.samsung.android.deviceidservice.DeviceIdService");
boolean isBinded = context.bindService(intent, new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
Logger.print("Samsung DeviceIdService connected");
try {
//IDeviceIdService anInterface = new IDeviceIdService.Stub.asInterface(service);
Method asInterface = IDeviceIdService.Stub.class.getDeclaredMethod("asInterface", IBinder.class);
IDeviceIdService anInterface = (IDeviceIdService) asInterface.invoke(null, service);
String deviceId = anInterface.getID();
if (deviceId == null || deviceId.length() == 0) {
getter.onDeviceIdGetError(new RuntimeException("Samsung DeviceId get failed"));
} else {
getter.onDeviceIdGetComplete(deviceId);
}
} catch (Exception e) {
Logger.print(e);
getter.onDeviceIdGetError(e);
} finally {
context.unbindService(this);
}
}
@Override
public void onServiceDisconnected(ComponentName name) {
Logger.print("Samsung DeviceIdService disconnected");
}
}, Context.BIND_AUTO_CREATE);
if (!isBinded) {
getter.onDeviceIdGetError(new RuntimeException("Samsung DeviceIdService bind failed"));
} |
老哥,解决了吗? |
java.lang.UnsatisfiedLinkError,这是C层的错误,在 context.bindService(intent, new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
……
}
} |
com.samsung.android.deviceidservice 包是存在的,不然也不会走到 |
移动安全联盟SDK的开源替代方案:Android_CN_OAID |
有木有大佬反馈给三星处理下,被老板烦死了。
java.lang.UnsatisfiedLinkError: No implementation found for void com.bun.miitmdid.supplier.sumsung.SumsungCore$a.onServiceConnected(android.content.ComponentName, android.os.IBinder) (tried Java_com_bun_miitmdid_supplier_sumsung_SumsungCore_00024a_onServiceConnected and Java_com_bun_miitmdid_supplier_sumsung_SumsungCore_00024a_onServiceConnected__Landroid_content_ComponentName_2Landroid_os_IBinder_2) at com.bun.miitmdid.supplier.sumsung.SumsungCore$a.onServiceConnected(Native Method) at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:2067) at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:2099) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:237) at android.app.ActivityThread.main(ActivityThread.java:8016) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1076)
sos ~~~~
The text was updated successfully, but these errors were encountered: