我有service.apk使用资源在状态栏中显示通知。动态加载apk使用资源
我动态加载正在使用这些资源,但然后通知资源莫名其妙消失的课,我得到这个错误:
W/ResourceType(1142): No known package when getting value for resource number 0x7f020001 W/StatusBarIconView(1142): Icon not found in 2130837505: 7f020001 W/StatusBarIconView(1142): No icon for slot android/0x20 W/ActivityManager( 941): crashApplication: trying to crash self! D/NotificationService( 941): onNotification error pkg=android tag=null id=32; will crashApplication(uid=1000, pid=941) W/StatusBar(1142): removeNotification for unknown key: [email protected]
动态加载代码:
PathClassLoader classLoader =
new PathClassLoader("system/app/ServiceImpl.apk",
ClassLoader.getSystemClassLoader());
Class someClass =
classLoader.loadClass("com.bla.ServiceImpl");
Constructor<Class> ctor = someClass.getConstructor(Context.class);
Object someObject = ctor.newInstance(context);
我在想也许我加载apk的方式是错误的?也许我应该为资源添加路径?
任何帮助将非常感谢!
这看起来会变得非常复杂,如果它甚至有可能的话。在功能方面,你真的想要达到什么目标?你觉得这是它的方法吗? –
service.apk正在使用资源在状态栏中显示通知(而不是在下拉菜单中),只能使用资源。我需要动态加载该service.apk并让它仍然显示通知... –
但你希望通过动态加载服务apk实现什么?这是不可能做你想象的。 –