简体   繁体   English

Android NDK 构建以支持所有可用设备

[英]Android NDK build to support all available devices

I am using in my project both java files and native c++ code.我在我的项目中同时使用了 java 文件和本机 C++ 代码。 I would like to make the app available for all devices and hardware (API lvl >= 15).我想让该应用程序可用于所有设备和硬件(API lvl >= 15)。 I am also using OpenCV4Android both in java and my native c++ if that matters.如果重要的话,我也在 Java 和我的原生 C++ 中使用 OpenCV4Android。 I'm not quite sure if my current configuration is sufficient to support all available hardware:我不太确定我当前的配置是否足以支持所有可用的硬件:

Application.mk应用程序.mk

APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -fexceptions
APP_ABI := armeabi-v7a
APP_PLATFORM := android-9

Android.mk安卓.mk

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

OPENCV_CAMERA_MODULES:=on
OPENCV_INSTALL_MODULES:=on

include C:/OpenCV4Android/OpenCV-android-sdk/sdk/native/jni/OpenCV.mk

LOCAL_MODULE    := myNativeLib
LOCAL_SRC_FILES := myNativeLib.cpp
LOCAL_LDLIBS +=  -llog -ldl

include $(BUILD_SHARED_LIBRARY)

I have tested this configuration on a few devices and it seems to work but doesn't APP_ABI := armeabi-v7a narrow down the supported devices to only those with armeabi-v7a , or actually every device will be able to run it?我已经在一些设备上测试了这个配置,它似乎可以工作,但APP_ABI := armeabi-v7a没有将支持的设备缩小到只有armeabi-v7a设备,或者实际上每个设备都能够运行它? Maybe I should insert APP_ABI := all as mentioned here?也许我应该像这里提到的那样插入APP_ABI := allhttps://developer.android.com/ndk/guides/application_mk.htmlhttps://developer.android.com/ndk/guides/application_mk.html

It is very important to me to make the app responding and working for all devices possible.让应用程序响应并适用于所有设备对我来说非常重要。

To support all platforms you should use APP_ABI := all .要支持所有平台,您应该使用APP_ABI := all For API 15 use APP_PLATFORM := android-15 .对于 API 15 使用APP_PLATFORM := android-15 Pay attention that the more platforms you will support the larger your apk file will be, since it will create a binary for each supported platform in your APK.请注意,您将支持的平台越多,您的 apk 文件就会越大,因为它会为您的 APK 中每个支持的平台创建一个二进制文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM