1

I'm building an android app (still empty) which is dependent from another android library project that contains al base classes and utils that I've developed during years.

I notice that add that dependency to my new app and try to run it, android studio generate a dev apk of a size of about 22 MB.

To generate an apk as small as possible I've enabled code minification (minifyEnabled in the build.gradle file). Building the apk with minifyEnable set to true generates a lot of warnings which prevent the APK to be generated succesfully so I've configured the proguard-rules.pro file as follows:

# for retrolambda
-dontwarn java.lang.invoke.*
# for glide
-dontwarn jp.co.cyberagent.android.gpuimage.*

-dontwarn org.codehaus.mojo.**
-dontwarn java.nio.file.**
-dontwarn javax.xml.stream.**

Those warnings relative to packages that I specified in the proguard-rules.pro are now disappeared but the APK building still give me this error:

Warning: library class android.databinding.DataBindingUtil depends on program class android.databinding.DataBindingComponent

How can I solve this? How can I reduce the size of the APK?

Thanks in advance :)

EDIT I've tried both this and this. I've added

-dontwarn android.databinding.**
-keep class android.databinding.** { *; }

to the proguard-rules.pro of my library class (not the app). Now the app gives errors about missing classes in the library, as an example:

Error:(8, 42) error: package it.bmsoftware.android.app.activity does not exist
Error:(33, 35) error: cannot find symbol class BaseActivity

How can I solve?

Community
  • 1
  • 1
Androidian
  • 1,035
  • 1
  • 16
  • 40
  • Check this post http://stackoverflow.com/questions/34069604/cannot-run-instrumentation-tests-after-i-introduced-databinding – Devendra Singh Feb 02 '17 at 12:00
  • 1
    Possible duplicate of [Conflict between Android data binding and Guava causes ProGuard error](http://stackoverflow.com/questions/35472130/conflict-between-android-data-binding-and-guava-causes-proguard-error) – Devendra Singh Feb 02 '17 at 12:00

0 Answers0