我打了一堵墙.任何帮助,将不胜感激.我有一个应用程序,我想使用DexClassLoader加载另一个apk文件.
这是我的代码:
DexClassLoader dLoader = new DexClassLoader("/sdcard/download/test.apk","/sdcard/download",null,ClassLoader.getSystemClassLoader().getParent());
Class calledClass = dLoader.loadClass("com.test.classname");
Intent it=new Intent(this, calledClass);
it.setClassName("com.test", "com.test.classname");
startActivity(it);
Run Code Online (Sandbox Code Playgroud)
现在我已经安装了test.apk,所以当我运行上面的代码时它工作正常并启动了应用程序.但是我希望能够在没有test.apk安装的情况下运行它(因为这会破坏应用程序的整个点).所以我卸载它,当我再次运行我的应用程序时,我收到此错误:
android.content.ActivityNotFoundException: Unable to find explicit
activity class {com.test/com.test.classname}; have you declared this
activity in your AndroidManifest.xml.
Run Code Online (Sandbox Code Playgroud)
所以我在这里有点难过.此活动是在我试图运行的apk的清单中声明的.我无法在我的应用程序Manifest中声明它.有任何想法吗?
谢谢,克雷格
android ×1