aniket agarwal
aniket agarwal

Reputation: 13

how can I run my android app?

Unable to run my android app because it runs the image I stored in res/drawable file whenever I click the "run app" application.

I imported an image in the drawable folder of my android project, and then set it as background for main activity, but when I try to run the app instead it displays the image file.

also the following message is displayed in the gradle build.

Error:Execution failed for task ':app:mergeDebugResources'.

C:\Users\USER\AndroidStudioProjects\GoGetIt\app\src\main\res\drawable\GGIMain.jpg: Error: Invalid file name: must contain only lowercase letters and digits ([a-z0-9_.])

This is my activity_main.xml coding

<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/GGIMain">

Upvotes: 1

Views: 69

Answers (3)

Jeeter
Jeeter

Reputation: 6105

The problem is in your naming of the background:

android:background="@drawable/GGIMain">

This filename (and corresponding xml entry) should be renamed to

android:background="@drawable/ggimain">

Upvotes: 0

Stan
Stan

Reputation: 11

Rename your background image so it has only lower case letters. Then adjust your xml accordingly.

See here for naming rules of resources: http://developer.android.com/guide/topics/resources/providing-resources.html

Upvotes: 1

Prabhuraj
Prabhuraj

Reputation: 938

Remove the background.

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"    

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"
">

Upvotes: 0

Related Questions