Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/392.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/224.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Android Studio(1.5.1)--错误:找不到symbol类/应用程序赢得';跑不动_Java_Android_Android Studio - Fatal编程技术网

Java Android Studio(1.5.1)--错误:找不到symbol类/应用程序赢得';跑不动

Java Android Studio(1.5.1)--错误:找不到symbol类/应用程序赢得';跑不动,java,android,android-studio,Java,Android,Android Studio,我正在开发我的第一个Android应用程序。这是一个非常简单的farenheit/celsius转换器,我所有的ID、方法和按钮/文本字段都被完美地复制出来。我检查了三遍。(我正在按照教授发布的视频中的说明进行操作。)然而,我很难让Android Studio运行该应用程序。 我发现了很多与此类似的问题,其中许多建议同步gradle文件。所以我做了。我仍然收到这些相同的错误消息: 以下是应用程序信息: 来自app/res/layout/content_test.xml的代码: <?x

我正在开发我的第一个Android应用程序。这是一个非常简单的farenheit/celsius转换器,我所有的ID、方法和按钮/文本字段都被完美地复制出来。我检查了三遍。(我正在按照教授发布的视频中的说明进行操作。)然而,我很难让Android Studio运行该应用程序。

我发现了很多与此类似的问题,其中许多建议同步gradle文件。所以我做了。我仍然收到这些相同的错误消息:


以下是应用程序信息:

来自app/res/layout/content_test.xml的代码:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:context="john.testapplication.TestActivity"
    tools:showIn="@layout/activity_test">

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="numberDecimal"
        android:ems="10"
        android:id="@+id/temperatureEditText"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:hint="Enter Temperature" />

    <RadioGroup
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/temperatureEditText"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:id="@+id/radioGroup">

        <RadioButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="From Celsius to Farenheit"
            android:id="@+id/toFarenheitRadioButton"
            android:checked="false" />

        <RadioButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="From Farenheit to Celsius"
            android:id="@+id/toCelsiusRadioButton"
            android:checked="false" />
    </RadioGroup>

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Convert"
        android:id="@+id/convertButton"
        android:layout_below="@+id/radioGroup"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:onClick="convert" />
</RelativeLayout>

来自app/res/layout/activitytest.xml的代码: (我以为我在使用相对布局,我不知道这是否与我的问题有关)



同样,我是根据我的导师给我的视频构建这个应用程序的,所以我敢打赌它与我的Android Studio版本或计算机上的设置有关,而不是代码本身。

好的,在这个网站上的一些人的帮助下,我找到了一个解决方案。显然,在TestActivity.xml中,我忘了导入以下内容:

import android.widget.EditText;
import android.widget.RadioButton;

一切都搞定了。我以为它已经全部进口了。感谢Eugen Pechanec提供的有用提示。

好的,在这个网站上有人的帮助下,我找到了一个解决方案。显然,在TestActivity.xml中,我忘了导入以下内容:

import android.widget.EditText;
import android.widget.RadioButton;

一切都搞定了。我以为它已经全部进口了。感谢Eugen Pechanec提供的有用提示。

请确保导入了正确的库。 同样,一旦正确导入

initialize radioButtons :
RadioButton rd;
onCreate
方法中:


rd=(RadioButton)findViewById(R.id.RadioButton)

确保导入了正确的库。 同样,一旦正确导入

initialize radioButtons :
RadioButton rd;
onCreate
方法中:


rd=(RadioButton)findViewById(R.id.RadioButton)

我知道
协调布局
但没有
**CoordinatorLayout**
。打开测试活动并遵循红色下划线。你导入了所有内容吗?选择带下划线的单词,按Alt+Enter,你会得到一些选项来修复它。我仍然不知道它修复了什么错误:D为什么不发布描述实际错误及其解决方案的答案?如果你回顾性地发现它“不值得”,你可以删除所有负面声誉的问题. 这只是一个简单的疏忽。我知道
CoordinatorLayout
,但没有
**CoordinatorLayout**
。请打开测试活动并遵循红色下划线。你导入了所有内容吗?选择带下划线的单词,按Alt+Enter,你会得到一些选项来修复它。我仍然不知道它修复了什么错误:D为什么不发布描述实际错误及其解决方案的答案?如果你回顾性地发现它“不值得”,你可以删除所有负面声誉的问题. 这只是一个简单的疏忽。你能澄清一下应该在哪里进行编辑吗?通常,为了使对象在整个活动中都可用,初始化可以在类内部进行。
onCreate
方法将在
活动.class
中提供。您能否澄清应该在哪里进行编辑?通常,为了使对象在整个活动中都可用,可以在类内部进行初始化。
onCreate
方法将在
activity.class
中提供。