简体   繁体   English

AS新建项目,代码报错,但可以正常运行

[英]AS create a new project,code reports some error, but it can run normally

error pic错误图片

when I create a new project in Android Studio Arctic Fox |当我在 Android Studio 北极狐中创建一个新项目时 | 2020.3.1 Patch 4,I create MainActivity by kotlin,code reports some error (introduced red), but it can run normally. 2020.3.1补丁4,我通过kotlin创建MainActivity,代码报错(红色介绍),但可以正常运行。


I' ve looked around and apparently I've got the choice between these solutions:我环顾四周,显然我可以在这些解决方案之间进行选择:

  1. I try to Click File -> Invalidate Caches/Restar.Open the project again,not work.我尝试单击文件-> 使缓存无效/重新启动。再次打开项目,不起作用。
  2. I tyr to Build -> Clean project,Rebuild project.Not work,code reports some error我很想构建 -> 清理项目,重新构建项目。不起作用,代码报告了一些错误
  3. I try to Close my project, and in my project folder delete project/.idea and project/.gradle.Open the project again,not work.我尝试关闭我的项目,并在我的项目文件夹中删除项目/.idea 和项目/.gradle。再次打开项目,不起作用。

It can run normally,but Look uncomfortable,I am searching for a long time on net.可以正常运行,但是看着不舒服,在网上找了半天。 But no use.但是没有用。 Please help or try to give some ideas how to achieve this.Thanks in advance.请帮助或尝试提供一些想法如何实现这一点。在此先感谢。

Try using the latest and appropriate version for your Gradle and using the correct version of the initial in the Gradle.尝试为您的 Gradle 使用最新和适当的版本,并在Gradle中使用正确的初始版本。 You can also invalidate your caches to ensure using the latest new data.您还可以使缓存无效,以确保使用最新的新数据。 In some cases, upgrading your SDK is a way to fix the problem.在某些情况下,升级SDK是解决问题的一种方法。

If not works, please share your error here to follow up.如果不起作用,请在此处分享您的错误以跟进。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我有一些错误,创建一个运行项目,而不是运行该项目 - i have some error of create a run project and not run the project Android Titanium问题-无法运行或创建新的Alloy项目 - Android Titanium Issue - Can't run or create new Alloy project Android Studio新项目无法运行,抛出错误 - Android Studio new project can not run, throwing error 从现有的android代码创建一个新项目时,我的日食有些问题 - some problems with my eclipse when create an new project from existing android code 在android studio中,使用Genymotion监视器,新建项目无法正常构建 - In android studio ,using Genymotion monitor,New project can‘t built normally 无法在eclipse中创建新的android应用程序项目,但可以导入并运行现有的 - can not create new android application project in eclipse but can import and run existing 无法运行新的Android项目 - can't run new android project Android Studio / IntelliJ IDEA创建新项目失败,错误消息为“无效类型代码:00” - Android Studio / IntelliJ IDEA create new project failed with error message 'invalid type code: 00' AndroidStudio | 创建新项目时出错 - AndroidStudio | error when create new project 使用Eclipse创建新项目时出错 - Error when i create a new project with Eclipse
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM