Search code examples
androidandroid-architecture-componentsandroid-jetpack

android.arch.lifecycle:common-java8 is not recognised


I'm trying to build MVICore sample project from badoo.

But having an error as;

Unresolved reference: LifecycleOwner
Unresolved reference: arch
Unresolved reference: AndroidLifecycle

Basically the all android.arch is not recognised. There is no androidx in the project so it's using
"android.arch.lifecycle:common-java8" version 1.1.1

For LifeCycleObserver Android Studio recommends me to import androidx.lifecycle.LifecycleObserver

Developers of the project said it works on their pc, I tried with different pc and it worked.

When I do those changes (using androidx libraries) https://github.com/badoo/MVICore/pull/131/files, it works but developers of the project said it doesn't work for them with my changes.

I use

Android Studio 4.0.1
Build #AI-193.6911.18.40.6626763, built on June 25, 2020
Runtime version: 1.8.0_242-release-1644-b3-6222593 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.15.6
GC: ParNew, ConcurrentMarkSweep

And

java version "1.8.0_261"
Java(TM) SE Runtime Environment (build 1.8.0_261-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.261-b12, mixed mode)

Solution

  • Changing classpath 'com.android.tools.build:gradle:3.4.2' to classpath 'com.android.tools.build:gradle:3.1.4' solves the issue.