0

I want to install program update. my code is:

private void installApk(File file) {

        if(file.exists()){
            try {   
                final String command = "pm install -r " + file.getAbsolutePath();
                Process proc = Runtime.getRuntime().exec(command);
                proc.waitFor();
            } catch (Exception e) {
                e.printStackTrace();
            }
         }
    }

permission:

    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.INSTALL_PACKAGES"/> 

signed my app with signAPK. this program not work.please help me!

Termininja
  • 6,620
  • 12
  • 48
  • 49
mohammad madani
  • 135
  • 3
  • 11

1 Answers1

0

you cannot install an apk by command line. adb is just a tool. "adb" and "install" is not shell command. Please refer to this answer if you would like to install apk. Android: install .apk programmatically

Community
  • 1
  • 1
Horyun Lee
  • 1,083
  • 8
  • 9