如何减小库文件夹的大小?

How can I reduce the size of a library folder?

我的应用是当我使用按钮时只打开 pdf 书,pdf 文件的大小只有 1MB! 这是我的依赖项:

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    implementation 'com.github.barteksc:android-pdf-viewer:2.8.2'
    implementation 'org.apache.commons:commons-io:1.3.2'
    implementation 'com.android.support:design:27.1.1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}

lib文件夹大小为17MB

请看图

https://github.com/barteksc/AndroidPdfViewer

Why resulting apk is so big? Android PdfViewer depends on PdfiumAndroid, which is set of native libraries (almost 16 MB) for many architectures. Apk must contain all this libraries to run on every device available on market. Fortunately, Google Play allows us to upload multiple apks, e.g. one per every architecture. There is good article on automatically splitting your application into multiple apks, available here. Most important section is Improving multiple APKs creation and versionCode handling with APK Splits, but whole article is worth reading. You only need to do this in your application, no need for forking PdfiumAndroid or so.

解决方案是拆分您的 APK。在这里阅读更多:https://developer.android.com/studio/build/configure-apk-splits.html#configure-abi-split