java Android NDK:应用程序针对已弃用的 ABI:更新 NDK 后出现 armeabi 错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/47303004/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 09:34:32  来源:igfitidea点击:

Android NDK: Application targets deprecated ABI(s): armeabi error after update NDK

javaandroidandroid-ndk

提问by Vadym

Yesterday, after updating NDK I'm having these errors:

昨天,更新 NDK 后,我遇到了以下错误:

Error:(81) Android NDK: Application targets deprecated ABI(s): armeabi
Error:(82) Android NDK: Support for these ABIs will be removed in a 
future NDK release.    

This links directed me to setup-app.mkfile on lines

此链接指示我setup-app.mk按行提交文件

_deprecated_abis := $(filter $(NDK_DEPRECATED_ABIS),$(NDK_APP_ABI))
ifneq ($(_deprecated_abis),)
  $(call __ndk_warning,Application targets deprecated ABI(s): 
  $(_deprecated_abis))
  $(call __ndk_warning,Support for these ABIs will be removed in a 
  future NDK release.)
endif

I have no idea, how to solve this problem. Any advice?

我不知道如何解决这个问题。有什么建议吗?

回答by drruggeri

I had the same problem and was just avoiding cleaning or rebuilding the whole project until I got the latest NDK update and the problem re-emerged.

我遇到了同样的问题,只是避免清理或重建整个项目,直到我获得最新的 NDK 更新并且问题再次出现。

This happens because even after removing the targets, there are still files present in app/.externalNativeBuildthat refers to them.

发生这种情况是因为即使在删除目标之后,仍然存在app/.externalNativeBuild引用它们的文件。

To fix this I removed the Application.mk (which I was using to set the targets) and added this lines to app/build.gradle

为了解决这个问题,我删除了 Application.mk(我用来设置目标)并将这行添加到 app/build.gradle

android {
    defaultConfig {

        // ...

        ndk {
            abiFilters 'armeabi-v7a', 'arm64-v8a' // 'x86', 'x86_64' may be added
        }
   }

   // ...

    task ndkClean(type: Delete) {
        // remove unused archs from build cache
        delete fileTree('.externalNativeBuild') {
            exclude defaultConfig.ndk.abiFilters.collect { '**/' + it }
        }
    }
    tasks.findByPath(':clean').dependsOn ndkClean
}

回答by nguyen nam

In Application.mk file, you should set APP_ABI:= armeabi armeabi-v7a x86 mips then sync project. It would solve your problem.

在 Application.mk 文件中,您应该设置 APP_ABI:= armeabi armeabi-v7a x86 mips 然后同步项目。它会解决你的问题。

回答by Dan Albert

Remove armeabi from your APP_ABI list.

从您的 APP_ABI 列表中删除 armeabi。

As you can see from the source though, it should be a warning, not an error. How are you invoking ndk-build?

但是,正如您从源代码中看到的那样,它应该是警告,而不是错误。你如何调用ndk-build?

回答by Irshad P I

If someone still has this issue, here are some things to try in order.

如果有人仍然遇到此问题,请按顺序尝试以下操作。

  • Delete build folder, Then Build > Clean Project, Build > Rebuild Project
  • If above doesn't work, add

    APP_ABI:= armeabi-v7a arm64-v8a

    in Application.mk file and link it from the app level gradle (Just like Android.mk is linked to) and try build again

  • 删除 build 文件夹,然后Build > Clean Project,Build > Rebuild Project
  • 如果以上不起作用,请添加

    APP_ABI:= armeabi-v7a arm64-v8a

    在 Application.mk 文件中并从应用程序级别的 gradle 链接它(就像链接到 Android.mk 一样)并再次尝试构建