【问题标题】:Need to run shell command android需要运行shell命令android
【发布时间】:2012-05-03 20:24:34
【问题描述】:

我正在尝试通过 java 运行这些 shell 命令,但没有成功。代码执行完美,但 .so 文件不执行。当我在 adb 中使用这些命令时,一切正常。

  

    private void submit() {
       System.out.println("doooooooooo");
          try {
               String[] commands = {"cd /data/data/com.dailydeals.usethisnow/lib", 
                                    "./libdeals.so" };
               Process p = Runtime.getRuntime().exec("/system/bin/sh -");
               DataOutputStream os = new DataOutputStream(p.getOutputStream());            
                  for (String tmpCmd : commands) {
                          os.writeBytes(tmpCmd+"\n");
                  }
              } catch (IOException e) {
              e.printStackTrace();    
              }
              System.out.println("doneooooooooo");
        } 

 

【问题讨论】:

标签: android shell command exec


【解决方案1】:

【讨论】:

  • 也许,但问题的前提是错误的 - 正如 zapl 在您几分钟后指出的那样,实际上没有要运行的 shell 命令。相反,有一个需要动态加载的子例程,以便可以调用它可能包含的一个或多个函数。
猜你喜欢
  • 2022-07-12
  • 2021-09-10
  • 1970-01-01
  • 2021-02-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多