I'm trying to figure out a way to package a .apk right from an Android application on a phone. There must be some implementation in the sdk to compile the app binary into a .apk so would it be possible to run that code in an Activity? My goal is to write an application that can use "templates" to build a java files, manifest, etc. than compile them into a new application at runtime. The trick is to also install this new application at run time and I'm open to suggestions .