由于符号无效,构建失败

时间:2014-11-26 08:23:42

标签: android error-handling

enter image description here enter image description here picture shows res/drawables( doesnot contain any "final" image and error shown too added pics for drawable folder enter image description here我的drawables文件夹中有一些图像,其中一个名为" final"。当我运行我的项目时,我得到了以下错误:

Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
C:\android\adt-bundle-windows-x86_64-20140702\sdk\build-tools\android-4.4W\aapt.exe package -f -   -no-crunch -I C:\android\adt-bundle-windows-x86_64-20140702\sdk\platforms\android-20\android.jar -M     C:\Users\SHREYA     BISHT\AndroidStudioProjects\staymax\app\build\intermediates\manifests\full\debug\AndroidManifest.xml -S C:\Users\SHREYA BISHT\AndroidStudioProjects\staymax\app\build\intermediates\res\debug -A C:\Users\SHREYA BISHT\AndroidStudioProjects\staymax\app\build\intermediates\assets\debug -m -J C:\Users\SHREYA BISHT\AndroidStudioProjects\staymax\app\build\generated\source\r\debug -F C:\Users\SHREYA BISHT\AndroidStudioProjects\staymax\app\build\intermediates\res\resources-debug.ap_     --debug-mode --custom-package com.appt.shreyabisht.staymax -0 apk
Error Code:
1
Output:
res\drawable-hdpi-v4\final.jpg:0: error: invalid symbol: 'final'

这是我已经做过的事情: 1.删​​除图像并使用其他名称重新导入,并在我使用图像的xml文件中进行更改。同样的错误。 2.运行invalidate并重新启动。同样的错误 3.干净的项目。同样的错误。

请建议。

activity_main:

<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"
android:background="@drawable/backw"
android:id="@+id/lay">

<TextView android:text="StayMax" android:layout_width="wrap_content"
    android:textSize="30dp"
    android:textStyle="bold"


    android:layout_height="wrap_content"
    android:id="@+id/textView"
    android:layout_centerVertical="true"
    android:layout_centerHorizontal="true" />

<Button
    android:layout_width="80dp"
    android:layout_height="40dp"
    android:text="@string/sign_in"


    android:id="@+id/btn_first"
    android:layout_below="@+id/textView"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="87dp" />

</RelativeLayout>

这是第二页:     

<TextView android:text="@string/title_signin" android:layout_width="wrap_content"
    android:textSize="15dp"
    android:layout_height="44dp"

 />


<Space
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_weight="0.33" />

<LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="horizontal">

    <TextView
        android:layout_width="120dp"
        android:layout_height="wrap_content" />

</LinearLayout>

<LinearLayout
    android:layout_width="wrap_content"
    android:orientation="vertical" android:layout_height="wrap_content">

</LinearLayout>

<EditText
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="@string/user"
    />

<EditText
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="Password :"/>

<Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Sign In"
    android:id="@+id/sign"
    android:layout_gravity="center_horizontal" />


</LinearLayout>

这是第三页:

<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:background="@drawable/backgr"
tools:context="com.appt.shreyabisht.staymax.hotel_home"

>

<TextView android:text="Welcome to Ayaya"
     android:layout_width="wrap_content"

  android:textSize="15dp"

    android:textColor="#FFFFFF"
    android:layout_height="wrap_content"
    android:id="@+id/textView2"
    android:layout_centerHorizontal="true"
    android:layout_gravity="center_horizontal"
    android:layout_weight="0.35" />

<Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/room_service"
    android:textSize="15dp"
    android:id="@+id/btn_service"
    android:layout_toStartOf="@+id/textView2"
    android:layout_marginBottom="104dp"
    android:background="#a1ef7c2d"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true" />

<Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/hotel_amenities"
    android:textSize="15dp"
    android:id="@+id/btn_amn"
    android:background="#a1ef7c2d"
    android:layout_toEndOf="@+id/btn_service"
    android:layout_toStartOf="@+id/button6"
    android:layout_alignTop="@+id/btn_service"
    android:layout_toRightOf="@+id/btn_service" />

<Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/trans"
    android:textSize="15dp"
    android:id="@+id/btn_trans"
    android:background="#a1ef7c2d"
    android:layout_toEndOf="@+id/btn_amn"
    android:layout_alignTop="@+id/btn_amn"
    android:layout_alignParentRight="true"
    android:layout_alignParentEnd="true" />


</RelativeLayout>

接下来的三页,我试图设置标签滚动视图(它们是各种各样的子菜单)

所以第一个子菜单: activity_amn_menu.xml     

<TextView android:text="@string/hello_world" android:layout_width="wrap_content"
    android:layout_height="wrap_content" />

</RelativeLayout>

第二个子菜单: activity_trans_menu.xml

<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="com.appt.shreyabisht.staymax.trans_menu">

<TextView android:text="@string/hello_world" android:layout_width="wrap_content"
    android:layout_height="wrap_content" />

</RelativeLayout>

第三个菜单: activity_service_menu.xml

<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="com.appt.shreyabisht.staymax.service_menu"
>


<Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/dining"
    android:id="@+id/button"
    android:textSize="15dp"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true" />

<Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Laundry"
    android:id="@+id/button2"
    android:textSize="15dp"
    android:layout_alignParentBottom="true"
    android:layout_toRightOf="@+id/button"
    android:layout_toEndOf="@+id/button" />

<Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textSize="15dp"
    android:text="House Keeping"
    android:id="@+id/button3"
    android:layout_alignParentBottom="true"
    android:layout_toRightOf="@+id/button2"
    android:layout_toEndOf="@+id/button2" />
</RelativeLayout>

注意:这个项目一直运行到昨天,今天我决定合并viewpager,以便它们现在可能无法在你的机器上运行。

2 个答案:

答案 0 :(得分:0)

最终是一个Java保留字,您不能像这样命名您的图像,选择其他名称,任何其他名称,但不要选择任何保留字,如静态公开 int 例外,...等。

here中的Java保留字列表。

答案 1 :(得分:0)

@Muhammed感谢您今天的所有帮助。我通过清理项目然后执行无效并重新启动来解决上述问题。我今天早些时候做了这个,但我想我没有执行清理并且一个接一个地重新启动以查看结果。