java 安卓是用C++还是Java?

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

C++ or Java for android?

javac++android

提问by BigPete

I am thinking about picking up android development in my free time. I see that development is possible in Java and C++ but the latter is limited.

我正在考虑在空闲时间进行 android 开发。我看到在 Java 和 C++ 中开发是可能的,但后者是有限的。

I am much more comfortable with C++.

我对 C++ 感觉更舒服。

So my question is what limitations exist with C++ on Android? Will I be able to develop full apps with it, or will I eventually have to learn Java?

所以我的问题是 C++ 在 Android 上存在哪些限制?我能用它开发完整的应用程序,还是我最终必须学习 Java?

回答by Erik

Pick the right tool for the job. The right tool for android is java, and occasionally c++ if it's really needed. Android runs on several different CPUs, and you'd be required to deal with fun stuff like compiling for platforms that you can't really test on - at least if you want to make apps for anyone but yourself.

为工作选择合适的工具。android 的正确工具是 java,如果真的需要,偶尔也可以使用 c++。Android 在几个不同的 CPU 上运行,你需要处理有趣的事情,比如为你无法真正测试的平台编译 - 至少如果你想为自己以外的任何人制作应用程序。

回答by Dair

It's all dependent on what you want to do, but the general rule of thumb:

这完全取决于您想要做什么,但一般的经验法则是:

C++ is for speed (for example games).

C++ 是为了速度(例如游戏)。

Java is for UI and general Android programming.

Java 用于 UI 和一般的 Android 编程。

回答by Nicklas A.

You cannot code an entire Android application using only C++, the android SDK is written in Java and that is what you will have to use.

您不能仅使用 C++ 编写整个 Android 应用程序,Android SDK 是用 Java 编写的,而这正是您必须使用的。

This said you can still use C++ for heavy stuff.

这表示您仍然可以将 C++ 用于繁重的工作。