Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

libsupportjni.so files added in the project

As my application is approaching completion, I was analyzing my apk using Android Studio. I saw a sudden increase in apk size:

APK Analyzer. lib folder 43.4%, res folder 32.2%, classes.dex 20.4%

The lib folder which is occupying 10mb space has only these files:

libsupportjni.so for various CPU architectures

I am sure that I don't have any native dependencies, but I am not sure how these files came here. Can anyone help me, I want to remove these files from my application.

Edit 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'

}
like image 368
Saurabh Mishra Avatar asked Dec 19 '18 12:12

Saurabh Mishra


1 Answers

Uncheck Enable advanced profiling option from

Run -> Edit Configurations -> Profiling -> Enable advanced profiling.

enter image description here

If you simply want to exclude the .so files, can try below inside your android {} of 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'
    }
    ...
}

Adding the the previous answer, you can try 'Build > Clean Project' and then 'Build > Rebuild' after disabling 'Advanced Profiler'. It also reduced apk size.

like image 109
shizhen Avatar answered Nov 13 '22 06:11

shizhen