1、须要RootTools.jar
2、运行脚本
public class InstallerActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
try {
Runtime.getRuntime().exec("su");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void click(View view){
EditText et = (EditText) findViewById(R.id.editText1);
String path = et.getText().toString().trim();
try {
RootTools.sendShell("/system/bin/pm install -r "+path, 30000);
} catch (Exception e) {
e.printStackTrace();
}
}
}
时间: 2024-11-07 15:37:30