Android的工作室:如何运行在x86单一测试 [英] Android Studio: How to run a single test on x86

查看:136
本文介绍了Android的工作室:如何运行在x86单一测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用两种不同的架构两种不同的口味,因为我有非常大的机库,我想小的二进制文件。

I am using two different flavors for two different architectures, because I have very large native libraries, and I want smaller binaries.

当我点击运行图标,Android的工作室总是构建并部署我们的产品的手臂的味道。如果我在x86模拟器运行这个它失败,因为它不具备的x86库。

When I click on the "Run" icon, Android Studio ALWAYS builds and deploys the "Arm" flavor of our product. If I run this on an x86 emulator it fails because it doesn't have the libraries for x86.

有人知道如何说服Android Studio中部署的正确版本为特定的模拟器?

Anybody know how to convince Android Studio to deploy the right version for a particular emulator?

推荐答案

尝试使用在你的的build.gradle 的的 abiFilter 属性。

Try using the abiFilter property in your build.gradle.

这篇文章 解释如何使用本机库在不同的架构:

This post explains how to use native libraries in different architectures:

在第二章的建立每个体系结构单个APK,而且做的很好它说:

使用香精打造每个结构单个APK真的很容易,使用 abiFilter 属性。

Use flavors to build one APK per architecture really easily, by using abiFilter property.

尝试添加这对您的 gradle.build 的:

android{
  ...
  productFlavors {
        x86 {
            ndk {
                abiFilter "x86"
            }
        }
        mips {
            ndk {
                abiFilter "mips"
            }
        }
        armv7 {
            ndk {
                abiFilter "armeabi-v7a"
            }
        }
        arm {
            ndk {
                abiFilter "armeabi"
            }
        }
        fat
    }
}

您可能只需要手臂&安培; 86

You might just need the arm & x86.

在此之后,使用同步的文件的gradle项目

After this, synchronize the project with the gradle file using

Tools > Android > Sync Project with Gradle Files

现在,你应该能够构建变种,应该生成的一个APK由建筑之间切换。

Now you should be able to switch between build variants and one APK by architecture should be generated.

选择在左下角构建变种。你应该能够在变化范围的下拉列表。

Select Build Variants in the lower left corner. You should be able to switch between the different architectures in the Build Variant dropdown.

希望这有助于。

这篇关于Android的工作室:如何运行在x86单一测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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