Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
590 views
in Technique[技术] by (71.8m points)

android - My NDK project fails to compile with a CPU architecture-related issue

Can someone explain why I get this errors please?

Build command failed.


Error while executing process C:UsersKevinDesktopAndroidSdk
dk-bundle
dk-build.cmd with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=C:UsersKevinDesktopMygameproj.android-studioappjniAndroid.mk NDK_APPLICATION_MK=C:UsersKevinDesktopMygameproj.android-studioappjniApplication.mk APP_ABI=armeabi NDK_ALL_ABIS=armeabi NDK_DEBUG=1 APP_PLATFORM=android-14 NDK_OUT=C:/Users/Kevin/Desktop/Mygame/proj.android-studio/app/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT=C:UsersKevinDesktopMygameproj.android-studioappuildintermediates
dkBuilddebuglib NDK_TOOLCHAIN_VERSION=4.9 APP_PLATFORM=android-10 NDK_MODULE_PATH=C:/Users/Kevin/Desktop/Mygame/cocos2d;C:/Users/Kevin/Desktop/Mygame/cocos2d/cocos;C:/Users/Kevin/Desktop/Mygame/cocos2d/external -j4 NDK_DEBUG=1 APP_SHORT_COMMANDS=false LOCAL_SHORT_COMMANDS=false -B -n}


Android NDK: INTERNAL ERROR: The armeabi ABI should have exactly one `architecture definitions. Found: ''`    
process_begin: CreateProcess(NULL, "", ...) failed. 
*** Android NDK: Aborting...    .  Stop.
Build command failed.


Error while executing process C:UsersKevinDesktopAndroidSdk
dk-bundle
dk-build.cmd with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=C:UsersKevinDesktopMygameproj.android-studioappjniAndroid.mk NDK_APPLICATION_MK=C:UsersKevinDesktopMygameproj.android-studioappjniApplication.mk APP_ABI=armeabi NDK_ALL_ABIS=armeabi NDK_DEBUG=0 APP_PLATFORM=android-14 NDK_OUT=C:/Users/Kevin/Desktop/Mygame/proj.android-studio/app/build/intermediates/ndkBuild/release/obj NDK_LIBS_OUT=C:UsersKevinDesktopMygameproj.android-studioappuildintermediates
dkBuild
eleaselib NDK_TOOLCHAIN_VERSION=4.9 APP_PLATFORM=android-10 NDK_MODULE_PATH=C:/Users/Kevin/Desktop/Mygame/cocos2d;C:/Users/Kevin/Desktop/Mygame/cocos2d/cocos;C:/Users/Kevin/Desktop/Mygame/cocos2d/external -j4 NDK_DEBUG=0 APP_SHORT_COMMANDS=false LOCAL_SHORT_COMMANDS=false -B -n}

Android NDK: INTERNAL ERROR: The armeabi ABI should have exactly one architecture definitions. Found: ''    
process_begin: CreateProcess(NULL, "", ...) failed.
*** Android NDK: Aborting...    .  Stop.

I leave here a screenshot of my android studio if can be helpful enter image description here

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Most likely, you have NDK r17 installed, which does not support armeabi anymore. Your gradle plugin is not aware of this recent change. You must upgrade: in build.gradle, you should have

buildscript { dependencies {
    classpath 'com.android.tools.build:gradle:3.1.2'
} }

and in gradle/wrapper/gradle-wrapper.properties

distributionUrl=https://services.gradle.org/distributions/gradle-4.4-all.zip

But even after upgrade, your build.gradle most likely lacks the abiFilters statement, and therefore your project build is slower and APK larger than necessary.

You probably only need on ABI in your APK,

android { defaultConfig { ndk {
    abiFilters 'armeabi-v7a'
} } }

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...