我怎样才能创建的Andr​​oid NDK新的NativeWindow无需Android操作系统源$ C ​​$ C? [英] How can I create a new NativeWindow in Android NDK without needing the Android OS source code?

查看:781
本文介绍了我怎样才能创建的Andr​​oid NDK新的NativeWindow无需Android操作系统源$ C ​​$ C?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要编译,你可以从控制台启动的Andr​​oid x86的直接运行,或者从Android的GUI 86的内端的Andr​​oid应用的Andr​​oid OpenGL的控制台应用程序。

I want to compile an Android OpenGL console application that you can run directly from console boot Android x86, or from the Android terminal application inside Android x86 GUI.

这个职位(<一个href=\"http://stackoverflow.com/questions/5375765/how-can-i-create-a-new-nativewindow-in-android-ndk\">How我可以创建的Andr​​oid NDK新的NativeWindow?)问过类似的问题。然而,回答说下载和构建整个Android源$ C ​​$ C,因为这里的测试(<一个href=\"https://android.googlesource.com/platform/frameworks/base/+/refs/heads/gingerbread-release/opengl/tests\" rel=\"nofollow\">https://android.googlesource.com/platform/frameworks/base/+/refs/heads/gingerbread-release/opengl/tests )如(<一href=\"https://android.googlesource.com/platform/frameworks/base/+/refs/heads/gingerbread-release/opengl/tests/gl_basic/gl_basic.cpp\" rel=\"nofollow\">https://android.googlesource.com/platform/frameworks/base/+/refs/heads/gingerbread-release/opengl/tests/gl_basic/gl_basic.cpp )具有相关性,如#包括

This post ( How can I create a new NativeWindow in Android NDK? ) asks a similar question. However, the answer says to download and build the entire android source code because the tests here ( https://android.googlesource.com/platform/frameworks/base/+/refs/heads/gingerbread-release/opengl/tests ) such as ( https://android.googlesource.com/platform/frameworks/base/+/refs/heads/gingerbread-release/opengl/tests/gl_basic/gl_basic.cpp ) have dependencies such as "#include "

我要与NDK理想构建应用程序,但如果需要,我可以建立它在Ubuntu。

I want to build the application ideally with the NDK, but if necessary I could build it on Ubuntu.

gl_basic.cpp将是巨大的,但我不希望有下载和构建整个Android源$ C ​​$ C只是为了建立这样一个小程序(gl_basic.cpp仅364 code线!)

gl_basic.cpp would be great, except I don't want to have to download and build the entire Android source code just to build such a tiny program (gl_basic.cpp is only 364 lines of code!)

我试图建立与NDK-build.cmd gl_basic.cpp,但我得到FramebufferNativeWindow.h没有发现......然后如果我继续下载更多的头文件到我的本地项目中,我终于遇到链接错误。我不知道是否有使用NDK建立类似gl_basic.cpp(Android版的OpenGL可执行的main()函数)更简单的方法。

I tried to build gl_basic.cpp with ndk-build.cmd, but I get FramebufferNativeWindow.h not found... And then if I keep downloading more header files to my local project, I eventually run into link errors. I wonder if there is an easier way to build something like gl_basic.cpp (Android OpenGL executable with a main() function) using the NDK.

PS我知道写的Andr​​oid应用程序以正常的方式是创建一个APK,但我不想这样做 - 我想要一个独立的Linux可执行文件的main()和OpenGL,我可以从Android运行基于Android(不是ARM)。这里面运行Android的终端仿真器应用程序......在x86

PS I know the normal way to write Android apps is to create an APK, but I don't want to do that - I want a stand-alone Linux executable with main() and OpenGL that I can run from the Android Terminal Emulator application that runs inside Android... On x86 based Android (not ARM).

也让我补充一点,我知道你可以把包括$(BUILD_EXECUTABLE)中的Andr​​oid.mk文件:在Application.mk文件APP_ABI = 86。我没有问题,建立一个可执行的Andr​​oid NDK与-build.cmd从Android的终端仿真程序在x86 Android和输出Hello World的printf与运行()。

Also let me add that I know you can put "include $(BUILD_EXECUTABLE)" in the Android.mk file and "APP_ABI := x86" in the Application.mk file. I have no problem building an Android executable with ndk-build.cmd that runs from Android Terminal Emulator on x86 Android and prints "hello world" with printf().

我有与OpenGL的创建这样一个可执行文件问题的事情。我觉得神奇的部分是FramebufferNativeWindow.h,但有自己的包括太...我想知道如果我可以建立类似与NDK-build.cmd到gl_basic.cpp(甚至用make和gcc在Ubuntu的东西)将在Android的终端仿真程序运行......但我不希望有下载和构建整个Android的源代码树。

The thing I have a problem with is creating such an executable with OpenGL. I think part of the magic is FramebufferNativeWindow.h, but that has its own includes too... I'm wondering if I can build something similar to gl_basic.cpp with ndk-build.cmd (or even with make and gcc on Ubuntu) that will run in Android Terminal Emulator... But I don't want to have to download and build the entire Android source tree.

摘要:我怎么创建包含在NDK的头文件和库本地窗口?我知道它可以通过调用libui android_createDisplaySurface()来完成。然而,libui不包括作为NDK的一部分。那么,如何创建从NDK纯C ++(没有Java)code本机窗口(使用由EGL和OpenGL)? eglCreateWindowSurface()的第三个参数是NativeWindowType,所以我需要以某种方式创建的NativeWindow。

Summary: how do I create a native window with headers and libraries that are included in the NDK? I know it can be done by calling android_createDisplaySurface() from libui. However, libui is not included as part of the NDK. So how can I create a native window (for use by EGL and OpenGL) from the NDK with pure C++ (no Java) code? eglCreateWindowSurface()'s 3rd arg is NativeWindowType, so I need to create a NativeWindow somehow.

摘要:我的最终目标是编写一个C ++可执行绘制一个OpenGL三角形,我可以在Android x86的控制台模式运行一个main()函数。没有Java。

Summary: My ultimate goal is to write a C++ executable with a main() function that draws an OpenGL triangle, that I can run on Android x86 console mode. No Java.

推荐答案

必须下载所有必要的的#include S;你需要缺少的系统库当你链接您的可执行文件,以解决引用。你并不需要重新构建这些库,你可以找到准备使用在目标设备库,甚至可以从模拟器图像。从系统库/系统/ lib目录目录可以很容易地获得亚行拉命令。

You must download all necessary #includes; you need the missing system libraries to resolve the references when you link your executable. You don't need to rebuild these libraries, you can find ready to use libs in your target device, or even from an emulator image. System libraries from /system/lib directory can easily be obtained with adb pull command.

请注意,链接器并不需要解决的所有引用:即对于命令

Note that linker does not need to resolve all references: i.e. for command

ln A.o libB.a -lC -lD -o E

您只需要 libD.so 以符号的对象匹配的和所有引用中的 libB.a ,但不是为对象的依赖关系的 libC.so

you only need libD.so to match the symbols from object A.o and all referenced objects in libB.a, but not for the dependencies of libC.so.

这篇关于我怎样才能创建的Andr​​oid NDK新的NativeWindow无需Android操作系统源$ C ​​$ C?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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