【发布时间】:2019-10-08 09:27:39
【问题描述】:
不知道我做错了什么。尝试编译 Android Studio 代码时出现以下错误:
';'预计
Code Error Image error: type annotations are not supported in -source 1.7
@Override
public void onRequestPermissionsResult(int requestCode,
String[] permissions, int[] grantResults) {
switch (requestCode) {
case MY_PERMISSIONS_REQUEST_READ_CONTACTS: {
// If request is cancelled, the result arrays are empty.
if (grantResults.length > 0
&& grantResults[0] == PackageManager.PERMISSION_GRANTED) {
// permission was granted, yay! Do the
// contacts-related task you need to do.
} else {
// permission denied, boo! Disable the
// functionality that depends on this permission.
}
return;
}
// other 'case' lines to check for other
// permissions this app might request.
}
}
【问题讨论】:
-
嗨,欢迎来到 StackOverflow!请考虑发布整个文件或至少发布您收到此错误的行。因为现在我无法判断是否有问题。
-
当我尝试发布整个文件时,stackoverflow 说看起来你的帖子主要是代码;请添加更多详细信息。我可以发布屏幕截图吗?
-
您的代码没有错。编译器应该告诉您缺少
;的位置。在那里添加它,它应该可以工作。 -
我已经发布了错误代码图片以便更好地理解。
标签: android compilation