项目中添加了libsupportjni.so文件

Sau*_*hra 6 android android-ndk android-studio

当我的应用程序即将完成时,我正在使用Android Studio分析我的apk。我看到APK大小突然增加:

APK分析器。 lib文件夹43.4%,res文件夹32.2%,classes.dex 20.4%

lib占用10mb空间的文件夹仅包含以下文件:

libsupportjni.so用于各种CPU架构

我确定我没有任何本机依赖性,但是我不确定这些文件是怎么来的。谁能帮我,我想从我的应用程序中删除这些文件。

编辑1

dependencies {
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    implementation 'com.android.support:support-v4:28.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'de.hdodenhof:circleimageview:2.2.0'
    implementation 'com.intuit.sdp:sdp-android:1.0.5'
    implementation 'com.intuit.ssp:ssp-android:1.0.5'
    implementation 'com.google.android.gms:play-services-safetynet:15.0.1'
    implementation 'com.squareup.retrofit2:retrofit:2.4.0'
    implementation 'com.squareup.retrofit2:converter-scalars:2.4.0'
    implementation 'com.squareup.retrofit2:adapter-rxjava2:2.4.0'
    implementation 'com.squareup.retrofit2:converter-jackson:2.4.0'
    implementation 'io.reactivex.rxjava2:rxjava:2.2.2'
    implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
    implementation 'com.koushikdutta.ion:ion:2.2.1'
    //implementation 'com.facebook.shimmer:shimmer:0.3.0'
    //implementation 'com.facebook.android:facebook-login:[4,5)'
    implementation 'it.sephiroth.android.library.targettooltip:target-tooltip-library:+'
    implementation 'com.tbuonomo.andrui:viewpagerdotsindicator:2.1.2'
    implementation 'com.android.support:multidex:1.0.3'
    //Needed for custom web view implementation
    implementation 'com.android.support:customtabs:28.0.0'

}
Run Code Online (Sandbox Code Playgroud)

shi*_*hen 7

取消选中“ 启用高级分析”选项

运行 -> 编辑配置 -> 分析 -> 启用高级分析

在此处输入图片说明

如果你只是要排除的.so文件,可以试试下面的内部android {}app/build.gradle

android { 
    ...
    packagingOptions {
        exclude 'lib/x86/libsupportjni.so'
        exclude 'lib/x86_64/libsupportjni.so'
        exclude 'lib/armeabi-v7a/libsupportjni.so'
        exclude 'lib/arm64-v8a/libsupportjni.so'
    }
    ...
}
Run Code Online (Sandbox Code Playgroud)

添加上一个答案后,可以在禁用“高级探查器”后尝试“构建>清理项目”,然后尝试“构建>重建”。它还减少了apk大小。