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

Kum*_*rav 9 android apk android-studio

我的android apk大约22MB,即使我没有使用任何重物.在分析了apk文件后,我找到了一个目录"lib",其中包含一个文件名"libclasifier_jni.so",用于不同的架构,我不知道它来自哪里.下面是截图在此输入图像描述

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

下面是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'
Run Code Online (Sandbox Code Playgroud)

Khe*_*raj 5

\n

Android 的 apk 中的 libclasifier_jni.so 是什么?

\n
\n\n

您已使用包含这些 SO 文件的 Firebase Vision 图像库。

\n\n
compile \'com.google.firebase:firebase-ml-vision-image-label-model:15.0.0\'\n
Run Code Online (Sandbox Code Playgroud)\n\n
\n

我的 Android apk 大约 22MB

\n
\n\n

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

\n\n

什么是解决方案?

\n\n

1. 构建多个APK

\n\n
\n

尽管您应该尽可能构建一个 APK 来支持所有目标设备,但这可能会导致 APK 非常大,因为需要支持多种屏幕密度或应用程序二进制接口 (ABI)。减小 APK 大小的一种方法是创建多个 APK,其中包含特定屏幕密度或 ABI 的文件。

\n
\n\n

Play商店支持拆分apk,您可以为多个cpu ABI制作多个apk 。您的应用程序中有4 个 SO 文件。每个大小为 3-4MB。因此,如果您使用拆分 APK,则每个 APK 中将减少不必要的 12MB。

\n\n

2. 仅包括armeabi-v7aarm64-v8a

\n\n

让我告诉您有关 ABI 百分比统计的有用信息。如果您并不真正关心所有 ABI,那么您可以包含两个 ABI ndk。早些时候我在此处发布了详细的统计数据答案,这将帮助您更好地了解 ABI 百分比。

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

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

\n\n

这样您就可以在 APK 中仅包含这两个 ABI。

\n\n
buildTypes {\n    release {\n        ndk {\n            abiFilters "arm64-v8a", "armeabi-v7a"\n        }\n    }\n
Run Code Online (Sandbox Code Playgroud)\n\n

图像

\n\n

本博客将帮助您为多个 APK 和 ABI 过滤器配置 gradle,并更好地了解 ABI 管理。另外我必须说Google 的 Android 页面有您需要的完美信息。

\n


Muh*_*aan 0

它是编译并附加到您的 apk 中的本机库。检查您的 cmake 脚本或 ndk Android.mk 文件。如果您不确定它来自哪里,那么您也可以将其从不同架构的 apk 中排除。在你的 gradle 里面写下这些行

android{
 packagingOptions {

        exclude 'lib/arm64-v8a/libclasifier_jni.so'
        exclude 'lib/armeabi/libclasifier_jni.so'
        exclude 'lib/armeabi-v7a/libclasifier_jni.so'
        exclude 'lib/mips/libclasifier_jni.so'
        exclude 'lib/mips64/libclasifier_jni.so'
        exclude 'lib/x86/libclasifier_jni.so'
        exclude 'lib/x86_64/libclasifier_jni.so'

    }
}
Run Code Online (Sandbox Code Playgroud)