Closed xbao closed 9 years ago
It looks like the samsung BT SDK is accessing classes that aren't exported by the Android framework.
Example: android.os.ServiceManager (notice the /** @hide **/
)
These are not in the jar files released in the SDK.
Given this, the next question is why it compiles without warning normally
Looking at the jar files in the Android SDK, it seems only layoutlib.jar
exports them
=== file: /home/xiao/dev/android-sdk/android-sdk-linux/platforms/android-17/data/layoutlib.jar ===
android/os/ServiceManagerProxy.class
android/os/ServiceManagerNative.class
android/os/ServiceManager.class
--
=== file: /home/xiao/dev/android-sdk/android-sdk-linux/platforms/android-20/data/layoutlib.jar ===
android/os/ServiceManagerProxy.class
android/os/ServiceManagerNative.class
android/os/ServiceManager.class
--
=== file: /home/xiao/dev/android-sdk/android-sdk-linux/platforms/android-21/data/layoutlib.jar ===
android/os/ServiceManager.class
android/os/ServiceManagerNative.class
android/os/ServiceManagerProxy.class
To ignore the warnings, as recommended on the samsung developer forum (thread), we can add -dontwarn com.samsung.**
to the proguard rules.
I'm still not sure why it happens only for the hr code as a module. It could be because it's a library and so proguard doesn't include layoutlib.jar
. I compared the output of
gradle clean && gradle :app:assembleFroyoRelease --debug 2>&1 > froyo.debug.txt
between the working build without hrmodule
and the broken build with it. There were a couple of jar files mentioned in the working build that weren't mentioned in the broken one, but none of them had the classes the Samsung library needed.
Not going to dig further as I doubt ignoring the warnings will break anything. Those classes are definitely available at runtime for the few Android versions in which the Samsung BLE library is used.
The Samsung BLE library (used for 4.1, 4.2 and 4.2.2) uses the following hidden classes:
as well as some hidden methods in
android.bluetooth.BluetoothDevice
. This causes errors in proguard when it tries to identify dead codeproguard warning: