首页 > 解决方案 > tools:context=".MainActivity" 失败,我该如何解决?

问题描述

论点:tools:context=".MainActivity"给我错误,另外命名的部分:.MainActivity以红色显示,我该怎么办?

xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"

标签: android

解决方案


尝试重建项目或尝试使缓存重新启动无效

如果仍然有同样的问题,您可以添加 yourpackagename.mainactivity 就像图片中这样

tools:context="com.etest.myapplicwr.MainActivity">

我的包名称是 com.etest.myapplicwr 用你的包名称替换它


推荐阅读