在Android上属错误运行本机库:仅与位置无关的可执行文件(PIE)的支持机库、可执行文件、错误、位置

由网友(能滚多远就滚多远)分享简介:当我在Android上大号运行本地code(Nexus的5),我得到的错误。When I run native code on Android L (Nexus 5), I get the error.错误:只与位置无关的可执行文件(PIE)的支持error: only position independent e...

当我在Android上大号运行本地code(Nexus的5),我得到的错误。

When I run native code on Android L (Nexus 5), I get the error.

错误:只与位置无关的可执行文件(PIE)的支持

error: only position independent executables (PIE) are supported.

同样的code是正确的我的三星Galaxy S3(安卓4.3)执行。

The same code is executed correctly on my Samsung Galaxy S3 (Android 4.3).

下面是我的Application.mk

Here is my Application.mk

APP_PROJECT_PATH := $(call my-dir)/..
APP_ABI := armeabi
NDK_TOOLCHAIN_VERSION := 4.7
APP_PLATFORM := android-9
APP_GNUSTL_FORCE_CPP_FEATURES := exceptions rtti

然而,当我把 APP_PLATFORM:=机器人-9 APP_PLATFORM:=机器人-16 (当我读到此处,PIE支持出现在果冻去过(API级别16 )),同一个可执行文件正常工作在Android升。

However when I replace APP_PLATFORM := android-9 with APP_PLATFORM := android-16 (As I read here, PIE support appeared in Jelly Been (API level 16)), the same executable file works fine on Android L.

有没有办法使用 APP_PLATFORM编译本土code:=机器人-9 和Android上大号运行

Is there a way to compile native code using APP_PLATFORM := android-9 and run it on Android L?

推荐答案

我建了两个可执行文件:一个 APP_PLATFORM:=机器人-9 和其他与 APP_PLATFORM:=机器人-16 。要运行本机code在Java中,我需要这样的:

I built two executable files: one with APP_PLATFORM := android-9 and the other with APP_PLATFORM := android-16. To run the native code in Java I need this:

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
    // Run the file which was created using APP_PLATFORM := android-16
} else {
    // Run the file which was created using APP_PLATFORM := android-9
}
阅读全文

相关推荐

最新文章