{"record":{"id":"5cd82b6675648826","repo":"asLody/VirtualApp","slug":"can-not-found-the","errorCode":null,"errorMessage":"Can not found the ","messagePattern":"Can not found the ","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"VirtualApp/lib/src/main/java/com/lody/virtual/helper/ipcbus/IPCMethod.java","lineNumber":97,"sourceCode":"\n    private static Method findAsInterfaceMethod(Class<?> type) {\n        for (Class<?> innerClass : type.getDeclaredClasses()) {\n            // public static class Stub extends Binder implements IType\n            if (Modifier.isStatic(innerClass.getModifiers())\n                    && Binder.class.isAssignableFrom(innerClass)\n                    && type.isAssignableFrom(innerClass)) {\n                // public static IType asInterface(android.os.IBinder obj)\n                for (Method method : innerClass.getDeclaredMethods()) {\n                    if (Modifier.isStatic(method.getModifiers())) {\n                        Class<?>[] types = method.getParameterTypes();\n                        if (types.length == 1 && types[0] == IBinder.class) {\n                            return method;\n                        }\n                    }\n                }\n            }\n        }\n        throw new IllegalStateException(\"Can not found the \" + type.getName() + \"$Stub.asInterface method.\");\n    }\n\n    public Object callRemote(IBinder server, Object[] args) throws RemoteException {\n        Parcel data = Parcel.obtain();\n        Parcel reply = Parcel.obtain();\n        Object result;\n        try {\n            data.writeInterfaceToken(interfaceName);\n            data.writeArray(args);\n            server.transact(code, data, reply, 0);\n            reply.readException();\n            result = readValue(reply);\n            if (resultConverter != null) {\n                result = resultConverter.convert(result);\n            }\n        } finally {\n            data.recycle();\n            reply.recycle();","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/asLody/VirtualApp/blob/666fefcb5d3f39cc944001c3457c38ffd6544c87/VirtualApp/lib/src/main/java/com/lody/virtual/helper/ipcbus/IPCMethod.java#L79-L115","documentation":"IPCMethod builds Binder IPC plumbing by reflectively locating the AIDL Stub class and its static asInterface(Method) for the interface's declared type. findAsInterfaceMethod scans Stub$ methods and throws this IllegalStateException when no method named asInterface exists. This indicates the expected AIDL-generated Stub surface is absent at runtime.","triggerScenarios":"Constructing an IPCMethod for an interface whose declared binder type has no <Type>$Stub.asInterface static method, e.g. a hand-written binder interface, obfuscated Stub class, or a non-AIDL type registered with IPCBus.","commonSituations":"Proguard stripping or renaming the generated $Stub$asInterface; using IPCBus with an interface that does not extend IInterface backed by AIDL; AIDL file removed/renamed while client code still references it.","solutions":["Keep AIDL-generated Stub classes from obfuscation with proguard rules (-keep class * extends android.os.Binder / interface **$Stub)","Register only AIDL-derived interfaces with IPCBus; ensure the .aidl compiles into the APK","Rebuild clean so Stub.java is regenerated from the current .aidl files"],"exampleFix":"// proguard-rules.pro\n# before: missing keep rule, Stub renamed\n# after\n-keep class * implements android.os.IInterface\n-keep class **$Stub { *; }","handlingStrategy":"validation","validationCode":"// ensure interface derives from AIDL and Stub survives obfuscation\n-keep class * implements android.os.IInterface { *; }\n-keep class **$Stub { *; }","typeGuard":null,"tryCatchPattern":"try {\n    Object server = IPCBus.get(IMyAidlInterface.class);\n} catch (IllegalStateException e) {\n    if (e.getMessage().contains(\"asInterface\")) {\n        // Stub missing: disable obfuscation or regenerate AIDL\n    }\n}","preventionTips":["Only register AIDL-generated interfaces with IPCBus","Keep $Stub classes from shrinking/obfuscation","Clean-rebuild after editing .aidl files"],"tags":["android","aidl","reflection","proguard"],"backgroundTag":"resource-not-found","analyzedSha":"666fefcb5d3f39cc944001c3457c38ffd6544c87","analyzedAt":"2026-09-09T11:09:01.694Z","contentChangedAt":"2026-09-09T11:09:01.694Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}