Android NDK:无法在64位设备上加载arm64-v8a

时间:2018-05-30 08:12:34

标签: android android-ndk ndk-build

当我尝试在64位设备上运行时,我的应用程序在32位Android设备上运行完美 它给了我构建时间的错误。

错误:

Build command failed.
Error while executing process D:\Software\sdk\NDK\android-ndk-r17\ndk-build.cmd with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=E:\Projects\TestProjects\VirtualApp-master\VirtualApp\lib\src\main\jni\Android.mk NDK_APPLICATION_MK=E:\Projects\TestProjects\VirtualApp-master\VirtualApp\lib\src\main\jni\Application.mk APP_ABI=arm64-v8a NDK_ALL_ABIS=arm64-v8a NDK_DEBUG=1 APP_PLATFORM=android-21 NDK_OUT=E:/Projects/TestProjects/VirtualApp-master/VirtualApp/lib/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT=E:\Projects\TestProjects\VirtualApp-master\VirtualApp\lib\build\intermediates\ndkBuild\debug\lib E:/Projects/TestProjects/VirtualApp-master/VirtualApp/lib/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/libva++.so}
Android NDK: WARNING: APP_STL gnustl_static is deprecated and will be removed in the next release. Please switch to either c++_static or c++_shared. See https://developer.android.com/ndk/guides/cpp-support.html for more information.    
Android NDK: WARNING: Ignoring unknown import directory: :E:/Projects/TestProjects/VirtualApp-master/VirtualApp/lib/src/main/jni    
Android NDK: WARNING:E:/Projects/TestProjects/VirtualApp-master/VirtualApp/lib/src/main/jni/fb/Android.mk:fb: LOCAL_LDLIBS is always ignored for static libraries    
[arm64-v8a] Compile++      : va++ <= IOUniformer.cpp
E:/Projects/TestProjects/VirtualApp-master/VirtualApp/lib/src/main/jni/Foundation/IOUniformer.cpp:130:23: error: use of undeclared identifier '__NR_chmod'
    int ret = syscall(__NR_chmod, redirect_path, mode);
                      ^
E:/Projects/TestProjects/VirtualApp-master/VirtualApp/lib/src/main/jni/Foundation/IOUniformer.cpp:140:23: error: use of undeclared identifier '__NR_fstatat64'
    int ret = syscall(__NR_fstatat64, dirfd, redirect_path, buf, flags);
                      ^
E:/Projects/TestProjects/VirtualApp-master/VirtualApp/lib/src/main/jni/Foundation/IOUniformer.cpp:149:23: error: use of undeclared identifier '__NR_fstatat64'
    int ret = syscall(__NR_fstatat64, dirfd, redirect_path, buf, flags);
                      ^
E:/Projects/TestProjects/VirtualApp-master/VirtualApp/lib/src/main/jni/Foundation/IOUniformer.cpp:159:23: error: use of undeclared identifier '__NR_fstat64'
    int ret = syscall(__NR_fstat64, redirect_path, buf);
                      ^

.... .... ...     致命错误:发出的错误太多,现在停止[-ferror-limit =]     产生了20个错误。     make:*** [E:/ Projects / TestProjects / VirtualApp-master / VirtualApp / lib / build / intermediates / ndkBuild / debug / obj / local / arm64-v8a / objs / va ++ / Foundation / IOUniformer.o]错误1 < / p>

我使用以下步骤在64位设备上构建应用程序。

  1. 在abiFilters中添加“arm64-v8a”
  2. 在Application.mk中更新APP_ABI
  3. 但 的 Android.mk

    LOCAL_PATH := $(call my-dir)
    MAIN_LOCAL_PATH := $(call my-dir)
    include $(CLEAR_VARS)
    LOCAL_MODULE := va++
    
    
    LOCAL_CFLAGS := -Wno-error=format-security -fpermissive -DLOG_TAG=\"VA++\"
    LOCAL_CFLAGS += -fno-rtti -fno-exceptions
    
    LOCAL_C_INCLUDES += $(MAIN_LOCAL_PATH)
    LOCAL_C_INCLUDES += $(MAIN_LOCAL_PATH)/Foundation
    LOCAL_C_INCLUDES += $(MAIN_LOCAL_PATH)/Jni
    
    
    
    LOCAL_SRC_FILES := Jni/VAJni.cpp \
                       Foundation/IOUniformer.cpp \
                       Foundation/VMPatch.cpp \
                       Foundation/SymbolFinder.cpp \
                       Foundation/Path.cpp \
                       Foundation/SandboxFs.cpp \
                       Substrate/hde64.c \
                       Substrate/SubstrateDebug.cpp \
                       Substrate/SubstrateHook.cpp \
                       Substrate/SubstratePosixMemory.cpp \
    
    LOCAL_LDLIBS := -llog -latomic
    LOCAL_STATIC_LIBRARIES := fb
    
    include $(BUILD_SHARED_LIBRARY)
    include $(MAIN_LOCAL_PATH)/fb/Android.mk
    
    LOCAL_SHORT_COMMANDS := true
    

    Application.mk

    APP_ABI :=  arm64-v8a
    APP_PLATFORM := android-24
    APP_STL := gnustl_static
    APP_OPTIM := release
    VA_ROOT          := $(call my-dir)
    NDK_MODULE_PATH  := $(NDK_MODULE_PATH):$(VA_ROOT)
    

    摇篮

    apply plugin: 'com.android.library'
    
    android {
        compileSdkVersion 27
        buildToolsVersion '27.0.3'
    
        defaultConfig {
            minSdkVersion 15
            targetSdkVersion 27
            versionCode 1
            versionName "1.0"
    
    
    
            externalNativeBuild {
                ndkBuild {
                        abiFilters "armeabi-v7a", "x86","arm64-v8a"
    
                }
    
            }
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
        externalNativeBuild {
            ndkBuild {
                path file("src/main/jni/Android.mk")
            }
        }
        lintOptions {
            //IJobService need NewApi
            warning 'NewApi','OnClick'
        }
    }
    
    
    dependencies {
        compile fileTree(include: ['*.jar'], dir: 'libs')
    }
    

0 个答案:

没有答案