java - tool.context 中未解析的类
问题描述
当我创建一个新项目时出现错误
“工具.context =“.MainActivity”中的“解算器类”MainActivity“
如果我单击“运行应用程序”,则显示未找到默认活动
试图这样写:tool.context =“com.example.android.myapplication”,但它仍然报告未找到默认活动。几天前运行良好的项目现在也有这个问题。
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
解决方案
你的package
or applicationId
in AndroidManifest.xml
and build.gradle
file 和你Activity
的包结构一样吗?
那是com.example.android.myapplication
?
推荐阅读
- c++ - 使用 const string& 构造函数和模板化 std::set 查找的分段错误
- simulink - 将数组馈送到传递函数
- javascript - 如何告诉 vite 在解析模块时要搜索哪些目录?
- scilab - Scilab “警告添加带有空矩阵的矩阵将给出空矩阵结果。”
- python - Pyspark 窗口函数中的意外错误
- python - 如何删除字典列表中超过一定长度的单词
- reactjs - Helmet 需要一个字符串作为 . 你忘了给你的孩子戴上牙套吗
- android - 仅从android中的特定包接收广播
- javascript - 对象数组返回长度 0(未定义),但在 chrome 检查它可以工作 - Javascript
- python - 设置可以存储和切换套接字连接的套接字服务器