我正在處理我的第一個Android應用程序。這是一個非常簡單的farenheit /攝氏轉換器,我所有的ID,方法和按鈕/文本字段都被完美地複製出來。我三重檢查。 (我正在按照我的教授發佈的視頻中的說明進行操作)。然而,我很難嘗試讓Android Studio運行該應用程序。Android Studio(1.5.1) - 錯誤:無法找到符號類/應用程序無法運行
我發現很多類似這個問題的問題,其中很多人建議同步gradle文件。所以我做了。我仍然得到這些相同的錯誤信息:
這裏是應用信息:
從應用/ RES /佈局/ 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: (我想我是用相對佈局,我不知道這有什麼與我的問題)
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout 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:fitsSystemWindows="true"
tools:context="john.testapplication.TestActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_test" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:src="@android:drawable/ic_dialog_email" />
</android.support.design.widget.CoordinatorLayout>
再次,我是建設從該應用程序視頻我的教練給了我,所以我敢打賭,它與我的Android Studio版本或我的電腦上的設置有關,而不是代碼本身。
我知道'CoordinatorLayout'但沒有'** ** CoordinatorLayout'。 –
打開TestActivity並按照紅色下劃線。你輸入了一切嗎? –
好的...哎呀。我試圖在代碼中粗暴地表達這個詞,我不應該那樣做。這些星號不是問題的一部分,那就是我。我的錯。 –