[积累]使用proguard混淆代码后导致构造函数not fount 问题 Proguard and reflection in Android
来源:互联网 发布:通信协议和网络协议 编辑:程序博客网 时间:2024/06/01 22:47
在proguard的时候, 我们的类也会被混淆掉,导致出现
java.lang.NoSuchMethodException: [class android.content.Context这个错误
解决, 在proguard声明不要混淆需要实例化类的构造函数
-keepclassmembers class * extends com.hzy.tvmao.ir.engine.BaseIR{ public <init>(android.content.Context);}
我这里使用了一个工厂类来创建extends BaseIR的实例
/** * IREngine的工厂, 使用方式是<br> * sBaseIREngine = IREngineFactory.getBaseIR(SamsungIR.class, * TmApp.getContext()); * * @author gaoshuai * */public class IREngineFactory{ public static BaseIR getIR(Class<? extends BaseIR> clazz, Context context, int test) { try { Constructor<? extends BaseIR> constructor = clazz.getDeclaredConstructor(Context.class, int.class); constructor.setAccessible(true); BaseIR a1 = (BaseIR) constructor.newInstance(context, test); LogUtil.i(a1.getName() + " ir service found"); return a1; } catch (Throwable e) { e.printStackTrace(); LogUtil.i("IR Throwable t.toString=" + e.toString()); } return null; } public static BaseIR getIR(Class<? extends BaseIR> clazz, Context context) { // TODO Auto-generated method stub return null; }}
http://stackoverflow.com/questions/4447145/proguard-and-reflection-in-android
0 0
- [积累]使用proguard混淆代码后导致构造函数not fount 问题 Proguard and reflection in Android
- Android 使用 ProGuard 混淆代码
- 使用proguard混淆android代码
- 使用proguard混淆android代码
- 使用proguard混淆android代码
- 使用proguard混淆android代码
- 使用ProGuard混淆Android代码
- android 代码混淆proguard
- android 代码混淆proguard
- Android proguard代码混淆
- Android proguard 混淆代码
- android 代码混淆 proguard
- android混淆代码-proguard
- Android-Proguard代码混淆
- Android ProGuard代码混淆
- Android proguard 代码混淆
- Android ProGuard代码混淆
- Android proguard代码混淆
- [leetcode] #129 Sum Root to Leaf Numbers
- mysql中date类型的比较
- 《代码整洁之道》读书笔记
- myeclipse8.5破解
- java内置工具
- [积累]使用proguard混淆代码后导致构造函数not fount 问题 Proguard and reflection in Android
- Oraclle11gR2_为GoldenGate源端添加pump进程二
- CentOS 6.6系统安装配置图文教程
- USACO--3.1Agri-Net+prime算法
- 关于UIWebView的那些事儿
- python numpy教程
- python大小写转换函数备忘
- UVA 11149-Power of Matrix (等比矩阵求和)
- android学习