2016-08-05 2 views
0

Я не могу найти его нигде. Я искал более часа, и мне не повезло. Вы видите это?Ошибка: (41) Ошибка синтаксического анализа XML: неверно сформированный (недопустимый токен) + не может разрешить символ R

Я также получаю сообщение об ошибке:

Ошибка: Не удалось завершить выполнение задачи для ': приложение: processDebugResources.

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\danle\AppData\Local\Android\Sdk\build-tools\24.0.0\aapt.exe'' finished with non-zero exit value 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(); 
      } 
     }); 




    } 
} 
+0

Это может быть в Java, вы можете разместить код? –

+0

Я добавил java. Я также получаю, что не может также устранить ошибку символа r. –

+0

вопрос разрешен. thx –

ответ

3

Вы не можете использовать < в XML буквально:

android:text="|<<" 

Попробуйте заменить его с

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

Это исправлено! Благодаря! –

Смежные вопросы

 Смежные вопросы