package com.example.hilt import androidx.appcompa...
# community-support
s
package com.example.hilt import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import androidx.activity.viewModels import com.example.hilt.model.UserViewModel import com.example.hilt.model.UserEntity import dagger.hilt.android.AndroidEntryPoint @AndroidEntryPoint class MainActivity : AppCompatActivity() { private val viewModel: UserViewModel by viewModels() override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout._activity_main_) viewModel.addUser( UserEntity( id = 0, name = "ayesha", email ="ayesha", password = "123" ) ) } } why it's giving error on import androidx.activity.viewModels,private val viewModel: UserViewModel by viewModels()
v
What does that question have to do with Gradle, except you using Gradle to run your build?
😭 1
s
Execution failed for task 'appkaptDebugKotlin'.
A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask$KaptExecutionWorkAction
> java.lang.reflect.InvocationTargetException (no error message) * Try:
Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
Get more help at https://help.gradle.org.
BUILD FAILED in 43s 29 actionable tasks: 28 executed, 1 up-to-date
v
Did you follow the advices in the error message? If no, why not? If yes, why don't you share the additional information, especially the
--stacktrace
or optimally the build
--scan
URL?