我正在尝试使用Android的更新程序脚本语言(Edify?)来通过无线方式将APK安装到我可以控制的嵌入式设备上. 这是一个描述语言的链接.
我的第一次尝试如下:
package_extract_file("added_files/data/app/test.apk", "/data/app/test.apk");
Run Code Online (Sandbox Code Playgroud)
这导致test.apk自动安装/data/data/com.acme.test,但目录/data/data/com.acme.test/lib是空的,而它应该包含test.so,包含在其中的共享库test.apk.(如果我使用手动安装adb install test.apk,则会解压缩库.)
然后我尝试将APK解压缩/data而不是/data/app因此操作系统不会自动安装它/data/data,我可以尝试使用脚本进行安装:
package_extract_file("added_files/data/app/test.apk", "/data/test.apk");
run_program("/system/bin/pm", "install", "/data/test.apk");
Run Code Online (Sandbox Code Playgroud)
这导致以下错误:
about to run program [/system/bin/pm] with 3 args
run_program: execv failed: Exec format error
run_program: child exited with status 1
Run Code Online (Sandbox Code Playgroud)
我不确定为什么会发生上述错误.
有没有办法安装APK并自动提取其共享库?我可以手动安装库,但我希望避免这种情况.
我正在尝试使用命令行实用程序productsign签署OS X安装程序包,但收到错误.
productsign --sign "Developer ID Installer: XYZ" input.pkg output.pkg
productsign: error: Could not find appropriate signing identity for “Developer ID Installer: XYZ”.
Run Code Online (Sandbox Code Playgroud)
当我打开Keychain Access时,我能够看到我在developer.apple.com上创建的证书并导入到我的登录Keychain中.它的Common Name与我的命令行参数匹配:"Developer ID Installer:XYZ".有没有办法调试这个特定的错误?
假设我在svn中执行以下步骤:
rev 1: create a file called 'foo'
rev 2: delete 'foo'
rev 3: create a new file called 'foo'
Run Code Online (Sandbox Code Playgroud)
如果我想看到第一个' foo'使用svn的内容,我需要使用peg修订版语法' svn cat foo@1',因为传统的语法' svn cat -r 1 foo'会失败.
我已经读过git跟踪内容而不是文件,所以这是否意味着不需要像peg修订版这样的东西?
我将Eclipse从Galileo升级到Helios,当我尝试"清理项目"时,我收到一条错误消息"无法运行程序;未知原因".我能够在Galileo中运行make,所以我不确定为什么会发生这种情况,以及是否有其他人遇到过这种情况.
ext3有3个日记选项:journal,ordered和writeback.根据维基百科条目,这些范围从最小风险到最危险的崩溃恢复.出于某种原因,Android的Linux版本仅支持后两个选项,默认为回写.(我正在经营Froyo)
有没有办法添加对日记模式的支持?我想在/ data分区上执行此操作,这是ext3,也是大多数文件写入的地方.我的设备没有电池,所以当有人断电时,我需要确保它是防撞的.
如果有人感兴趣,Linux选项在kernel/fs/ext3/Kconfig中定义.具体选项是EXT3_DEFAULTS_TO_ORDERED.
有没有办法检测USB闪存驱动器何时插入Android设备?我能够使用广播接收器检测SD卡,但它不适用于USB.我想避免民意调查.
注册接收器的代码:
private void RegisterUpdateReceiver()
{
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction("android.intent.action.MEDIA_MOUNTED");
intentFilter.addDataScheme("file");
myReceiver = new MyReceiver();
this.registerReceiver(myReceiver, intentFilter);
}
Run Code Online (Sandbox Code Playgroud)
接收代码:
public class MyReceiver extends BroadcastReceiver
{
@Override
public void onReceive(Context context, Intent intent)
{
String action = intent.getAction();
if (action.equals("android.intent.action.MEDIA_MOUNTED"))
{
// react to event
}
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试确定主屏幕的大小,以便我可以捕获其图像.我的设置是一台拥有1600x900显示屏的笔记本电脑和一台1920x1080的外接显示器.获取大小的代码在Windows上运行正常,但在Ubuntu上使用MonoDevelop会产生错误的结果.
Rectangle capture_rect = System.Windows.Forms.Screen.PrimaryScreen.Bounds;
Console.WriteLine("width={0} height={1}", capture_rect.Height, capture_rect.Width);
Run Code Online (Sandbox Code Playgroud)
Ubuntu的结果是"width = 3520 height = 1080".如果我断开外接显示器,我会得到正确的结果,即"宽度= 1600高度= 900".知道为什么我在具有多个显示器的Ubuntu上得到了错误的值吗?
我是git的新手,并且正在使用类似于svn的集中式工作流程.我想定期知道我的状态与中央回购的比较.例如,如果我运行以下命令...
$ git clone git@github.com:centralrepo/test.git
$ cd test; <make some changes inside test/>
$ git commit -a
$ git pull
Run Code Online (Sandbox Code Playgroud)
... git pull说"已经是最新的".为什么没有git pull报告更改,如果这是正确的行为,有没有办法知道我的本地与远程同步?
我在SO上看过这篇文章:有没有办法在c ++中禁用旧的C样式演员,并且很高兴能够应用-Wold-style-cast到我的Android C++代码中.我很快遇到了以下演员阵容stdio.h:
static __inline int __sputc(int _c, FILE *_p) {
if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n'))
return (*_p->_p++ = _c);
else
return (__swbuf(_c, _p));
}
Run Code Online (Sandbox Code Playgroud)
该文件stdio.h是通过一系列其他包括从中开始的ostream.C++库头文件是否应包含进行C样式转换的C头文件?有没有人尝试在Android NDK下禁用C样式演员?
在下面的代码中,应该在哪里构建sc?如果没有"sc = new SClass()"这一行,我会得到一个空指针异常,但我不确定它是否适合它.我尝试使用静态初始化程序块,但这给了我一个编译器错误.
第二个问题是,有关于这种静态初始化的文档吗?我只能找到对静态基元的引用,而不是静态对象.
class A {
private class SClass{
String s;
String t;
}
private static SClass sc;
public void StringTest() {
sc = new SClass();
sc.s = "StringTest";
System.out.println(sc.s);
}
}
public class Test {
public static void main(String[] args) {
A a = new A();
a.StringTest();
}
}
Run Code Online (Sandbox Code Playgroud)