gpt4 book ai didi

android - android apk 中的 libclasifier_jni.so 是什么?

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:42:48 25 4
gpt4 key购买 nike

我的 android apk 大约是 22MB,即使我没有使用过任何沉重的东西。分析 apk 文件后,我发现一个目录“lib”,其中包含针对不同体系结构的文件名“libclasifier_jni.so”,我不确定它来自哪里。以下是相同 enter image description here 的屏幕截图

你能告诉我这里缺少什么吗?

下面是build.gradle

apply plugin: 'com.android.application'

android {
compileSdkVersion 27
defaultConfig {
applicationId "com.pixyfisocial"
minSdkVersion 15
targetSdkVersion 27
versionCode 24
versionName '5.0.0'
multiDexEnabled true
testApplicationId "com.pixyfisocial.screens.presenters"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
}
productFlavors {
}
}

configurations {
all {
exclude module: 'json'
exclude module: 'commons-logging'
}
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
testImplementation 'junit:junit:4.12'
testCompile 'org.powermock:powermock-api-mockito2:1.7.4'
// https://mvnrepository.com/artifact/org.powermock/powermock-module-junit4
testCompile 'org.powermock:powermock-module-junit4:1.7.4'
// https://mvnrepository.com/artifact/org.mockito/mockito-core
testCompile 'org.mockito:mockito-core:2.8.9'
implementation 'de.hdodenhof:circleimageview:2.2.0'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
compile 'com.android.support:appcompat-v7:27.1.1'
compile 'com.android.support:recyclerview-v7:27.1.1'
compile 'com.android.support:cardview-v7:27.1.1'
compile 'com.android.support:design:27.1.1'
implementation 'com.facebook.android:facebook-android-sdk:4.33.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.github.clans:fab:1.6.2'
compile 'com.theartofdev.edmodo:android-image-cropper:2.7.+'
implementation 'com.google.firebase:firebase-core:16.0.0'
implementation 'com.google.firebase:firebase-messaging:17.1.0'
compile 'com.facebook.android:account-kit-sdk:4.+'
compile 'com.android.support:support-v4:27.1.1'
compile 'com.google.code.gson:gson:2.8.2'
compile 'com.google.firebase:firebase-appindexing:15.0.1'
compile 'com.google.firebase:firebase-auth:16.0.1'
compile 'com.google.android.gms:play-services-auth:15.0.1'
compile 'com.google.firebase:firebase-invites:16.0.0'
compile 'com.android.support:customtabs:27.1.1'
compile 'com.google.firebase:firebase-ml-vision:16.0.0'
compile 'com.google.firebase:firebase-ml-vision-image-label-model:15.0.0'
compile 'com.github.greenfrvr:hashtag-view:1.3.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.1'
implementation project(':pixyfi-data')
implementation project(':pixyfi-services')
implementation project(':utility')
}
apply plugin: 'com.google.gms.google-services'

最佳答案

What is libclasifier_jni.so in android's apk?

您已经使用了包含这些 SO 文件的 Firebase 视觉图像库。

compile 'com.google.firebase:firebase-ml-vision-image-label-model:15.0.0'

My android apk is around 22MB

如果您在应用中使用 Fragment Vision 库,则不得通过任何 gradle 配置从 apk 中排除这些 ndk 文件。

什么是解决方案?

1. Build multiple APKs

Although you should build a single APK to support all your target devices whenever possible, that might result in a very large APK due to files needed to support multiple screen densities or Application Binary Interfaces (ABIs). One way to reduce the size of your APK is to create multiple APKs that contain files for specific screen densities or ABIs.

Play商店支持拆分apk,可以为multiple cpu ABI拆分多个apk。 .有4 SO files在你的应用程序中。每个大小为 3-4MB。因此,如果您使用拆分 APK,那么每个 APK 都会减少不必要的 12MB。

2. Include only armeabi-v7a and arm64-v8a

让我告诉您有关 ABI 百分比统计的有用信息。如果您真的不关心所有 ABI,那么您可以包含两个 ABI ndk。早些时候我发布了详细的静态信息 Answer Here ,这将帮助您更好地了解 ABI 百分比。

  • armeabi-v7a(必备 —— 时下最流行的架构)
  • arm64-v8a(需要 — armeabi-v7a的更新版本)
  • x86(可选,设备数量非常有限,例如 Asus Zenfone 2、Genymotion/Android 模拟器)
  • x86_64(可选,设备数量非常有限,例如 Asus Zenfone 2、Genymotion/Android 模拟器)

因此,如果您包括 armeabi-v7aarm64-v8a 架构,那么您可以覆盖 99% 的 Android 设备。

这就是您可以在 APK 中只包含这两个 ABI 的方法。

buildTypes {
release {
ndk {
abiFilters "arm64-v8a", "armeabi-v7a"
}
}

image

This blog将帮助您为多个 APK 和 ABI 过滤器配置 gradle,并更好地理解 ABI 管理。我还必须说 Google's Android page有您需要的完美信息。

关于android - android apk 中的 libclasifier_jni.so 是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52905029/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com