Android Studio两个版本之间的引用问题

huangapple go评论74阅读模式
英文:

Android Studio referencing issues between two versions

问题

我正试图跟进这个关于制作Java应用的在线课程,我正在学习的视频使用的是一个非常过时的Android Studio版本,与现在可用的版本相比。我尝试使用存档中的旧模块,但是出现了错误,所以我正在使用新的模块,但是出现了很多不同的问题。比如我正在使用的这个模块试图使它变简单,但实际上让情况变得更糟,例如使用分号是多余的。

我注意到我的主函数不是public的,但是当我尝试更改时,它变灰了,称其为多余的。除此之外,我认为从第18行开始出现了错误,当我试图逐字逐句地按照视频操作时,从第17行开始,就会出现红色下划线,表示错误。另外,变量和声明的方式似乎有点不同。

左边是演示,右边是我的:

Android Studio两个版本之间的引用问题

英文:

I'm trying to follow this online class on making a Java App and the video I'm learning from is using a very outdated version of Android Studio compared to what is available. I tried using the older module from the archives but I'm getting errors, so I'm using the new one but there's a bunch of different issues. Like the one im using is trying to make it simple but its making it worst for instance using semi colons are redundant.

I noticed my main is not public but when I try its greyed out calling it redundant, other than that its line 18 that starts my errors I think, when I try to go letter for letter from the video its just red and wrong starting from line 17. Also Looks like variables and declarations are a little off.

Side By Side Left is demo, Right is mine:

Android Studio两个版本之间的引用问题

答案1

得分: 0

问题不在于Android Studio,问题在于您的左侧图像代码是用JAVA语言编写的,而您正在进行的操作(右侧代码)是用KOTLIN语言编写的。Android Studio两个版本之间的引用问题

您需要使用JAVA语言来完成相同的程序,或者最好找一个教程,以KOTLIN提供与JAVA相同的内容,因为它比JAVA要好得多。

英文:

the issue is not with the android studio the issue is your left side image code is in JAVA language and what you are doing (Right side code) it's in KOTLIN language. Android Studio两个版本之间的引用问题.

You need to have language as JAVA to do the same program or better find a tutorial which gives you same thing in KOTLIN as it's far better than JAVA.

huangapple
  • 本文由 发表于 2020年9月20日 12:23:48
  • 转载请务必保留本文链接:https://go.coder-hub.com/63975484.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定