sdl_java_suite icon indicating copy to clipboard operation
sdl_java_suite copied to clipboard

Resolving use of reflection in valueForString() function

Open askirk opened this issue 7 years ago • 0 comments

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
  1. Build and run a release version of an app that integrates SDL and connects over any transport. The app's build.gradle should specify minifyEnabled = true.
  2. Connect app to a TDK / core instance
  3. View logcat errors, several NoSuchMethodException errors seen
OS & Version Information
  • Android Version: 8.1.0
  • SDL Android Version: 4.5.0
  • Testing Against: Pixel

askirk avatar May 22 '18 19:05 askirk