sdl_java_suite
sdl_java_suite copied to clipboard
Resolving use of reflection in valueForString() function
Bug Report
Currently the generic RpcStruct class uses a method in a bunch of classes called valueForString that each return a specific type according to the object. (https://github.com/smartdevicelink/sdl_android/blob/master/sdl_android/src/main/java/com/smartdevicelink/proxy/RPCStruct.java#L204) If an app developer obfuscates the library within their app, this causes the reflective call not to work. Additionally, Android P guidelines prohibit the use of reflection on non-SDK interfaces. (https://developer.android.com/preview/restrictions-non-sdk-interfaces) Therefore, a solution should be saught that doesn't use reflection.
Reproduction Steps
- Build and run a release version of an app that integrates SDL and connects over any transport. The app's
build.gradleshould specifyminifyEnabled = true. - Connect app to a TDK / core instance
- View logcat errors, several
NoSuchMethodExceptionerrors seen
OS & Version Information
- Android Version: 8.1.0
- SDL Android Version: 4.5.0
- Testing Against: Pixel