Skip to content
Advertisement

android.support.constraint.ConstraintLayout class not found

After importing android native ads templates module from https://github.com/googleads/googleads-mobile-android-native-templates

I cannot run the app because of the following error

Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.constraint.ConstraintLayout" on path: DexPathList[[zip file "/data/app/com.test.app-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]

Advertisement

Answer

The library you mentioned uses support libraries. Lately all of support packages have been moved to androidx, you can check if your project uses androidx artifacts by checking your build.gradle, there the dependencies should be something like:

implementation 'androidx.appcompat:appcompat:1.0.2'

Androidx and support libraries are not compatible, so if you want to use the library you have 3 choices:

  1. Downgrade you application to use support libraries (not recommended)
  2. Fork the repository and change imports. This is an easy job, you just need to replace all packages from support to androidx.
  3. Import the source code to the android studio and use the option: Refactor |> Migrate to AndroidX (Not sure if it works with modules)
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement