错误:(41)解析XML时出错:格式不正确(无效的令牌)+无法解析符号R

丹尼·希金斯

我在任何地方都找不到。我已经寻找了一个多小时,现在运气为零。你看到了吗?

我也收到此错误消息:

错误:任务':app:processDebugResources'的执行失败。

com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:处理'command'C:\ Users \ danle \ AppData \ Local \ Android \ Sdk \ build-tools \ 24.0.0 \ aapt .exe''以非零退出值1结束

<?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.example.musicplayer.MainActivity">

    <TextView android:text="@string/music_player"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/textview"
        android:textSize="35sp"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/dana_higz"
        android:id="@+id/textView"
        android:layout_below="@+id/textview"
        android:layout_centerHorizontal="true"
        android:textColor="#ff7aff24"
        android:textSize="35sp" />

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/imageView"
        android:layout_below="@+id/textView"
        android:layout_centerHorizontal="true"
        android:src="@drawable/abc"
        android:contentDescription="@string/player_icon" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="|<<"
        android:id="@+id/reset"
        android:layout_centerInParent="true"
        android:layout_alignParentBottom="true"
        android:layout_toLeftOf="@+id/play"

        />


    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text=">>"
        android:id="@+id/play"
        android:layout_centerInParent="true"
        android:layout_alignParentBottom="true"

        />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="||"
        android:id="@+id/pause"
        android:layout_centerInParent="true"
        android:layout_toRightOf="@+id/play"
        android:layout_alignParentBottom="true"
         />



</RelativeLayout>








package com.example.musicplayer;

import android.media.MediaPlayer;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;

public class MainActivity extends AppCompatActivity {

    MediaPlayer mediaPlayer;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        mediaPlayer = MediaPlayer.create(this, R.raw.gorillaz);

        Button play = (Button) findViewById(R.id.play);
        play.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                mediaPlayer.start();
            }
        });

        Button pause = (Button) findViewById(R.id.pause);
        pause.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mediaPlayer.pause();
            }
        });

        Button reset = (Button) findViewById(R.id.reset);
        reset.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mediaPlayer.reset();
            }
        });




    }
}
疾病

您不能<从字面上使用XML:

android:text="|<<"

尝试将其替换为

android:text="|&lt;&lt;"

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

无法解析符号R.raw

Android-无法解析符号“ R”

Android Studio 2.1无法解析符号“ R”

Android Studio:无法解析符号“ R”

使用GPXPY解析gpx文件会导致格式不正确的无效令牌错误

错误:(3)解析XML错误:格式不正确(无效的令牌)

osm2pgrouting-解析格式不正确的数据(无效的令牌)

Android Studio解析XML错误:格式不正确(无效令牌)

当我期望JSON时,出现“ XML解析错误:格式不正确”

Android XML解析错误(无效令牌,格式不正确)

XML解析错误:<id>元素的格式不正确(无效令牌)

XML解析错误:格式不正确

xml解析问题:格式不正确(无效的令牌)

XML解析错误:格式不正确,MasterPage asp.net

Android Studio(1.1.0):-无法解析符号“ R”

尝试了解决方案,但没有解决错误:解析XML错误:格式不正确(无效的令牌)

错误解析XML:格式不正确(无效令牌)

无法解析符号R Android DialogFragment

XML文件错误-Android(解析XML错误:格式不正确(无效的令牌))

安卓。Gradle构建错误:解析XML错误:格式不正确(无效的令牌)

为什么我无法解析符号“ R”?

解析XML时出错:格式不正确(无效的令牌),而XML恰好很好

错误:(45) 解析 XML 时出错:格式不正确(令牌无效)因为按钮“<<”

Jquery 加载函数在 firefox 中抛出“XML 解析错误:格式不正确”错误

无法解析符号 R?

Android Studio:错误:无效的恶魔和“R”符号无法解析

错误“无法解析符号 R”

Xamarin 解析 XML 时出错:格式不正确(令牌无效)

源代码文件无法解析符号“R”