简体   繁体   中英

Android how to exclude certain folder from apk file

I create android project and add compile dependencies that have other platforms tools/files/libs and I need to remove(exclude) this file from my .apk file. You can see the folder I want to remove on this screenshot: 在此处输入图片说明

  1. If it's a dependency that you included but no longer need, remove the dependency in gradle.
  2. If it's required by some other dependency, then you can't remove it or you'll break the functionality.
  3. If it's a transitive dependency and you're sure you don't need it, consider using the minify features of proguard .

android {
  buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'),
                'proguard-rules.pro'
    }
  }
  ...
}

Also, keep in mind that that if you go the proguard route, then you need to re-evaluate your dependencies and make special exceptions for any code that uses reflection.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM