工作目录:空环境中运行Process.Builder在Android上时, [英] Working Directory : null environment when running Process.Builder on android

查看:574
本文介绍了工作目录:空环境中运行Process.Builder在Android上时,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用两部手机,Galaxy Nexus的(软糖)和Nexus 5(奇巧)。我想执行存在于一个脚本

I am using two phones, Galaxy Nexus(JellyBean) and Nexus 5(KitKat). I am trying to execute a script which exists in

/data/folder/scripts/run.sh

/data/folder/scripts/run.sh

我用Process.Builder建命令。这个命令是通过获取建

I use Process.Builder to build the command. This command is built by getting

Environment.getDataDirectory()的toString()+/folder/scripts/run.sh

Environment.getDataDirectory().toString() + "/folder/scripts/run.sh"

有对Galaxy Nexus的运行这没有问题,但是当我上了Nexus 5运行它,我捕捉异常,当我运行的Process.Start()。这是我得到的输出包括:

There are no issues running this on the Galaxy Nexus but when I run it on the Nexus 5, I catch an exception when I run the process.start(). The output which I get contains:

错误运行EXEC()。命令:[/data/folder/scripts/run.sh,参数。工作目录:空环境:[ADNROID_ROOT = /系统...]

Error running exec(). Command: [/data/folder/scripts/run.sh, "param"]. Working directory: null Environment: [ADNROID_ROOT=/system ... ]

我的脚本目录结构是在这两个文件是相同的。

The directory structure of my scripts is the same on both files.

编辑:

所以,我一直在寻找在logcat的,只要我加载应用程序,我想我已经明确指出了问题。

So I was looking at the logcat as soon as I load the application and I think I've pinpointed the issue.

有一个错误,说没有发现清单文件。 警告:java.io.FileNotFoundException /数据/文件夹/清单:打开失败EACCESS(权限被拒绝)

There's an ERROR saying Manifest file not found. WARNING: java.io.FileNotFoundException /data/folder/Manifest: open failed EACCESS (Permission Denied).

这不上来了其运行软糖银河的Nexus。它是一些安全问题奇巧?

This doesn't come up for the Galaxy Nexus which is running JellyBean. Is it some security issue with KitKat?

推荐答案

这个问题是由于没有root权限。修正了当SuperSu获准申请。

The issue was due to not having root access. Fixed when SuperSu granted permission to the application.

这篇关于工作目录:空环境中运行Process.Builder在Android上时,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆