3

I need to exclude certain assets files (a few MP3's) from final the APK. That is, they are not included in the APK compiled. How I can do this using eclipse?

Thanks in advance.

Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141
Jonathan Toledo
  • 359
  • 4
  • 19

3 Answers3

4

You need to remove these mp3's from your assets folder. If you want to keep them with the project but not in the APK, just create separate folder (i.e. PROJECT and move your files there). This folder will be omitted by building scripts but you still can have these files in one place and can have them i.e. versioned etc.

Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141
1

You should use Proguard for this.

It is designed specifically to package different resources when building an APK. It is already enabled in a standard Eclipse Android project, you will just need to uncomment a line in your project.properties file, and also make modifications to the Proguard rules.

http://developer.android.com/tools/help/proguard.html

Booger
  • 18,579
  • 7
  • 55
  • 72
0

Try with next:

    ...
    packagingOptions {
        exclude 'META-INF/LICENSE.txt'
    }
}

android.applicationVariants.all { variant ->
    //if (variant.name.contains('Release')) { // exclude source and sourcemap from release builds
    def rmmp3 = task("delete${variant.name}.rmmp3", type: Delete) {
        delete "${buildDir}/intermediates/assets/${variant.dirName}/*.mp3"
    }
    variant.mergeAssets.finalizedBy rmmp3
    //}
}

Ref: https://stackoverflow.com/a/42207317/717267

Community
  • 1
  • 1
Eduardo Cuomo
  • 17,828
  • 6
  • 117
  • 94