我将我的应用程序作为公开测试版发布到 Play 商店。当我使用模拟器运行它或通过 Android Studio 连接手机时,我没有收到任何错误。但是,当我在手机上以 apk 形式安装该应用程序时,它会将其从应用程序中抛出,并且我在 Play Console 上收到以下错误。
错误:
Exception java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mahmutalperenunal.passwordbook/com.mahmutalperenunal.passwordbook.ui.create_edit_view_password.CreateEditViewPasswordActivity}: android.view.InflateException: Binary XML file line #21 in com.mahmutalperenunal.passwordbook:layout/activity_create_edit_view_password: Binary XML file line #21 in com.mahmutalperenunal.passwordbook:layout/activity_create_edit_view_password: Error inflating class androidx.fragment.app.FragmentContainerView
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3635)
at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3792)
at android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:103)
at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2210)
at android.os.Handler.dispatchMessage (Handler.java:106)
at androidx.test.espresso.base.Interrogator.loopAndInterrogate (Interrogator.java:10)
at androidx.test.espresso.base.UiControllerImpl.loopUntil (UiControllerImpl.java:7)
at androidx.test.espresso.base.UiControllerImpl.loopUntil (UiControllerImpl.java:1)
at androidx.test.espresso.base.UiControllerImpl.injectMotionEvent (UiControllerImpl.java:5)
at androidx.test.espresso.action.MotionEvents.sendUp (MotionEvents.java:6)
at androidx.test.espresso.action.MotionEvents.sendUp (MotionEvents.java:1)
at androidx.test.espresso.action.Tap.sendSingleTap (Tap.java:5)
at androidx.test.espresso.action.Tap.-$$Nest$smsendSingleTap
at androidx.test.espresso.action.Tap$1.sendTap (Tap.java:1)
at androidx.test.espresso.action.GeneralClickAction.perform (GeneralClickAction.java:4)
at androidx.test.espresso.ViewInteraction$SingleExecutionViewAction.perform (ViewInteraction.java:2)
at androidx.test.espresso.ViewInteraction.doPerform (ViewInteraction.java:23)
at androidx.test.espresso.ViewInteraction.-$$Nest$mdoPerform
at androidx.test.espresso.ViewInteraction$1.call (ViewInteraction.java:6)
at androidx.test.espresso.ViewInteraction$1.call (ViewInteraction.java:1)
at java.util.concurrent.FutureTask.run (FutureTask.java:266)
at android.os.Handler.handleCallback (Handler.java:938)
at android.os.Handler.dispatchMessage (Handler.java:99)
at android.os.Looper.loopOnce (Looper.java:201)
at android.os.Looper.loop (Looper.java:288)
at android.app.ActivityThread.main (ActivityThread.java:7839)
at java.lang.reflect.Method.invoke
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1003)
Caused by android.view.InflateException: Binary XML file line #21 in com.mahmutalperenunal.passwordbook:layout/activity_create_edit_view_password: Binary XML file line #21 in com.mahmutalperenunal.passwordbook:layout/activity_create_edit_view_password: Error inflating class androidx.fragment.app.FragmentContainerView
Caused by: android.view.InflateException: Binary XML file line #21 in com.mahmutalperenunal.passwordbook:layout/activity_create_edit_view_password: Error inflating class androidx.fragment.app.FragmentContainerView
Caused by: java.lang.RuntimeException: Exception inflating com.mahmutalperenunal.passwordbook:navigation/nav_graph_password_create_edit_view line 20
at androidx.navigation.NavInflater.inflate (NavInflater.java)
at kotlin.SynchronizedLazyImpl.getValue (SynchronizedLazyImpl.java)
at androidx.navigation.fragment.NavHostFragment.getNavHostController$navigation_fragment_release (NavHostFragment.java)
at androidx.navigation.fragment.NavHostFragment.onCreate (NavHostFragment.java)
at androidx.fragment.app.FragmentStateManager.create (FragmentStateManager.java)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState (FragmentStateManager.java)
at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute (FragmentManager.java)
at androidx.fragment.app.BackStackRecord.commitNowAllowingStateLoss (BackStackRecord.java:10)
at androidx.fragment.app.FragmentContainerView.\<init\> (FragmentContainerView.java:10)
at androidx.fragment.app.FragmentLayoutInflaterFactory.onCreateView (FragmentLayoutInflaterFactory.java)
at androidx.fragment.app.FragmentController.onCreateView (FragmentController.java:4)
at androidx.fragment.app.FragmentActivity.dispatchFragmentsOnCreateView (FragmentActivity.java:4)
at androidx.fragment.app.FragmentActivity.onCreateView (FragmentActivity.java:4)
at android.view.LayoutInflater.tryCreateView (LayoutInflater.java:1073)
at android.view.LayoutInflater.createViewFromTag (LayoutInflater.java:1001)
at android.view.LayoutInflater.createViewFromTag (LayoutInflater.java:965)
at android.view.LayoutInflater.rInflate (LayoutInflater.java:1127)
at android.view.LayoutInflater.rInflateChildren (LayoutInflater.java:1088)
at android.view.LayoutInflater.inflate (LayoutInflater.java:686)
at android.view.LayoutInflater.inflate (LayoutInflater.java:538)
at com.mahmutalperenunal.passwordbook.ui.create_edit_view_password.CreateEditViewPasswordActivity.onCreate (CreateEditViewPasswordActivity.java)
at android.app.Activity.performCreate (Activity.java:8050)
at android.app.Activity.performCreate (Activity.java:8030)
at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1329)
at androidx.test.runner.MonitoringInstrumentation.callActivityOnCreate (MonitoringInstrumentation.java:2)
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3608)
at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3792)
at android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:103)
at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2210)
at android.os.Handler.dispatchMessage (Handler.java:106)
at androidx.test.espresso.base.Interrogator.loopAndInterrogate (Interrogator.java:10)
at androidx.test.espresso.base.UiControllerImpl.loopUntil (UiControllerImpl.java:7)
at androidx.test.espresso.base.UiControllerImpl.loopUntil (UiControllerImpl.java:1)
at androidx.test.espresso.base.UiControllerImpl.injectMotionEvent (UiControllerImpl.java:5)
at androidx.test.espresso.action.MotionEvents.sendUp (MotionEvents.java:6)
at androidx.test.espresso.action.MotionEvents.sendUp (MotionEvents.java:1)
at androidx.test.espresso.action.Tap.sendSingleTap (Tap.java:5)
at androidx.test.espresso.action.Tap.-$$Nest$smsendSingleTap
at androidx.test.espresso.action.Tap$1.sendTap (Tap.java:1)
at androidx.test.espresso.action.GeneralClickAction.perform (GeneralClickAction.java:4)
at androidx.test.espresso.ViewInteraction$SingleExecutionViewAction.perform (ViewInteraction.java:2)
at androidx.test.espresso.ViewInteraction.doPerform (ViewInteraction.java:23)
at androidx.test.espresso.ViewInteraction.-$$Nest$mdoPerform
at androidx.test.espresso.ViewInteraction$1.call (ViewInteraction.java:6)
at androidx.test.espresso.ViewInteraction$1.call (ViewInteraction.java:1)
at java.util.concurrent.FutureTask.run (FutureTask.java:266)
at android.os.Handler.handleCallback (Handler.java:938)
at android.os.Handler.dispatchMessage (Handler.java:99)
at android.os.Looper.loopOnce (Looper.java:201)
at android.os.Looper.loop (Looper.java:288)
at android.app.ActivityThread.main (ActivityThread.java:7839)
at java.lang.reflect.Method.invoke
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1003)
Caused by java.lang.RuntimeException: java.lang.ClassNotFoundException: com.mahmutalperenunal.passwordbook.database.entities.Entry
at androidx.navigation.NavInflater.inflateArgument (NavInflater.java)
at androidx.navigation.NavInflater.inflate (NavInflater.java)
at androidx.navigation.NavInflater.inflate (NavInflater.java)
at androidx.navigation.NavInflater.inflate (NavInflater.java)
Caused by java.lang.ClassNotFoundException: com.mahmutalperenunal.passwordbook.database.entities.Entry
at java.lang.Class.classForName
at java.lang.Class.forName (Class.java:454)
at java.lang.Class.forName (Class.java:379)
at androidx.navigation.NavInflater.inflateArgument (NavInflater.java)
nav_graph.xml:
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/nav_graph_password_create_view_edit"
app:startDestination="@id/createPasswordFragment">
<fragment
android:id="@+id/createPasswordFragment"
android:name="com.mahmutalperenunal.passwordbook.ui.create_edit_view_password.fragments.CreatePasswordFragment"
android:label="fragment_create_password"
tools:layout="@layout/fragment_create_password" />
<fragment
android:id="@+id/viewPasswordsFragment"
android:name="com.mahmutalperenunal.passwordbook.ui.create_edit_view_password.fragments.ViewPasswordsFragment"
android:label="fragment_view_passwords"
tools:layout="@layout/fragment_view_passwords">
<argument
android:name="data"
app:argType="com.mahmutalperenunal.passwordbook.database.entities.Entry" />
</fragment>
<fragment
android:id="@+id/editPasswordFragment"
android:name="com.mahmutalperenunal.passwordbook.ui.create_edit_view_password.fragments.EditPasswordFragment"
android:label="fragment_edit_password"
tools:layout="@layout/fragment_edit_password">
<argument
android:name="data"
app:argType="com.mahmutalperenunal.passwordbook.database.entities.Entry" />
</fragment>
</navigation>
activity.xml:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background"
tools:context=".ui.create_edit_view_password.CreateEditViewPasswordActivity">
<androidx.fragment.app.FragmentContainerView
android:id="@+id/createEditViewPassword_fragment"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:defaultNavHost="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:navGraph="@navigation/nav_graph_password_create_edit_view" />
</androidx.constraintlayout.widget.ConstraintLayout>
片段.kt:
class CreatePasswordFragment : Fragment() {
private var _binding: FragmentCreatePasswordBinding? = null
private val binding get() = _binding!!
private lateinit var adapter: PasswordAccountInfoAdapter
private val accountDetailList = mutableListOf<EntryDetail>()
private lateinit var viewModel: CreateEditViewPasswordViewModel
private fun rand(from: Int, to: Int): Int {
val random = Random()
return random.nextInt(to - from) + from
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
_binding = FragmentCreatePasswordBinding.inflate(inflater, container, false)
val view = binding.root
val mBottomSheetDialog = RoundedBottomSheetDialog(requireContext())
val sheetView = layoutInflater.inflate(R.layout.bottom_sheet_options, null)
mBottomSheetDialog.setContentView(sheetView)
val sheetBinding: BottomSheetOptionsBinding = BottomSheetOptionsBinding.bind(sheetView)
val rvAccountDetails = binding.createPasswordAccountDetailsRecyclerView
adapter = PasswordAccountInfoAdapter(accountDetailList)
rvAccountDetails.adapter = adapter
rvAccountDetails.layoutManager = LinearLayoutManager(requireContext())
val itemTouchHelper = ItemTouchHelper(object : ItemTouchHelper.SimpleCallback(
ItemTouchHelper.UP or ItemTouchHelper.DOWN,
0
) {
override fun onMove(
recyclerView: RecyclerView,
viewHolder: RecyclerView.ViewHolder,
target: RecyclerView.ViewHolder,
): Boolean {
val startPos = viewHolder.adapterPosition
val endPos = target.adapterPosition
Collections.swap(accountDetailList, startPos, endPos)
adapter.notifyItemMoved(startPos, endPos)
return true
}
override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) {}
})
itemTouchHelper.attachToRecyclerView(binding.createPasswordAccountDetailsRecyclerView)
val num = rand(1, 4)
if (num == 1 || num == 2) {
FancyShowCaseView.Builder(requireActivity())
.focusOn(binding.createPasswordNewEntryImageView)
.title(getString(R.string.add_new_item_text))
.build()
.show()
} else {
FancyShowCaseView.Builder(requireActivity())
.focusOn(binding.createPasswordIconImageView)
.title(getString(R.string.select_icon_text))
.build()
.show()
}
var companyIcon = 0
binding.createPasswordBackButton.setOnClickListener {
val intent = Intent(requireContext(), PasswordActivity::class.java)
startActivity(intent)
(activity as CreateEditViewPasswordActivity).finish()
(activity as CreateEditViewPasswordActivity).overridePendingTransition(
R.anim.slide_in_left,
R.anim.slide_out_right
)
}
viewModel = (activity as CreateEditViewPasswordActivity).viewModel
binding.createPasswordIconImageView.setOnClickListener {
val iBottomSheetDialog = RoundedBottomSheetDialog(requireContext())
val sheetView = layoutInflater.inflate(R.layout.company_chooser_sheet, null)
iBottomSheetDialog.setContentView(sheetView)
val companySheetBinding: CompanyChooserSheetBinding = CompanyChooserSheetBinding.bind(
sheetView
)
val companyList = CompanyListData.companyListData
val companyAdapter = LogoCompanyChooserAdapter(companyList)
companySheetBinding.rvCompanyChooser.adapter = companyAdapter
companySheetBinding.rvCompanyChooser.layoutManager =
LinearLayoutManager(requireContext())
companySheetBinding.rvCompanyChooser.isNestedScrollingEnabled = true
iBottomSheetDialog.show()
companyAdapter.setOnItemClickListener {
companyIcon = it.id
Snackbar.make(
view,
"${it.companyName} " + getString(R.string.logo_selected_text),
Snackbar.LENGTH_SHORT
)
.show()
iBottomSheetDialog.dismiss()
}
iBottomSheetDialog.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE)
companySheetBinding.searchBar.addTextChangedListener(object : TextWatcher {
override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {}
override fun onTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {
val companyListData = CompanyListData.companyListData
val filteredList = mutableListOf<CompanyList>()
if (p0 != null) {
for (company in companyListData) {
if (company.companyName.contains(p0)) {
filteredList.add(company)
}
}
}
val filteredCompanyAdapter = LogoCompanyChooserAdapter(filteredList)
companySheetBinding.rvCompanyChooser.adapter = filteredCompanyAdapter
}
override fun afterTextChanged(p0: Editable?) {}
})
}
binding.createPasswordNewEntryImageView.setOnClickListener {
val popupMenu = PopupMenu(requireContext(), it)
popupMenu.menuInflater.inflate(R.menu.account_details_menu, popupMenu.menu)
popupMenu.show()
popupMenu.setOnMenuItemClickListener { menuItem ->
when (menuItem.itemId) {
R.id.accountDetail_username -> {
showBottomSheet(mBottomSheetDialog, sheetBinding, 0)
popupMenu.dismiss()
}
R.id.accountDetail_email -> {
showBottomSheet(mBottomSheetDialog, sheetBinding, 1)
popupMenu.dismiss()
}
R.id.accountDetail_phone -> {
showBottomSheet(mBottomSheetDialog, sheetBinding, 2)
popupMenu.dismiss()
}
R.id.accountDetail_password -> {
showBottomSheet(mBottomSheetDialog, sheetBinding, 3)
popupMenu.dismiss()
}
R.id.accountDetail_website -> {
showBottomSheet(mBottomSheetDialog, sheetBinding, 4)
popupMenu.dismiss()
}
R.id.accountDetail_note -> {
showBottomSheet(mBottomSheetDialog, sheetBinding, 5)
popupMenu.dismiss()
}
}
true
}
}
binding.createPasswordSaveImageView.setOnClickListener {
val entryTitle = binding.createPasswordEntryTitleEditText.editText?.text.toString()
val entryCategory: String =
(binding.createPasswordCategoryChipGroup.children.toList().filter {
(it as Chip).isChecked
}[0] as Chip).text.toString()
val entryIcon = companyIcon
val entryDetailsList = accountDetailList
if (entryTitle.isNotEmpty() || entryTitle.isNotBlank()) {
if (entryCategory.isNotEmpty() || entryCategory.isNotBlank()) {
if (entryDetailsList.isNotEmpty()) {
val dialog = ProgressDialog.show(
requireContext(),
getString(R.string.saving_text),
getString(R.string.saving_description_text),
true,
false
)
dialog.show()
val password1 = PASSWORD1
CoroutineScope(Dispatchers.IO).launch {
val entry = Entry(0, entryTitle, entryCategory, entryIcon, 0)
val id = async { viewModel.upsertEntry(entry) }.await()
for (entryDetail in entryDetailsList) {
val securityClass = EncryptionDecryption()
val encryptedObject = securityClass.encrypt(
entryDetail.detailContent,
password1,
securityClass.getKey()
)
val encryptedData = encryptedObject.encryptedData
val emdKey = encryptedObject.key
entryDetail.id = 0
entryDetail.entryId = id
entryDetail.detailContent = encryptedData
val entryDetailId = async {
viewModel.upsertEntryDetail(
entryDetail
)
}.await()
val saltObject = EncryptedKey(0, entryDetailId, emdKey)
async { viewModel.upsertEncryptedKey(saltObject) }.await()
}
withContext(Dispatchers.Main) {
dialog.dismiss()
val intent = Intent(
requireContext(),
PasswordActivity::class.java
)
startActivity(intent)
(activity as CreateEditViewPasswordActivity).finish()
}
}
} else {
Snackbar.make(
view,
getString(R.string.account_detail_error_text),
Snackbar.LENGTH_SHORT
).show()
}
} else {
Snackbar.make(
view,
getString(R.string.select_category_text),
Snackbar.LENGTH_SHORT
).show()
}
} else {
Snackbar.make(
view,
getString(R.string.title_cannot_blank_text),
Snackbar.LENGTH_SHORT
).show()
}
}
return view
}
override fun onDestroyView() {
super.onDestroyView()
_binding = null
}
@SuppressLint("NotifyDataSetChanged")
private fun showBottomSheet(
mBottomSheetDialog: RoundedBottomSheetDialog,
sheetBinding: BottomSheetOptionsBinding,
optionType: Int,
) {
var detailType = ""
sheetBinding.bottomSheetOptionsEditText.editText?.text?.clear()
sheetBinding.bottomSheetOptionsEditText.editText?.clearFocus()
when (optionType) {
0 -> {
detailType = "Username"
sheetBinding.bottomSheetOptionsEditText.helperText =
getString(R.string.eg_text) + getString(R.string.username_text)
sheetBinding.bottomSheetOptionsEditText.editText?.inputType =
InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_VARIATION_NORMAL
}
1 -> {
detailType = "Email"
sheetBinding.bottomSheetOptionsEditText.isPasswordVisibilityToggleEnabled = false
sheetBinding.bottomSheetOptionsEditText.helperText =
getString(R.string.eg_text) + getString(R.string.sample_email_text)
sheetBinding.bottomSheetOptionsEditText.editText?.inputType =
InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_VARIATION_NORMAL
}
2 -> {
detailType = "Phone Number"
sheetBinding.bottomSheetOptionsEditText.isPasswordVisibilityToggleEnabled = false
sheetBinding.bottomSheetOptionsEditText.editText?.inputType =
InputType.TYPE_CLASS_NUMBER or InputType.TYPE_NUMBER_FLAG_DECIMAL or InputType.TYPE_NUMBER_FLAG_SIGNED or InputType.TYPE_CLASS_PHONE
sheetBinding.bottomSheetOptionsEditText.helperText =
getString(R.string.eg_text) + getString(R.string.sample_phone_number_text)
}
3 -> {
detailType = "Password"
sheetBinding.bottomSheetOptionsEditText.isPasswordVisibilityToggleEnabled = true
sheetBinding.bottomSheetOptionsEditText.helperText =
getString(R.string.strong_password_text)
sheetBinding.bottomSheetOptionsEditText.editText?.inputType =
InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_VARIATION_PASSWORD
}
4 -> {
detailType = "Website"
sheetBinding.bottomSheetOptionsEditText.isPasswordVisibilityToggleEnabled = false
sheetBinding.bottomSheetOptionsEditText.helperText =
getString(R.string.eg_text) + getString(R.string.sample_website_text)
sheetBinding.bottomSheetOptionsEditText.editText?.inputType =
InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_VARIATION_NORMAL
}
5 -> {
detailType = "Notes"
sheetBinding.bottomSheetOptionsEditText.isPasswordVisibilityToggleEnabled = false
sheetBinding.bottomSheetOptionsEditText.editText?.minLines = 3
sheetBinding.bottomSheetOptionsEditText.helperText =
getString(R.string.some_notes_text)
sheetBinding.bottomSheetOptionsEditText.editText?.inputType =
InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_FLAG_MULTI_LINE
}
}
sheetBinding.bottomSheetOptionsEditText.hint = detailType
mBottomSheetDialog.show()
sheetBinding.bottomSheetOptionsAddOptionButton.setOnClickListener {
val validateMessage = validateInput(
sheetBinding.bottomSheetOptionsEditText.editText?.text.toString(),
optionType
)
if (validateMessage == getString(R.string.validated_text)) {
val accountDetailObj = EntryDetail(
1,
1,
detailType,
sheetBinding.bottomSheetOptionsEditText.editText?.text.toString()
)
accountDetailList.add(accountDetailObj)
adapter.notifyDataSetChanged()
mBottomSheetDialog.dismiss()
} else {
sheetBinding.bottomSheetOptionsEditText.error = validateMessage
}
}
}
private fun validateInput(input: String, type: Int): String {...}
private fun nullCheckInput(input: String): Boolean {
return input.isNotEmpty() && input.isNotBlank()
}
}
条目.kt:
package com.mahmutalperenunal.passwordbook.database.entities
import androidx.room.Entity
import androidx.room.PrimaryKey
import java.io.Serializable
@Entity(tableName = "entry")
data class Entry(
@PrimaryKey(autoGenerate = true)
val id: Int,
val title: String,
val category: String,
val icon: Int,
var favourite: Int
) : Serializable
如何解决这个问题?
我遇到了同样的错误并找到了解决方案:
文档说:
首先需要创建 NavHostFragment,其中不得包含 app:navGraph 元素:
因此将其从片段容器中删除
https://developer.android.com/guide/navigation/design#programmatically