Android Studio 1.5.1 中的 Lint 不适用于缺少权限检测 [英] Lint in Android Studio 1.5.1 is not working for missing permissions detection
问题描述
目前,我正在将我的应用迁移到目标 API 23.
我花了一段时间才弄清楚为什么 accountManager.getAccountsByType("com.google")
不再起作用.这是由于新的 Marshmallow 权限模型 -
好像我在那里没有看到任何缺少权限"选项.
我的 Android Studio 设置有问题吗?
我可以看到 EverNote 团队提交了一份关于 lint 检查缺失权限的错误报告 -
MissingPermission
似乎不是这些.
Currently, I'm in the process of migrating my app to target API 23.
It takes me a while to figure out why accountManager.getAccountsByType("com.google")
no longer work. This is due to new Marshmallow permission model - http://developer.android.com/intl/es/training/permissions/requesting.html
I'm using Android Studio 1.5.1
According to http://tools.android.com/tips/lint-checks, I'm expecting lint able to warn me for the following code, based on MissingPermission
public static String getEmail() {
Pattern emailPattern = Patterns.EMAIL_ADDRESS; // API level 8+
AccountManager accountManager = AccountManager.get(MyApplication.instance());
Account[] accounts = accountManager.getAccountsByType("com.google");
for (Account account : accounts) {
if (emailPattern.matcher(account.name).matches()) {
String possibleEmail = account.name;
return possibleEmail;
}
}
}
I checked the lint installed in my system. I can confirm MissingPermission feature is there via
c:\adt-bundle-windows-x86_64-20140624\sdk\tools\lint.bat --show
But, I received no warning in Android Studio. I had checked the lint setting in Android Studio.
It seems that I don't see any "Missing permission" option there.
Is there anything wrong with my Android Studio settings?
I can see EverNote team once file a bug report regarding lint checking on missing permissions - https://code.google.com/p/android/issues/detail?id=182165 But it is fixed since Android Studio 1.4
I am using Android Studio 2.0 Beta 2
I do have a couple of missing permission settings in different categories have you checked other categories?
Edit: MissingPermission
does not seem to be any of these.
这篇关于Android Studio 1.5.1 中的 Lint 不适用于缺少权限检测的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!