Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/209.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
如何运行我的android应用程序?_Android - Fatal编程技术网

如何运行我的android应用程序?

如何运行我的android应用程序?,android,Android,无法运行我的android应用程序,因为每当我单击“运行应用程序”应用程序时,它都会运行我存储在res/drawable文件中的图像 我在android项目的drawable文件夹中导入了一个图像,然后将其设置为主要活动的背景,但当我尝试运行应用程序时,它会显示图像文件 此外,gradle版本中将显示以下消息 错误:任务“:app:mergeDebugResources”的执行失败 C:\Users\USER\AndroidStudioProjects\GoGetIt\app\src\main\

无法运行我的android应用程序,因为每当我单击“运行应用程序”应用程序时,它都会运行我存储在res/drawable文件中的图像

我在android项目的drawable文件夹中导入了一个图像,然后将其设置为主要活动的背景,但当我尝试运行应用程序时,它会显示图像文件

此外,gradle版本中将显示以下消息

错误:任务“:app:mergeDebugResources”的执行失败

C:\Users\USER\AndroidStudioProjects\GoGetIt\app\src\main\res\drawable\GGIMain.jpg:错误:无效文件名:只能包含小写字母和数字([a-z0-9.]))

这是我的活动_main.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=".MainActivity"
android:background="@drawable/GGIMain">

删除背景

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

重命名背景图像,使其仅包含小写字母。然后相应地调整xml


有关资源的命名规则,请参见此处:

问题在于您对背景的命名:

android:background="@drawable/GGIMain">
此文件名(以及相应的xml条目)应重命名为

android:background="@drawable/ggimain">

运行图像是什么意思?在运行代码之前对其进行分析是正常的。如果图像不存在或命名不正确,您将无法运行应用程序。什么?你的问题是什么?你是说无论何时运行应用程序,它都会显示存储在可绘图文件夹中的图像GGIMain?如果是这样的话,它应该是这样的。刚刚编辑了这个问题,请看。@Anikatagarwal下面的答案解决了你的问题吗?但是先生,我想添加背景。