【问题标题】:Android Studio update (version 1.2.1.1) - Cannot resolve symbol 'TintCheckBox'Android Studio 更新(版本 1.2.1.1) - 无法解析符号“TintCheckBox”
【发布时间】:2015-06-09 09:37:03
【问题描述】:

昨天我更新了我的 Android Studio,更新后我的 SettingsActivity 出现错误

switch (name) {
            case "EditText":
                return new TintEditText(this, attrs);
            case "Spinner":
                return new TintSpinner(this, attrs);
            case "CheckBox":
                return new TintCheckBox(this, attrs);
            case "RadioButton":
                return new TintRadioButton(this, attrs);
            case "CheckedTextView":
                return new TintCheckedTextView(this, attrs);
        }

TintEditText、TintSpinner、TintCheckBox、TintRadioButton 和 TintCheckedTextView 说:'无法解析符号...'

在这些导入语句中

import android.support.v7.internal.widget.TintCheckBox;
import android.support.v7.internal.widget.TintCheckedTextView;
import android.support.v7.internal.widget.TintEditText;
import android.support.v7.internal.widget.TintRadioButton;
import android.support.v7.internal.widget.TintSpinner;

它说“未使用的导入语句”和“无法解析符号...”

其他导入语句,如

import android.support.v7.widget.Toolbar;

工作完美。

我的依赖

compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:support-v4:22.2.0'

在 Android SDK Manager 中,我删除了 Android Support Repository 和 Library 并再次安装,但这并没有帮助。我还进行了干净、重建和 gradle 同步,但还是一样。

我的 Android Studio 版本现在是 1.2.1.1

【问题讨论】:

  • 这些类在 appcompat v22.2 中不存在
  • 那么你在这些课程中使用了什么?
  • 没什么,这是没有使用的类。该代码是几个月前在设置活动中自动生成的。我删除了有错误的行,它起作用了

标签: android android-studio android-support-library


【解决方案1】:

就像 Gabriele Mariotti 所说的这些类在 appcompat v22.2 中不存在 我同时更新了 android-studio 和支持库,所以我认为 android-studio 有一个错误。 我更改了我的代码而不使用这些类,它可以工作

【讨论】:

    【解决方案2】:

    使用AppCompatCheckBox 代替TintCheckBox

    【讨论】:

      猜你喜欢
      • 2015-09-22
      • 2018-11-01
      • 1970-01-01
      • 2018-05-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-06-18
      相关资源
      最近更新 更多