2

I have an app where I am using AncdroidX components. Jetifier is enabled

android.enableJetifier=true
android.useAndroidX=true

Now i am adding a third party library which uses android libraries instead of AndroidX (com.android.support).

Library dependencies

implementation "com.android.support:appcompat-v7:28.0.0"

App Dependenciews

implementation "androidx.appcompat:appcompat:1.0.0"

I am getting build error for the third party library

error: package android.support.v7.widget does not exist
    public final android.support.v7.widget.Toolbar toolbarFragment;
                                          ^

When I checked dependencies, it is showing as

+--- com.android.databinding:baseLibrary:3.1.4 -> androidx.databinding:databinding-common:3.2.1
+--- androidx.appcompat:appcompat:1.0.0-rc01 -> 1.0.0 (*)
+--- com.google.android.material:material:1.0.0-rc01 -> 1.0.0 (*)
Prashant
  • 3,823
  • 3
  • 25
  • 40

1 Answers1

0

Actually the app is generating the binding classes and Jetifier fails to migrate the code in generated classes. To solve this problem, the library provider needs to put

android.databinding.enableV2=true

in their gradle.properties file.

From Android Documentation

Binding classes for library modules are compiled and packaged into the corresponding Android Archive (AAR) file. App modules that depend on those library modules no longer need to regenerate the binding classes.

Prashant
  • 3,823
  • 3
  • 25
  • 40
  • what library did you use? did you try to use `jetifier-standalone` instead for the 3rd-party library aar? then implement the library aar locally, e.g: `implementation project(:jetified-libs)` – mochadwi Apr 10 '20 at 17:54