{"record":{"id":"cdda2d5c752de2e4","repo":"microg/GmsCore","slug":"could-not-access-the-field-in-remotebinder","errorCode":null,"errorMessage":"Could not access the field in remoteBinder.","messagePattern":"Could not access the field in remoteBinder\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"play-services-basement/src/main/java/com/google/android/gms/dynamic/ObjectWrapper.java","lineNumber":82,"sourceCode":"            }\n        }\n\n        if (field == null) {\n            throw new IllegalArgumentException(\"No non-synthetic fields were found\");\n        }\n\n        if (!field.isAccessible()) {\n            field.setAccessible(true);\n            try {\n                return field.get(binder);\n            } catch (NullPointerException localNullPointerException) {\n                throw new IllegalArgumentException(\"Binder object is null.\",\n                        localNullPointerException);\n            } catch (IllegalArgumentException localIllegalArgumentException) {\n                throw new IllegalArgumentException(\"remoteBinder is the wrong class.\",\n                        localIllegalArgumentException);\n            } catch (IllegalAccessException localIllegalAccessException) {\n                throw new IllegalArgumentException(\"Could not access the field in remoteBinder.\",\n                        localIllegalAccessException);\n            }\n        } else {\n            throw new IllegalArgumentException();\n        }\n    }\n\n    @Nullable\n    public static <T> T unwrapTyped(IObjectWrapper obj, Class<T> clazz) {\n        try {\n            return clazz.cast(unwrap(obj));\n        } catch (ClassCastException e) {\n            return null;\n        }\n    }\n\n    public static <T> ObjectWrapper<T> wrap(T t) {\n        return new ObjectWrapper<T>(t);","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/microg/GmsCore/blob/157c9d86ac46c195a86c2f15ab55c84036223f95/play-services-basement/src/main/java/com/google/android/gms/dynamic/ObjectWrapper.java#L64-L100","documentation":"During ObjectWrapper.unwrap, field.get(binder) threw an IllegalAccessException, rethrown as 'Could not access the field in remoteBinder.' Reflection was denied access to the wrapper's field — the field is not accessible and setAccessible/visibility rules (or JVM/module restrictions) blocked the read.","triggerScenarios":"The binder class or its field was made non-public/inaccessible (obfuscation, custom classloader, restricted module); running on a JVM/Android version where setAccessible on that member is disallowed; a custom IObjectWrapper implementation with a private field in a restricted package.","commonSituations":"Aggressive proguard/R8 configs altering visibility of gms dynamic classes; instrumentation or sandboxed environments blocking reflection; mismatched classloaders in plugin/dynamic-feature setups.","solutions":["Keep com.google.android.gms.dynamic.** classes and members (including non-public ones) via proguard keep rules","Ensure the binder class is loaded by the app's classloader, not an isolated one","Catch IllegalArgumentException and handle gracefully instead of crashing","If feasible, pass the wrapped value through a typed AIDL interface instead of reflective unwrap"],"exampleFix":"// before\nObject v = ObjectWrapper.unwrap(w); // IllegalAccessException path\n// after\nObject v;\ntry {\n    v = ObjectWrapper.unwrap(w);\n} catch (IllegalArgumentException e) {\n    Log.w(TAG, \"Cannot unwrap remote binder\", e);\n    v = null;\n}","handlingStrategy":"try-catch","validationCode":"IBinder b = wrapper.asBinder();\nif (b == null || !b.getClass().getName().startsWith(\"com.google.android.gms.dynamic\")) {\n    /* foreign/restricted binder — avoid reflective unwrap */\n}","typeGuard":null,"tryCatchPattern":"try {\n    T value = ObjectWrapper.unwrapTyped(wrapper, T.class);\n} catch (IllegalArgumentException e) {\n    // includes IllegalAccessException path — fall back to non-reflective access\n}","preventionTips":["Add proguard keep rules preserving gms dynamic classes/members and their visibility","Avoid custom classloaders/isolated processes for binder objects","Prefer typed AIDL interfaces over reflective unwrap where possible"],"tags":["android","reflection","access","proguard"],"backgroundTag":"type-mismatch","analyzedSha":"157c9d86ac46c195a86c2f15ab55c84036223f95","analyzedAt":"2026-09-06T17:27:33.892Z","contentChangedAt":"2026-09-06T17:27:33.892Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}