Execution failed for task ':app:mergeDebugResources'.

  • Antworten:8
  • Bentwortet
BrotherJ
  • Forum-Beiträge: 10

25.01.2019, 17:33:29 via Website

Hallo,

ich habe folgende Ressourcen-Datei unter Layout liegen. Android Studio zeigt "LinearLayout" in Rot an. Und ein Build liefert

Execution failed for task ':app:mergeDebugResources'.

/home/brotherj/AndroidStudioProjects/FragmentDemo3/app/src/main/res/values-land/fragmentdemo3.xml:
Error: Unsupported type 'fragment'
/home/brotherj/AndroidStudioProjects/FragmentDemo3/app/src/main/res/values/fragmentdemo3.xml:
Error: Unsupported type 'fragment'

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http_:_//_schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal">

    <fragment
        android:id="@+id/auswahl"
        class="com.example.fragmentdemo3.AuswahlFragment"
        android:layout_width="0px"
        android:layout_height="match_parent"
        android:layout_weight="1" />

    <FrameLayout
        android:id="@+id/details"
        android:layout_width="0px"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:background="?android:attr/detailsElementBackground" />

</LinearLayout>

Was läuft da schief?

Grüße
BrotherJ

Kommentieren
Beste Antwort
Jokel
  • Forum-Beiträge: 1.530

25.01.2019, 18:18:38 via Website

Hallo
das gehört nicht in die XML Datei

class="com.example.fragmentdemo3.AuswahlFragment"

solange in deinem Layout was rot ist brauchst du gar kein Build Versuch starten der wird nicht laufen.

Hilfreich?
BrotherJ
Kommentieren
BrotherJ
  • Forum-Beiträge: 10

25.01.2019, 19:17:29 via Website

Erstmal Danke für den Hinweis. Aber das LinearLayout-Tag bleibt nach wie vor rot, auch wenn den besagten Teil rausnehme.

Hilfreich?
Kommentieren
Jokel
  • Forum-Beiträge: 1.530

25.01.2019, 19:32:07 via Website

Sorry post war falsch

— geändert am 25.01.2019, 20:00:23

Hilfreich?
Kommentieren
Jokel
  • Forum-Beiträge: 1.530

25.01.2019, 20:12:02 via Website

bei dem schema bitte die lehrzeichen etfernnen.

    <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:orientation="horizontal">

<fragment
    android:id="@+id/auswahl"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="1" />

android:id="@+id/details"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="?android:attr/detailsElementBackground" />

</LinearLayout>

— geändert am 25.01.2019, 20:12:33

Hilfreich?
Kommentieren
BrotherJ
  • Forum-Beiträge: 10

26.01.2019, 09:52:44 via Website

Zu den Leerzeichen im Schema sage ich so viel, dass diese in der IDE nicht enthalten sind. Diese Plattform lässt bei mir als Neumitglied keine eindeutigen Links zu, deshalb die Leerzeichen.
Die Datei "fragmentDemo3.xml" befindet sich in
"www. rheinwerk-verlag. de/android-8_4564/"
Kapitel 4 im Verzeichnis FragmentDemo3. Seltsamerweise hat der Autor in seinem Buch ebenfalls das von Dir bemerkte

class="com.thomaskuenneth.fragmentdemo3.AuswahlFragment"

in der Values-Ressource an besagter Stelle im Code abgedruckt.

Mich irritiert, dass in den beiden Dateien fragmentDemo3.xml einmal in "values" und einmal in "values-land" die Root-Elemente " beide in Rot als Fehler deklariert sind. Allenfalls finde ich obige Fehlermeldung in den Logs und als Tooltip "Element FrameLayout must to be declared".

So wäre die Situation ein bisschen besser erklärt als gestern Abend.

— geändert am 26.01.2019, 09:54:51

Hilfreich?
Kommentieren
BrotherJ
  • Forum-Beiträge: 10

26.01.2019, 10:11:16 via Website

Wenn ich in Android Studio die Resourcen-Datei anlege und tippe diesen Code

<?xml version="1.0" encoding="utf-8"?>
<L

ein, dann wird beim Tippen bereits das "L" oder "F" rot.
Irgendetwas stimmt da nicht.

Hilfreich?
Kommentieren
Jokel
  • Forum-Beiträge: 1.530

26.01.2019, 15:35:38 via Website

Also ich habe deinen Code bei mir im Studio eingegeben und es wird nichts rot.

Erstelle mal ein neues Project ist es da auch so . Würde ich auf das Studio tippen vielleicht neu Installieren.

— geändert am 26.01.2019, 15:38:19

Hilfreich?
Kommentieren
BrotherJ
  • Forum-Beiträge: 10

26.01.2019, 17:39:48 via Website

Ich dachte so etwas auch bereits. Das nächste Projekt lässt sich bereits problemlos eingeben.

Hilfreich?
Kommentieren