简体   繁体   English

警告:由 'android.injected.build.abi' 设置的 ABIs [armeabi-v7a,armeabi] gradle 标志包含此项目未针对的 'ARMEABI'

[英]WARNING: ABIs [armeabi-v7a,armeabi] set by 'android.injected.build.abi' gradle flag contained 'ARMEABI' not targeted by this project

I had this issue last time after upgrade NDK version to latest version in Android Studio.我上次在 Android Studio 中将 NDK 版本升级到最新版本后遇到了这个问题。 I also found solution to fix this.我还找到了解决此问题的解决方案。 If anyone has this issue , I hope it is the best question and answer for you.如果有人有这个问题,我希望这是对你来说最好的问题和答案。 Please check my answer.请检查我的答案。

I found solution by reading on release note here for NDK revision 16.我通过阅读此处的 NDK 修订版 16 的发行说明找到了解决方案。

  1. If you config your project with Application.mk just add the following to your Application.mk file:如果您使用Application.mk配置您的项目,只需将以下内容添加到您的Application.mk文件中:

     APP_STL := c++_shared
  2. If you're using CMake via Gradle, add the following to your build.gradle:如果您通过 Gradle 使用CMake ,请将以下内容添加到您的 build.gradle:

     externalNativeBuild { cmake { cppFlags "" arguments "-DANDROID_STL=c++_shared" } }

To keep up to date with new release and note, please follow this NDK Revision History to apply with new changed.要及时了解新版本和注意事项,请遵循此NDK 修订历史以应用新的更改。

I hope it can fix your issue.我希望它可以解决您的问题。

According to Android documentation this is a known issue, and its due to the fact that the gradle plugin still includes unsupported ABIs by default.根据Android 文档,这是一个已知问题,这是因为 gradle 插件在默认情况下仍然包含不受支持的 ABI。 armbeabi was deprecated in NDKr16 and removed in r17 hence the warning. armbeabi 在 NDKr16 中已弃用,并在 r17 中删除,因此出现警告。 To fix, list your supported architectures under splits.abi :要修复,请在splits.abi下列出您支持的架构:

...
splits {
    abi {
        ...
        reset()
        include "x86", "armeabi-v7a", ...
    }
}

Got same issue and fixed through modifying the module build.gradle file by adding below setup:通过添加以下设置,通过修改模块 build.gradle 文件解决了同样的问题:

android {
    ...
    splits {
        abi {
            enable true
            reset()
            include 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a' //select ABIs to build APKs for
            universalApk true //generate an additional APK that contains all the ABIs
        }
    }

    project.ext.versionCodes = ['armeabi': 1, 'armeabi-v7a': 2, 'arm64-v8a': 3, 'mips': 5, 'mips64': 6, 'x86': 8, 'x86_64': 9]

    android.applicationVariants.all { variant ->
        variant.outputs.each { output ->
            output.versionCodeOverride =
                   project.ext.versionCodes.get(output.getFilter(com.android.build.OutputFile.ABI), 0) * 1000000 + android.defaultConfig.versionCode
        }
    }
}

For your reference, good luck.供您参考,祝您好运。

This doesn't resolve my problem, i resolved by adding this:这不能解决我的问题,我通过添加以下内容解决了:

        ndk {
            abiFilters "armeabi-v7a"
        }

to android.defaultConfig到 android.defaultConfig

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM