gpt4 book ai didi

java - 错误:(41) Error parsing XML: not well-formed (invalid token) + cannot resolve the symbol R

转载 作者:行者123 更新时间:2023-12-01 21:23:11 32 4
gpt4 key购买 nike

我到处都找不到它。我已经找了一个多小时了,运气为零。你看到了吗?

我也收到此错误消息:

错误:任务“:app: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();
}
});




}
}

最佳答案

您不能使用< XML 字面上的意思是:

android:text="|<<"

尝试将其替换为

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

关于java - 错误:(41) Error parsing XML: not well-formed (invalid token) + cannot resolve the symbol R,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38798220/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com