'Cannot resolve symbol 'ActivityLoginBinding' in androidstudio Java class
import org.srujan.stepoutv01.databinding.ActivityLoginBinding;
public class LoginActivity extends AppCompatActivity {
private LoginViewModel loginViewModel;
private ActivityLoginBinding binding;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = ActivityLoginBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
loginViewModel = new ViewModelProvider(this, new LoginViewModelFactory())
.get(LoginViewModel.class);
final EditText usernameEditText = binding.email;
final EditText passwordEditText = binding.password;[enter image description here][1]
final Button loginButton = binding.login;
final ProgressBar loadingProgressBar = binding.loading;
Solution 1:[1]
Have you added the below code in your build.gradle(:app) file?
buildFeatures{
viewBinding true
}
If not, Just add these above lines before buildTypes like below
buildFeatures{
viewBinding true
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
If the problem is the same, Just go to Build>Clean Project. Works fine. Let me know if the problem is not solved.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | M Dev |
