AppCompatActivity.onCreate只能从同一库组中调用 [英] AppCompatActivity.onCreate can only be called from within the same library group

查看:182
本文介绍了AppCompatActivity.onCreate只能从同一库组中调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

升级到appcompat 25.1.0 后,我开始收到有线错误。

After upgrading to appcompat 25.1.0 I've started getting wired errors.

在我的代码中:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

我收到棉绒错误:

AppCompatActivity.onCreate只能从同一库组(groupId = com.android.support)内调用

如何防止这种行为?

推荐答案

正如Felipe在他的评论,这是一个错误在工具的预发布版本中。

As Felipe already pointed out in his comment this is a bug in the pre-release version of the tools.

您可以暂时解决该问题,直到Google发布修复程序为止,方法是在项目模块的build.gradle文件中添加以下内容:

You can workaround it for now, until Google release a fix, by adding the following into your project module's build.gradle file:

android {
  lintOptions {
    disable 'RestrictedApi'
  }
}

值得注意的是,这可能会在您的项目中隐藏真正的错误会消除该类型的所有错误,因此更好的选择是将Android Studio的版本和项目中使用的工具降级。

It's worth noting that this may hide true errors in your project as it suppresses all errors of that type, so the better option would be to downgrade the version of Android Studio and the tools used in the project.

这篇关于AppCompatActivity.onCreate只能从同一库组中调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆