无法在android studio Gradle中编译项目:无效符号:'switch'

use*_*670 6 debugging android uiswitch

我正在使用Android studio来编译项目.Project min SDK为14,目标为17.

我正在使用此代码.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin"
    tools:context=".MainActivity">


        <Switch
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="New Switch"
            android:id="@+id/switch" android:layout_alignBottom="@+id/button3" android:layout_toRightOf="@+id/button3"
            android:layout_marginLeft="44dp"/>


</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

Tho*_*15v 13

如果您将交换机的ID更改为"@ + id/switch"之外的其他内容,则可以解决此错误.例如:

 <Switch
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="New Switch"
            android:id="@+id/Switch"
            android:layout_below="@+id/Switch"
            android:layout_alignLeft="@+id/Switch"/>
Run Code Online (Sandbox Code Playgroud)

将是一个有效的开关.

来源:https://code.google.com/p/android/issues/detail?id = 55720