如何减少 Android Studio 3.3 中本机库的构建变体? [英] How to reduce build variants of native library in Android Studio 3.3?

查看:35
本文介绍了如何减少 Android Studio 3.3 中本机库的构建变体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Android Studio 3.2.1 中,我的本机库有两个可见的构建变体;发布调试.在 3.3 中,我得到了这些和所有 ABI 的组合.我不想为所有 ABI 构建多个 APK.

In Android Studio 3.2.1 I had two build variants visible for my native library; Release and Debug. In 3.3 I get a combination of these and all ABIs. I don't want to build multiple APKs for all the ABIs.

原生库项目的相关部分:

The relevant parts of the native library project:

apply plugin: 'com.android.library'

android {
    defaultConfig {
        ndk {
            // Specifies the ABI configurations of your native
            // libraries Gradle should build and package with your APK.
            abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
        }
    }

    buildTypes {
        release {
        }
        debug {
        }
    }

    externalNativeBuild {
        ndkBuild {
            path 'jni/Android.mk'
        }
    }

    sourceSets {
        main {
            java.srcDir generatedSrcDir
        }
    }

    sourceSets {
        main {
            jni.srcDirs = []
        }
    }
}

构建警告

也许无关,但我在构建日志中观察到了这个警告(实际上是连续两次):

Maybe unrelated, but I observed this warning in the Build log (actually twice in a row):

警告:ABIs [arm64-v8a,armeabi-v7a,armeabi] 由'android.injected.build.abi' gradle 标志包含 'ARMEABI' 不此项目的目标.

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

我如何回到旧的行为方式?

推荐答案

显然这是一个有意的更改:请参阅 这个问题.

Apparently this is an intentional change: see this issue.

根据链接的票证,这只是装饰性的"(即UI更改);完整/胖 .apk 仍在构建中.

According to the linked ticket, this is only "cosmetic"(ie a UI change); a full/fat .apk is still built.

这篇关于如何减少 Android Studio 3.3 中本机库的构建变体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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