我正在關注下載android studio的一個課程以及如何設置它,我已經爲我的手機下載了正確的驅動程序,但是當我嘗試運行我的Hello World程序時,我遇到了問題。無法運行Hello world
請記住,課程本身建議我更新名爲activity_main.xml的文件。這是該文件以前的內容:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
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:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.udacity.myapplication.MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintLeft_toLeftOf="@+id/activity_main"
app:layout_constraintTop_toTopOf="@+id/activity_main"
app:layout_constraintRight_toRightOf="@+id/activity_main"
app:layout_constraintBottom_toBottomOf="@+id/activity_main" />
</android.support.constraint.ConstraintLayout>
這段代碼必須更新以與視頻保持一致。新段:
<?xml version="1.0" encoding="utf-8"?>
<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:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.udacity.myapplication.MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!" />
</RelativeLayout>
當我嘗試我的手機在這裏運行的應用程序是我所得到的:
Error:(7, 28) No resource found that matches the given name (at ‘paddingBottom’ with value ‘@dimen/activity_vertical_margin’).
Error:(8, 26) No resource found that matches the given name (at ‘paddingLeft’ with value ‘@dimen/activity_horizontal_margin’).
Error:(9, 27) No resource found that matches the given name (at ‘paddingRight’ with value ‘@dimen/activity_horizontal_margin’).
Error:(10, 25) No resource found that matches the given name (at ‘paddingTop’ with value ‘@dimen/activity_vertical_margin’).
Error:Execution failed for task ‘:app:processDebugResources’.
任何幫助嗎?
,你有 * 5dp 1dp *? –
yasin