I am trying import android.support.v4.app.Fragment but I get the error "Unresolved Reference: Fragment". I can't import it anywhere in my project. Right now I'm trying to import it into a Fragment class.
But if I try to import android.support.v4.app.FragmentManager or any other class inside android.support.v4.app it works just fine. I have tried syncing gradle, Invalidating Caches and searching the internet. I can't seem to find what might be the problem.
Here is my fragment class
package com.example.johnDoe.storeapp
import android.app.Fragment
import android.support.v4.app.Fragment // Gives the error "Unresolved Reference: Fragment"
import android.support.v4.app.FragmentManager //Works fine
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
class StoresFragment : Fragment(){
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup, savedInstanceState: Bundle): View {
val view: View
view = inflater.inflate(R.layout.fragment_stores, container, false)
return view
}
}
This is my build.gradle file
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.johnDoe.storeapp"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}