1、java 反射加载apk
String path=Environment.getExternalStorageDirectory().getAbsolutePath()+"/";
String fileName="loadB.apk";
DexClassLoader classLoader=new DexClassLoader(path+fileName, path, null, getClassLoader());
Class loadClass=classLoader.loadClass("cn.yws.loadb.MainActivity");
Constructor constructor=loadClass.getConstructor(new Class[]{});
Object loadBActivity=constructor.newInstance(new Object[]{});
Method getMoney=loadClass.getMethod("getMoney", null);
getMoney.setAccessible(true);
Object money=getMoney.invoke(loadBActivity, null);
Toast.makeText(this, money.toString(), Toast.LENGTH_LONG).show();
Log.i("MainActivity", money.toString());