andfun-kotlin-dev-bytes
andfun-kotlin-dev-bytes copied to clipboard
Project fails to build with Android Studio Electric Eel 2022.1.1 Patch 1
-
In plugin 'androidx.navigation.safeargs' type 'androidx.navigation.safeargs.gradle.ArgumentsGenerationTask' property 'applicationId' is missing an input or output annotation.
-
Execution failed for task ':app:compileDebugJavaWithJavac'. \> Failed to calculate the value of task ':app:compileDebugJavaWithJavac' property 'options.generatedSourceOutputDirectory'. \> Querying the mapped value of map(java.io.File property(org.gradle.api.file.Directory, fixed(class org.gradle.api.internal.file.DefaultFilePropertyFactory$FixedDirectory, C:\Users\Genesis-Intel\Documents\projects\Android\Udacity\DevBytes-s1\app\build\generated\ap_generated_sources\debug\out)) org.gradle.api.internal.file.DefaultFilePropertyFactory$ToFileTransformer@124f9241) before task ':app:compileDebugJavaWithJavac' has completed is not supported
Here is my code for adding the overflow menu. I followed https://stackoverflow.com/questions/71917856/sethasoptionsmenuboolean-unit-is-deprecated-deprecated-in-java
class TitleFragment : Fragment() {
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
// Inflate the layout for this fragment
val binding: FragmentTitleBinding = DataBindingUtil.inflate(
inflater, R.layout.fragment_title, container, false
)
//Enable inject of own implementation
val menuHost: MenuHost = requireActivity()
binding.playButton.setOnClickListener(
Navigation.createNavigateOnClickListener(R.id.action_titleFragment_to_gameFragment)
)
menuHost.addMenuProvider(object : MenuProvider {
override fun onCreateMenu(menu: Menu, menuInflater: MenuInflater) {
// Add menu items here
menuInflater.inflate(R.menu.overflow_menu, menu)
}
override fun onMenuItemSelected(item: MenuItem): Boolean {
//Handle menu item selection
return when (item.itemId) {
R.id.aboutFragment -> {
NavigationUI.onNavDestinationSelected(
item,
requireView().findNavController()
)
true
}
// More menu-items could be added here as part of the when-logic
else -> false
}
}
})
return binding.root
}
}