I have one app in the Play Store and which is Arabic to Bangla dictionary. I have noticed for some devices it is throwing an InFlateException in a function which I have given below. The app is works well on some devices but some specific devices crash due to this exception. The exception showing on the below function. My question is why this type of exception occurs and what is the possible solution for this?
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_login_acitvity)
        realm = Realm.getDefaultInstance()
//        realm.beginTransaction()
//        realm.delete(Users::class.java)
//        realm.commitTransaction()
        if(intent.hasExtra("message")) {
            val msg = intent.getStringExtra("message")
            reg_success_msg.text = msg
            reg_success_msg.setBackgroundResource(R.color.colorSuccess)
            reg_success_msg.visibility = View.VISIBLE
        }
        handle_login.setOnClickListener {
            login_progress.visibility = View.VISIBLE
            login_alert_area.visibility = View.GONE
            login_alert.text = ""
            closeKeyboard(ET_activation_code)
            val email = ET_email.text.toString().trim()
            password = ET_password.text.toString().trim()
            val transaction_id = ET_activation_code.text.toString().trim()
            if(email.isEmpty() || password.isEmpty()) {
                login_alert.text = "সব ঘর পূরণ করতে হবে"
                login_alert_area.visibility = View.VISIBLE
                login_progress.visibility = View.GONE
            } else {
                if(checkNetworkConnection()) {
                    var newUser = User(
                        email = email,
                        password = password,
                        transaction_id = transaction_id
                    )
                    val userService: UserService = ServiceBuilder.buildService(UserService::class.java)
                    val requestCall: Call<User> = userService.login(newUser)
                    requestCall.enqueue(object : Callback<User>{
                        override fun onFailure(call: Call<User>, t: Throwable) {
                            Toast.makeText(applicationContext, "Something went wrong", Toast.LENGTH_LONG).show()
                            login_progress.visibility = View.GONE
                        }
                        override fun onResponse(call: Call<User>, response: Response<User>) {
                            val code = response.code()
                            val body = response.body()
                            if(code == 200) {
                                addUserToLocalDb(body)
                                login_progress.visibility = View.GONE
                                login_alert_area.visibility = View.GONE
                                val intent = Intent(applicationContext, HomeActivity::class.java)
                                startActivity(intent)
                                finish()
                            } else if(code == 201) {
                                login_alert.text = body!!.error.toString()
                                login_alert_area.visibility = View.VISIBLE
                                login_progress.visibility = View.GONE
                            }
                        }
                    })
                } else {
                    login_alert.text = "ইউজার পাওয়া যায় নি। ইন্টারনেট চালু করে চেষ্টা করুন"
                    login_alert_area.visibility = View.VISIBLE
                    login_progress.visibility = View.GONE
                }
            }
        }
        btn_close_error.setOnClickListener {
            login_alert.text = ""
            login_alert_area.visibility = View.GONE
        }
        login_alert_area.setOnClickListener {
            login_alert.text = ""
            login_alert_area.visibility = View.GONE
        }
        btn_registration.setOnClickListener {
            val intent = Intent(this, RegistrationActivity::class.java)
            startActivity(intent)
        }
        forget_pass_btn.setOnClickListener {
            val intent = Intent(this, ForgetPasswordActivity::class.java)
            startActivity(intent)
        }
        btn_how_to_activate.setOnClickListener {
            val intent = Intent(this, HowToActivateActivity::class.java)
            startActivity(intent)
        }
        btn_how_to_use.setOnClickListener {
            val intent = Intent(this, HowToUseActivity::class.java)
            startActivity(intent)
        }
        btn_feature.setOnClickListener {
            val intent = Intent(this, FeatureActivity::class.java)
            startActivity(intent)
        }
        btn_owner.setOnClickListener {
            val intent = Intent(this, OwnerActivity::class.java)
            startActivity(intent)
        }
        btn_contact.setOnClickListener {
            val intent = Intent(this, ContactActivity::class.java)
            startActivity(intent)
        }
        btn_copyright.setOnClickListener {
            val intent = Intent(this, CopyrightActivity::class.java)
            startActivity(intent)
        }
    }

