I am facing a problem when i use proguard for application having used telephonyservice apis using reflection in android.
I have defined a package com.android.internal.telephony and there i have copied ITelephony.aidl file.
Here is the snippet of the code where i am using the methods of telephony using reflection.
Class<?> c = Class.forName(tm.getClass().getName());
Method m = c.getDeclaredMethod("getITelephony");
m.setAccessible(true);
com.android.internal.telephony.ITelephony telephonyService =
(com.android.internal.telephony.ITelephony) m.invoke(tm);
if(buttonInAction == acceptButton){
Log.v(TAG, "Answering the call");
telephonyService.answerRingingCall();
finish();
}
else{
Log.v(TAG, "Rejecting the call");
telephonyService.endCall();
finish();
}
Now without proguard i am able to use this apis, but when i use proguard for compliling, it gives classcastexception. I know i need to add something in proguard.cfg file and i also tried several things like -dontshrink -dontoptimize, but still it did not work.
Please let me know if i am missing something which needs to be added in that file or any other solution to this problem. Thanks Nawab
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With