Android 如何编译 Dalvik 以在 Linux 上本地运行它?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3542268/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 10:41:03  来源:igfitidea点击:

How can I compile Dalvik to run it locally on Linux?

androiddalvik

提问by Steve

What are the minimal steps necessary (including retrieving the source code) to compile and run just the Dalvik virtual machine on Linux?

在 Linux 上编译和运行 Dalvik 虚拟机所需的最少步骤(包括检索源代码)是什么?

采纳答案by CommonsWare

Dalvik runs on Android. The authors of Dalvik are only worrying about it running on Android, as far as we are aware.

Dalvik 在 Android 上运行。据我们所知,Dalvik 的作者只是担心它在 Android 上运行。

Various groups have indicated they are working on getting Dalvik outside of Android. You are probably best off finding and talking to them.

各种团体都表示他们正在努力让 Dalvik 脱离 Android。您可能最好找到他们并与他们交谈。

In other words, there are no official instructions of the type you seek.

换句话说,没有您寻求的类型的官方说明。

Sorry!

对不起!

回答by Laurent

Actually, that's rather android running on Dalvik and the underlying system is already linux.

实际上,这是在Dalvik上运行的android,底层系统已经是linux。

I guess running a bare Dalvik VM on a desktop linux box is just a matter of getting the sources and compile it.

我想在桌面 linux 机器上运行一个裸 Dalvik VM 只是获取源代码并编译它的问题。

The GUI stuff is something else.

GUI 的东西是别的东西。

回答by raven myers

Use sabayon Linux. This is a distro that can natively run Android programs and all Linux ones too.

使用sabayonLinux。这是一个可以在本地运行 Android 程序和所有 Linux 程序的发行版。

回答by Suici Doga

Actually , I got Dalvik working on my elementary OS installation.

实际上,我让 Dalvik 处理我的基本操作系统安装。

First download the Android AOSP source tree using https://source.android.com/source/downloading.html. Wait for it to download (2 hours for me cloning only the current commits and Marshmallow branch)

首先使用https://source.android.com/source/downloading.html下载 Android AOSP 源代码树。等待它下载(我只克隆了当前提交和棉花糖分支 2 小时)

After running build/envsetup.shwhile in the source tree run lunch full_x86-eng. Then type make -jN(replace N with number of cores).

build/envsetup.sh源代码树中运行后运行lunch full_x86-eng。然后键入make -jN(用核心数替换 N)。

WAIT. This took me about 1 hour on an AMD-4500M laptop. Newer ccomputers may be as low as half and hour and older ones might take half a day.

等待。这在 AMD-4500M 笔记本电脑上花了我大约 1 小时。较新的 ccomputer 可能低至半小时,而较旧的 ccomputer 可能需要半天。

Change directory to !!AOSP-PATH!!/out/host/linux-x86/bin/and run export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:!!AOSP-PATH!!/out/host/linux-x86/obj/lib/or

将目录更改为!!AOSP-PATH!!/out/host/linux-x86/bin/并运行export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:!!AOSP-PATH!!/out/host/linux-x86/obj/lib/

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:!!AOSP-PATH!!/out/host/linux-x86/lib

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:!!AOSP-PATH!!/out/host/linux-x86/lib

or export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:!!AOSP-PATH!!/out/host/linux-x86/lib64

或者 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:!!AOSP-PATH!!/out/host/linux-x86/lib64

TRY ALL OF THESE

尝试所有这些

and then ./dalvikvm --32. If you try to run without the --32option it will crash (don't know why)

然后 ./dalvikvm --32。如果您尝试在没有--32选项的情况下运行它会崩溃(不知道为什么)

Working Marshmallow Dalvik. To get the GUI apps working you will need to do some more porting and coding which is another project which I am working on.

工作棉花糖达尔维克。要使 GUI 应用程序正常工作,您需要进行更多的移植和编码,这是我正在从事的另一个项目。

Took me half a day to figure this out.

花了我半天时间才弄明白。

References

参考

http://milk.com/kodebase/dalvik-docs-mirror/docs/hello-world.html

http://milk.com/kodebase/dalvik-docs-mirror/docs/hello-world.html

回答by Tijs Maas

You are not the only one with this idea, and that is great in internet society terms.

你不是唯一一个有这个想法的人,这在互联网社会方面很棒。

This is probably what you are looking for: http://www.android-x86.org/. Those guys ported android over to x86.

这可能就是您要查找的内容:http: //www.android-x86.org/。那些家伙将 android 移植到 x86。

It still works as an OS, so I'm not sure if you can run Linux and Android(Linux) together without using VirtualBox.

它仍然可以作为操作系统运行,所以我不确定你是否可以在不使用 VirtualBox 的情况下同时运行 Linux 和 Android(Linux)。

回答by Flight Odyssey

Getting apps designed for Android to run on Linux is going to be tricky. However, it is possible to run a Dalvik VM on Linux. In fact, this GitHub projecthas a pre-compiled binary of Dalvik VM for Linux, ready to use! Check the associated blog postfor information about how the binary was compiled and how to use it.

让专为 Android 设计的应用程序在 Linux 上运行会很棘手。但是,可以在 Linux 上运行 Dalvik VM。事实上,这个 GitHub 项目有一个预编译的 Dalvik VM for Linux 二进制文件,随时可用!查看相关的博客文章,了解有关如何编译二进制文件以及如何使用它的信息。

回答by user161348

Learn to program Java \ C \ C++ and other frameworks

学习编程Java\C\C++等框架

Modify the Android source (I think app_process or something) so it shows a windows on the Linux desktop (learn X11 / Wayland APIs)

修改 Android 源代码(我认为是 app_process 之类的),使其在 Linux 桌面上显示一个窗口(学习 X11/Wayland API)

Below is a simpile base for you to start with

下面是一个简单的基础让你开始

www.android-x86.org/getsourcecode

www.android-x86.org/getsourcecode

Getting Android-x86 source code

获取 Android-x86 源代码

First, follow this page to configure your build environment. Then

首先,按照此页面配置您的构建环境。然后

mkdir android-x86
cd android-x86

repo init -u git.android-x86.org/manifest -b $branch
repo sync

Where $branch is any branch name described in the previous section. This will point the projects created or modified by android-x86 to our git server. All the other projects still point to AOSP. We also have a git mirror server on SourceForge.net. To use it, you only need to change the repo init command to

其中 $branch 是上一节中描述的任何分支名称。这会将 android-x86 创建或修改的项目指向我们的 git 服务器。所有其他项目仍然指向 AOSP。我们在 SourceForge.net 上也有一个 git 镜像服务器。要使用它,您只需要将 repo init 命令更改为

repo init -u git.code.sf.net/p/android-x86/manifest -b $branch