我可以制作一个相当原生的 C++ 吗?安卓应用程序?

发布于 2024-08-22 10:27:54 字数 216 浏览 4 评论 0原文

我对以下功能感兴趣:

  1. 为 Android Market 编写一个完全用 C++ 编写的应用程序(实际上是现有产品的端口)。
  2. 使用快速屏幕缓冲区像素推送(或者更确切地说使用 OpenGL ES 来实现此目的)。
  3. 获取用户输入并将其定向到 C++ 代码。

为 Market 编写这样的应用程序合法吗?市场政策对此类事情是否严格?

I'm interested in the following features:

  1. Writing an app for Android Market that is written completely in C++ (a port of existing product actually).
  2. Use fast screen-buffer pixel pushing (or rather using OpenGL ES for this).
  3. Grab user input and direct it to C++ code.

Is it legal to write such an app for Market? Is Market policy somehow strict to such things?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

£噩梦荏苒 2024-08-29 10:27:54

从带有 Android 2.3 (Gingerbread) 的 NDK r5 开始,这是可能的,尽管我假设只有支持本机应用程序的设备上必须有 Gingerbread。

来自本机活动示例:

Android SDK提供了一个辅助类NativeActivity,它允许你编写一个完整的
本机活动。通过本机活动,可以编写完全本机应用程序。
NativeActivity 处理 Android 框架和您的应用程序之间的通信
本机代码,因此您不必对其进行子类化或调用其方法。您所需要做的就是声明
您的应用程序在 AndroidManifest.xml 文件中是本机的,并开始创建您的本机
应用程序。

As of NDK r5 with Android 2.3 (Gingerbread) this is possible, although I assume only devices to support natives apps must have Gingerbread on them.

From the native-activity sample:

The Android SDK provides a helper class, NativeActivity, that allows you to write a completely
native activity. With a native activity, it is possible to write a completely native application.
NativeActivity handles the communication between the Android framework and your
native code, so you do not have to subclass it or call its methods. All you need to do is declare
your application to be native in your AndroidManifest.xml file and begin creating your native
application.

余生再见 2024-08-29 10:27:54

这确实不是我的菜,但如果你想用 C 编写程序,可以使用名为 Android NDK(本机开发工具包)的东西。不过不确定 C++ 编译器支持如何。

据我所知,您的应用程序几乎可以是 100% 本机代码,但请记住,按照这种方式,您可能会很难支持 Android 硬件中的不同 CPU。如果您需要引导本机代码以便从 java 启动,这对您来说可能不是一个很大的问题。

我在谷歌搜索“Android NDK”时发现了一些不同的教程。 这是一个非常简约的 Hello World。显然,您想要的不仅仅是一个将字符串返回到 java 的库,但这是一个很好的开始,您可能必须执行所描述的所有操作。使用 NDK 和 Android 作为关键字进行搜索,您会得到一个不错的选择。我认为没有理由在这里列出它们,因为这样的列表往往会在一年左右的时间内过时并被破坏。

我想 Google 的官方 Android 开发者网站 将保持不变并更新该平台的新版本,它有当前 NDK 的链接。

It is really not my cup of tea but there is something called Android NDK (Native Development Kit) to use if you want to write your program in C. Not sure how the C++ compiler support is though.

As far as I know your app can be almost 100% native code but keep in mind that by walking that way you will probably have a hard time supporting the different CPUs out there in Android hardware. If you need to bootstrap the native code so that it is started from java it is probably not a very big problem for you.

I found a few different tutorials when googling for "Android NDK". This one is a very minimalistic Hello World. Obviously you want something much more than a library that returns a string to java but it is a good first start and you will probably have to do all of the things described. Do a search using NDK and Android as keywords and you get a good selection. I see no reason to list them here as such lists tends to be outdated and broken within a year or so.

I guess the official Android Developer site from Google will stay put and be updated on new releases of the platform, it has a link to the current NDK.

请你别敷衍 2024-08-29 10:27:54

使用 Gingerbread (Android 2.3),您似乎可以用 C++ 构建整个应用程序。

比照:
http://phandroid. com/2011/01/11/android-developers-blog-awesome-ndk-leads-to-awesome-apps/


最新版本的 NDK r5 进行了许多重大改进,以配合 Gingerbread 的发布。最重要的是能够完全用 C++ 为 Android 2.3 编写本机应用程序。这意味着即使是没有 Java 知识的程序员和开发人员也不必实现一行代码......”

不能保证该博主的真实性,但是,从我所读到的内容来看,您似乎可以做到这

With Gingerbread (Android 2.3) it looks like you can build your entire app in C++.

cf:
http://phandroid.com/2011/01/11/android-developers-blog-awesome-ndk-leads-to-awesome-apps/

"
With the latest version of the NDK, r5, many big improvements have been made to coincide with the release of Gingerbread. The most major is the ability to code a native application for Android 2.3 entirely in C++. This means even programmers and developers with no Java knowledge won’t have to implement a single line of that code..."

Can't vouch for the veracity of this blogger, however, from what I have read, it appears you can do this

好多鱼好多余 2024-08-29 10:27:54

没有 100% 的本机解决方案,但我认为您正在寻找的是 Android NDK(本机开发工具包)

来自其网站“请注意,NDK 无法让您开发纯本机应用程序。Android 的主要运行时仍然是 Dalvik 虚拟机。”

我相信它可以让你从 Android 应用程序调用你自己的本机代码,

我个人从未在我的游戏中使用过它,但我确信它会在很多事情上有所帮助(比如能够管理我自己的内存而不需要使用它)。 “滞后”对垃圾收集器的影响)

There is no 100% native solution but what I think you are looking for is the Android NDK (Native Development Kit)

From their site "Please note that the NDK does not enable you to develop native-only applications. Android's primary runtime remains the Dalvik virtual machine."

I believe it lets you make calls to your own native code from an Android application

I have personally never used it for my games, but I am sure it would help on a lot of things (like being able to manage my own memory and not have "lag" do to the garbage collector)

魔法唧唧 2024-08-29 10:27:54

此线程中的对话可以帮助您。
http://groups.google.com/group/android-ndk/ browser_thread/thread/50362904ae0574cf

本质是,
制作纯原生应用程序是可能的,Android Market 也不限制您。
但由于对本机开发的支持有限,很有可能会使用一些在未来版本中可能会中断的非标准功能。

conversations in this thread can help you.
http://groups.google.com/group/android-ndk/browse_thread/thread/50362904ae0574cf

essence is,
It is possible to make Native only apps and Android Market doesn't restrict you either.
But with limited support for native development, there is high chance of using some of the non standard functionality which might break in future releases.

软的没边 2024-08-29 10:27:54

http://developer.android.com/guide/basics/what- is-android.html

“Android SDK 提供了使用 Java 编程语言在 Android 平台上开发应用程序所需的工具和 API。”

http://arstechnica.com/open-source/news/2009/06/android-goes-beyond-java-gains-native-cc-dev-kit.ars

一般来说,你不需要。通过 JNI 对 C++ 支持有一些有限,但它主要是为了补充 Java 代码,而不是取代它。 C++ 没有框架/API 支持 (AFAIK),因此这样做并不是真正的选择。

http://developer.android.com/guide/basics/what-is-android.html

"The Android SDK provides the tools and APIs necessary to begin developing applications on the Android platform using the Java programming language."

http://arstechnica.com/open-source/news/2009/06/android-goes-beyond-java-gains-native-cc-dev-kit.ars

In general, you don't. There is some limited C++ support through JNI, but it is mostly intended to supplement Java code, not replace it. There's no framework/API support (AFAIK) for C++, so doing this isn't really an option.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文