centOS builds android cross-compilation environment

First check the number of bits of the android mobile phone motherboard:
adb shell getprop ro.product.cpu.abi
The result of your own mobile phone is: arm64-v8a

uses the virtual machine virtualBox, and you have to upload files, resume the host and the shared folder of the virtual machine
1
.Device Host shared path: E:\project, shared folder name project
2. mkdir /mnt/share //Create a new mount point (mountpoint)
        mount -t vboxsf project /mnt/share / / Mount the shared folder
       cd /mnt/share Enter the shared folder
       OK

3. Implement boot mount:
vi ~/.bashrc
add
        mount -t vboxsf sharing /mnt/share at the end to mount the shared folder

because NDK is used to compile The executable file is called in the application, and it has been no problem on 4.4 and previous versions. Recently, due to testing the operation on Android L, it was found that when running the executable file, the following error was reported:

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

The PIE security mechanism was introduced from 4.1, but the system version before android L did not check whether the executable file was compiled based on PIE. So no error will be reported. However, Android L has already turned on verification, and if the invoked executable file is not compiled based on PIE, it cannot run. The solution is very simple, just add the following flag to Android.mk.

LOCAL_CFLAGS += -pie -fPIE
LOCAL_LDFLAGS += -pie -fPIE

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326176898&siteId=291194637