我在我的kotlin代码中遇到了一些错误。代码如下:
'''package com.mohamed.focuscounter
import android.os.Bundle
import androidx.fragment.app.Fragment //(line4)
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup'''
'''class AvailableFragment : Fragment() { //(line 9)
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_available, container, false)
}
}'''
The Errors encountered is as follows:
1.unresolved reference:fragment (line 4)
2.unresolved reference:Fragment (line 9)
任何帮助都将不胜感激
1条答案
按热度按时间ijxebb2r1#
确保应用
build.gradle
文件中具有Fragment的依赖项