从NDK版本16更新到NDK版本17时出错 [英] Errors updating from NDK version 16 to NDK version 17

查看:233
本文介绍了从NDK版本16更新到NDK版本17时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是将JNI与NDK结合使用的Android项目.我正在使用Android Studio 3.0.1构建该项目.我最近将我的NDK从版本16更新到版本17,希望能够提供更多的编译器优化.更新后,出现以下错误:

This is for an Android project using JNI with the NDK. I'm building the project with Android Studio 3.0.1. I recently updated my NDK from version 16 to version 17 in the hopes of making more compiler optimizations available. After the update, I'm getting the following errors:

CMake错误位于C:/Users/John/AppData/Local/Android/Sdk/ndk-bundle/build/cmake/android.toolchain.cmake:312(消息): 无效的Android ABI:armeabi. (不再支持armeabi.使用 armeabi-v7a.) 呼叫堆栈(最近的呼叫优先): C:/Users/John/AppData/Local/Android/Sdk/cmake/3.6.4111459/share/cmake-3.6/Modules/CMakeDetermineSystem.cmake:98(包括) CMakeLists.txt CMake错误:EnableLanguage之后未设置CMAKE_C_COMPILER CMake错误:EnableLanguage之后未设置CMAKE_CXX_COMPILER -配置不完整,发生了错误!

CMake Error at C:/Users/John/AppData/Local/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): C:/Users/John/AppData/Local/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!

对于每个已弃用的ABI armeabi,mips和mips64,我都收到此错误.我知道应该从构建中删除这些ABI,但是找不到有关如何执行此操作的说明.我没有使用Application.mk,也没有在任何地方指定ABI.如何从Android Studio项目中删除这些未使用的ABI,或者更好的是,如何将我的项目设置为仅使用当前未弃用的ABI?谢谢.

I'm getting this error for each of the deprecated ABIs armeabi, mips, and mips64. I understand that I should remove these ABIs from the build, but I can't find instructions on how to do that. I'm not using an Application.mk and I don't see the ABIs being specified anywhere; how can I remove these unused ABIs from my Android Studio project, or better yet, how can I set my project to just use the current non-deprecated ABIs? Thank you.

推荐答案

以根(项目) build.gradle 脚本将gradle插件升级到3.1.2或更高版本就足够了.建议使用最新的插件,不仅要与最新的NDK兼容:

It should be enough to upgrade your gradle plugin to 3.1.2 or higher, in root (project) build.gradle script. Using the latest plugin is recommended not only to be compliant with latest NDK:

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

您还必须更改 gradle/wrapper/gradle-wrapper.properties :

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

如果您负担不起此类更改,则可以尝试跳过已弃用的ABI进行构建和打包:

If you cannot afford such change, you may try to skip the deprecated ABIs for build and packaging:

android {
  defaultConfig {
    ndk {
      abiFilters 'x86', 'armeabi-v7a', 'x86_64', 'arm64-v8a'
    }
  }

  packagingOptions {
    doNotStrip '*/mips/*.so'
    doNotStrip '*/mips64/*.so'
  }
}

这篇关于从NDK版本16更新到NDK版本17时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆