javaandroidandroid-studioretrofitjavax

Stop generating javax.annotation source files in Android APK


I am using retrofit library and while generating the APK the apk contains java source files under javax.annotations in the APK.

I tried using proguard and minifyEnabled, Still the java source files persist in the extracted APK.

Is there any way to disable generating the java source files?


Solution

  • There is an issue with react-native dependency.

    If we want to avoid those files getting in to APK, then we can exclude those files. In my case I did

    packagingOptions {
            exclude 'javax/annotation/*'
            exclude 'javax/annotation/meta/*'
            exclude 'javax/annotation/concurrent/*'
        }