[英]“Error type 3 Error: Activity class {} does not exist” ,Error type 3 Activity class does not exist " while launching Activity
Recently I renamed my android project package name, then when I ran the project it gave these two errors: 最近,我重命名了我的android项目包名称,然后在运行该项目时出现了以下两个错误:
Error type 3 Error: Activity class {} does not exist
Error type 3 Activity class does not exist
I checked my build.gradle
and found the applicationId
didn't change. 我检查了
build.gradle
,发现applicationId
不变。 After updating it, nothing was solved. 更新之后,什么都没有解决。 The same errors kept showing.
相同的错误不断显示。 One appears, then I do something, then the other appears...and so on.
一个出现,然后我做某事,然后另一个出现...,依此类推。
After a lot of searching, they suggested cleaning the project and deleting some folders (like .gradle
and build
) and rebuilding the project after restarting Android Studio, but none of that solved my problem. 经过大量搜索后,他们建议清理项目并删除一些文件夹(例如
.gradle
和build
),然后在重新启动Android Studio之后重新build
项目,但是这些都没有解决我的问题。
Any suggestions? 有什么建议么?
after a long night , I found the solution. 漫长的夜晚之后,我找到了解决方案。 simply my phone storage was almost full (400mb) left .
只是我的手机存储空间几乎已满(400mb)。 I cleaned up some space , and then it worked.
我清理了一些空间,然后工作了。
Aditional thing to do if nothing solved in your case : Tools > android > Sync Project with Gradle Files. 如果您的情况没有解决,请执行其他操作:工具> android>使用Gradle文件同步项目。
It is a easy problem which is happened when you migrate to androidX or refactoring the package name. 这是一个简单的问题,当您迁移到androidX或重构包名称时就会发生。 An easy solution is:
一个简单的解决方案是:
The problem could be in your Manifest file. 问题可能出在您的清单文件中。 Check the AndroidManifest.xml file.
检查AndroidManifest.xml文件。
Check the presence of those intent-filters inside your Activity declaration. 检查活动声明中是否存在那些意图过滤器。 Like below.
像下面。
<activity
android:name=".main.SplashScreenActivity"
android:label="@string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
If this information is there, maybe some cache problem occurred. 如果存在此信息,则可能发生了某些缓存问题。 Then, try this:
然后,尝试以下操作:
Go to File -> Invalidate Caches / Restart...
转到文件->使缓存无效/重新启动...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.