如何在没有 Android 模拟器的情况下在 linux 上运行 Android 的 .apk 文件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11682055/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I run Android's .apk files on linux without the Android emulator?
提问by Hrishikesh Murali
I have a requirement, where I need to install the .apk files directly on my host PC, without the Android emulator. I want to install it directly on my Linux machine (x86 arch). I have a few noob questions with regard to the same:
我有一个要求,我需要直接在我的主机 PC 上安装 .apk 文件,而不需要 Android 模拟器。我想直接在我的 Linux 机器(x86 arch)上安装它。我有几个菜鸟问题:
- How is an .apk file organized?
- Is it just one big binary file?
- In this case, if I am using a phone with an x86 atom processor, does this mean that there will be a separate Android market segment which hosts apps ported to the x86 arch?
- Is it an archive consisting of executables? (something like .rpm or .deb).
- If so, then what is the format of the archive?
- If so, do they have different .apk files for different architectures (x86, ARM, etc.).
- If not, then how is it orgranized?
- Is it just one big binary file?
- What are the requirements to run the .apk file directly on my Linux PC running on x86 arch?
- .apk 文件是如何组织的?
- 它只是一个大的二进制文件吗?
- 在这种情况下,如果我使用的是带有 x86 atom 处理器的手机,这是否意味着会有一个单独的 Android 细分市场来托管移植到 x86 架构的应用程序?
- 它是由可执行文件组成的存档吗?(类似于 .rpm 或 .deb)。
- 如果是这样,那么存档的格式是什么?
- 如果是这样,它们是否具有针对不同架构(x86、ARM 等)的不同 .apk 文件。
- 如果不是,那么它是如何组织的?
- 它只是一个大的二进制文件吗?
- 在运行 x86 arch 的 Linux PC 上直接运行 .apk 文件有什么要求?
I do not have a very good background of Android and the .apk files, hence these questions.
我没有很好的 Android 背景和 .apk 文件,因此有这些问题。
Thanks and regards,
感谢致敬,
Hrishikesh Murali
赫里希凯什·穆拉里
回答by JiTHiN
You cannot install .apk files directly onto your PC. Even though Android uses the Linux kernel, the applications runs on a totally different platform. APK files are ZIP file formatted packages based on the JAR file format, with .apk file extensions. They hold all of that program's code (such as .dex files), resources, assets, certificates, and manifest file. They run only on the Dalvik virtual machine.
您不能将 .apk 文件直接安装到您的 PC 上。尽管 Android 使用 Linux 内核,但应用程序在完全不同的平台上运行。APK 文件是基于 JAR 文件格式的 ZIP 文件格式包,文件扩展名为 .apk。它们包含该程序的所有代码(例如 .dex 文件)、资源、资产、证书和清单文件。它们仅在Dalvik 虚拟机上运行。
Install Android OS on your PC, if you really want to run them from a computer.
如果您真的想从计算机上运行它们,请在您的 PC 上安装 Android 操作系统。
回答by apk2crx
You can use the ARChon to run apk in ubuntu:
您可以使用 ARChon 在 ubuntu 中运行 apk:
- Install the ARChon Runtime. http::github.com/vladikoff/chromeos-apk/blob/master/archon.md
- Open and enable the flag: chrome://flags/#enable-nacl,then restart Google-Chrome. (Important!)
- Install existing android apps in the websiteor convert your favourite android apps by "Online APK-CRX Converter.
- Drag and drop the Google-Chrome extensions into the chrome://extensions/ page in the browser and it will be installed in your browser. Enjor it!
- 安装 ARchon 运行时。http::github.com/vladikoff/chromeos-apk/blob/master/archon.md
- 打开并启用标志:chrome://flags/#enable-nacl,然后重新启动 Google-Chrome。(重要的!)
- 在网站上安装现有的 android 应用程序或通过“在线 APK-CRX 转换器”转换您喜欢的 android 应用程序。
- 将 Google-Chrome 扩展程序拖放到浏览器的 chrome://extensions/ 页面中,它将安装在您的浏览器中。享受吧!
回答by Gary van der Merwe
There is a project that aims to make this possible: http://www.icedrobot.org/
有一个项目旨在使这成为可能:http: //www.icedrobot.org/
Unfortunately, as of November 2012, it seems to be inactive.
不幸的是,截至 2012 年 11 月,它似乎处于非活动状态。
回答by Achilles
- An apk file is not an executable, it's just an archive file contaning all the resources and class files that are to be used by the application.
- The apk is set to be unpacked and run by the Dalvik vm.
- The elements that are contained inside the apk file are specifically designed and designated to be used in Android mobile phones and not a desktop PC running Linux. Though Android uses the Linux kernel, you definitely cannot run the apk file on a Linux machine, as you would an rpm or a deb file.
- apk 文件不是可执行文件,它只是一个存档文件,其中包含应用程序要使用的所有资源和类文件。
- 该 apk 设置为由 Dalvik 虚拟机解压和运行。
- apk 文件中包含的元素是专门设计和指定用于 Android 手机而不是运行 Linux 的台式机的。尽管 Android 使用 Linux 内核,但您绝对不能在 Linux 机器上运行 apk 文件,就像 rpm 或 deb 文件一样。