为什么缺少 checkSelfPermission 方法?

Why is the checkSelfPermission method missing?

我的客户要求测试他们的 APK。 我在 Android 6 和 Android 4 上安装了那个应用程序。 但是一启动就崩溃了

错误

java.lang.NoSuchMethodError: android.support.v4.app.ActivityCompat.checkSelfPermission

实施

if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)
            == PackageManager.PERMISSION_GRANTED) {
    ...
}

这次崩溃的原因是什么? android-支持的版本-v4.jar? 我的客户说 android-support-v4.jar 包含在构建中。

使用的 Android 支持库的版本未更新。您应该使用最新的更新 jar 文件。