Install the APK file in the assets directory in your app
public class Mainactivity extends Activity {Context mcontext; @Overrideprotected void OnCreate (Bundle savedinstancestate ) {super.oncreate (savedinstancestate); Setcontentview (r.layout.activity_main); mcontext = This;//Toast.makeText ( This, "" +environment.getexternalstoragedirectory (). GetAbsolutePath (), 0). Show (); if (Copyapkfromassets (This, " Test.apk ", Environment.getexternalstoragedirectory (). GetAbsolutePath () +"/test.apk ")) {Builder m = new Alertdialog.builder (Mcontext). SetIcon (R.drawable.ic_launcher). Setmessage ("Are you installing? "). SetIcon (R.drawable.ic_launcher). Setpositivebutton (" Yes ", new Onclicklistener () {@Overridepublic void OnClick ( Dialoginterface dialog, int which) {Intent Intent = new Intent (Intent.action_view); Intent.addflags (intent.flag_ Activity_new_task); Intent.setdataandtype (Uri.parse ("file://" + environment.getexternalstoragedirectory (). GetAbsolutePath () + "/test.apk"), "application/vnd.android.package-archive"); mcontext.startactivity (intent);}}); M.show ();}} public Boolean COPYAPKFRomassets (context context, string fileName, String path) {Boolean copyisfinish = false; try {InputStream is = context.ge Tassets (). open (FileName); File File = new file (path); File.createnewfile (); FileOutputStream fos = new FileOutputStream (file); byte[] temp = new byte[1024]; int i = 0; while ((i = is.read (temp)) > 0) {fos.write (temp, 0, i);} fos.close (); Is.close (); Copyisfinish = true; } catch (IOException e) {e.printstacktrace ();} return copyisfinish; }}