如何从Fresco(Facebook的Android库)中排除arm64-v8a目录?

3

enter image description here

正如您所看到的,Fresco有一个arm64-v8a目录,但我不想使用它。在build.gradle中我应该写什么?

compile('com.facebook.fresco:fresco:0.5.3') {
    exclude group: 'com.android.support'
    exclude group: 'com.nineoldandroids'
    exclude group: 'imagepipeline/jni/arm64-v8a'
}

只是好奇,为什么您想要排除大多数库需要运行的本地代码? - Phuong Nguyen
还有另一个库没有 arm64-v8a 目录,如果我不排除 Freco 的 arm64-v8a 目录,应用程序将在 arm64 平台上崩溃。 - user3932202
唯一一个排除这个目录的好理由是如果你不计划将你的应用程序发布到运行有这些硬件的设备上,例如三星S6。如果问题是与另一个库的冲突,请告诉我们该库的名称。 - tyronen
3个回答

5
在您的应用程序的 build.gradle 文件中编写以下代码:
android {
    ...
    defaultConfig {
        ...
        ndk {
            abiFilters "armeabi-v7a", "x86","armeabi"
        }

        packagingOptions {
            exclude "lib/arm64-v8a/mysofile.so"
        }
    }
}

将mysofile.so替换为您的.so文件。


打包选项排除了我的问题。谢谢! - Carsten

1
这可能有帮助:

这里是链接:Shipping Multiple APKs

If your application is not used by devices running Android 2.3 (Gingerbread), you will not need the armeabi flavor.

Android Studio / Gradle# Edit your build.gradle file as follows:

android {
  // rest of your app's logic
  splits {
    abi {
        enable true
        reset()
        include 'x86', 'x86_64', 'arm64-v8a', 'armeabi-v7a', 'armeabi'
        universalApk false
    }
  }
}

0

您需要在 android/app/build.gradle 文件的 android 部分下添加 packagingOptions 条目,如下所示,以从 apk lib 文件夹中排除特定文件或整个文件夹

 splits {
    abi {
        reset()
        enable enableSeparateBuildPerCPUArchitecture
        universalApk false  // If true, also generate a universal APK
        include "armeabi-v7a", "x86"
        packagingOptions({
            exclude 'lib/arm64-v8a/*' //instead of * you can specify perticualr so file name also
            exclude 'lib/x86_64/*'
        })
    }
}

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接