Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
This happens when i extend from an
abstract base fragment
like so:
public abstract class BaseFragment<T extends BasePresenter, E extends BaseModel> extends Fragment {
, but the app still build without any errors. below is my build.gradle
config:
android {
compileSdkVersion 27
buildToolsVersion '26.0.2'
defaultConfig
multiDexEnabled true
minSdkVersion 21
targetSdkVersion 27
–
LifecycleOwner : A class that has an Android lifecycle. These events can be used by
custom components to handle lifecycle changes without implementing any
code inside the Activity or the Fragment.
To access LifecycleOwner class add following dependency in your app build.gradle file.
implementation "android.arch.lifecycle:extensions:1.1.1"
Solution 2:
Add following support compat dependency in your app build.gradle file.
implementation 'com.android.support:support-compat:27.1.1'
–
I have faced the same issue and I resolved this issue by updating android support libraries in build.gradle file.
I would recommend updating your android support libraries to 27.1.1 or newer. No need to add this :
implementation 'android.arch.lifecycle:extensions:1.1.1' (not recommended)
If the following dependency is not added in your app level's build.gradle then add it:
implementation "android.arch.lifecycle:extensions:1.1.1"
and sync the project with
gradle files.
If it is already added then:
a. Go to Tools-> Clean Project
b. Rebuild Project
c. Go to File-> Invalidate Caches and Restart
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.