Android NDK:不推荐使用的应用程序目标ABI:更新NDK后的armeabi错误

Vad*_*kiy 9 java android android-ndk

昨天,在更新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.    
Run Code Online (Sandbox Code Playgroud)

这个链接指示我在线上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
Run Code Online (Sandbox Code Playgroud)

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

小智 15

我有同样的问题,只是避免清理或重建整个项目,直到我得到最新的NDK更新,问题重新出现.

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

为了解决这个问题,我删除了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
}
Run Code Online (Sandbox Code Playgroud)