Android NDK模块未编译(不再支持MIPS和MIPS64)

时间:2018-05-17 08:53:09

标签: android android-ndk

当我尝试在更新到最新的NDK(android-ndk-r17-darwin)后尝试使用本机C ++代码编译Android模块时,我在Mac 上获得此输出

CMake Error at /Users/user1/Library/Android/sdk/ndk- 
bundle/build/cmake/android.toolchain.cmake:312 (message):
Invalid Android ABI: armeabi.  (armeabi is no longer supported.  Use
armeabi-v7a.)
Call Stack (most recent call first):
/Users/user1/Library/Android/sdk/cmake/3.6.4111459/share/cmake- 
3.6/Modules/CMakeDetermineSystem.cmake:98 (include) CMakeLists.txt
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
CMake Error at /Users/user1/Library/Android/sdk/ndk- 
bundle/build/cmake/android.toolchain.cmake:312 (message):
Invalid Android ABI: mips.  (MIPS and MIPS64 are no longer 
supported.)
Call Stack (most recent call first):
/Users/user1/Library/Android/sdk/cmake/3.6.4111459/share/cmake- 
3.6/Modules/CMakeDetermineSystem.cmake:98 (include)
CMakeLists.txt
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
CMake Error at /Users/user1/Library/Android/sdk/ndk- 
bundle/build/cmake/android.toolchain.cmake:312 (message):
Invalid Android ABI: mips64.  (MIPS and MIPS64 are no longer 
supported.)
Call Stack (most recent call first):
/Users/user1/Library/Android/sdk/cmake/3.6.4111459/share/cmake- 
3.6/Modules/CMakeDetermineSystem.cmake:98 (include)
CMakeLists.txt
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!

我已经尝试this solution但是没有用。唯一的解决方案是返回上一个NDK。

项目与之前版本的NDK(android-ndk-r16b-darwin)一起正常工作

任何人都面临同样的问题?

1 个答案:

答案 0 :(得分:0)

以下是解决方案: https://developer.android.com/studio/build/configure-apk-splits

  

已知问题:如果您使用的是Gradle 3.0.1或更低版本的Android插件   使用NDK r17或更高版本时,您可能会收到以下错误:错误:ABI   平台不支持[mips64,armeabi,mips]。那是因为   旧版本的插件仍包含不受支持的ABI   在构建per-ABI APK时默认。要解决此问题,请执行此操作   更新到最新版本的插件,或者,在您的应用程序中   build.gradle文件,重置插件的默认ABI列表并包含   只有你想要的受支持的ABI,如下所示:

或者将其添加到 build.gradle

$allIds = [];
foreach ($id_prs as $ids) {
   list($id_pr, $id_cart) = explode('-', $ids);
    foreach ($id_cart as $id) {
        $allIds[] = $id;
    }
}
$cart = Cart::whereIn('id',$allIds)->update(['columns'=>'value']);

或者只是更新以使用最新的Gradle插件。