asLody/VirtualApp · error · IllegalStateException
Can not found the
Error message
Can not found the
What it means
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.
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
Example fix
// proguard-rules.pro
# before: missing keep rule, Stub renamed
# after
-keep class * implements android.os.IInterface
-keep class **$Stub { *; } Defensive patterns
Strategy: validation
Validate before calling
// ensure interface derives from AIDL and Stub survives obfuscation
-keep class * implements android.os.IInterface { *; }
-keep class **$Stub { *; } Try / catch
try {
Object server = IPCBus.get(IMyAidlInterface.class);
} catch (IllegalStateException e) {
if (e.getMessage().contains("asInterface")) {
// Stub missing: disable obfuscation or regenerate AIDL
}
} Prevention
- Only register AIDL-generated interfaces with IPCBus
- Keep $Stub classes from shrinking/obfuscation
- Clean-rebuild after editing .aidl files
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Not supported in system context
- Can not found the ipc method :
- Unable to create application
- Unable to start receiver
- VirtualCore.startup() must called in main thread.
AI-assisted analysis of asLody/VirtualApp@666fefcb5d (2026-09-09).
Data as JSON: /api/errors/5cd82b6675648826.
Report an issue: GitHub.
Appendix: source
Thrown at VirtualApp/lib/src/main/java/com/lody/virtual/helper/ipcbus/IPCMethod.java:97
private static Method findAsInterfaceMethod(Class<?> type) {
for (Class<?> innerClass : type.getDeclaredClasses()) {
// public static class Stub extends Binder implements IType
if (Modifier.isStatic(innerClass.getModifiers())
&& Binder.class.isAssignableFrom(innerClass)
&& type.isAssignableFrom(innerClass)) {
// public static IType asInterface(android.os.IBinder obj)
for (Method method : innerClass.getDeclaredMethods()) {
if (Modifier.isStatic(method.getModifiers())) {
Class<?>[] types = method.getParameterTypes();
if (types.length == 1 && types[0] == IBinder.class) {
return method;
}
}
}
}
}
throw new IllegalStateException("Can not found the " + type.getName() + "$Stub.asInterface method.");
}
public Object callRemote(IBinder server, Object[] args) throws RemoteException {
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
Object result;
try {
data.writeInterfaceToken(interfaceName);
data.writeArray(args);
server.transact(code, data, reply, 0);
reply.readException();
result = readValue(reply);
if (resultConverter != null) {
result = resultConverter.convert(result);
}
} finally {
data.recycle();
reply.recycle();View on GitHub (pinned to 666fefcb5d)