2017-09-03 2 views
0

Ich habe nicht dieses spezielle Projekt für ca. 3 Monate geöffnet, aber wenn ich eine signierte APK-Datei zu erzeugen versucht, ich diesen einen Fehler nur:Android XML-Fehler während unterzeichnet APK-Datei zu erzeugen

C:\app\src\main\res\layout\fragment_newanswers.xml:57: Error: The id "linearLayout2" is not defined anywhere. [UnknownId] 
       android:layout_alignTop="@+id/linearLayout2" 

Hier ist meine aktuellen Code in dieser xML-Datei:

<TextView 
     android:text="OptionView" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/txtOptionTitle" 
     android:textSize="24sp" 
     android:textAlignment="center" /> 

    <LinearLayout 
     android:orientation="vertical" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/txtOptionTitle" 
     android:layout_alignParentStart="false" 
     android:layout_alignParentBottom="false"> 
<!-- 
     <TextView 
      android:text="QuestionView" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:id="@+id/txtQuestionTitle" 
      android:textAlignment="center" 
      android:textSize="18sp" /> 
--> 
     <com.rokonoid.widget.ExpandableTextView 
      android:id="@+id/txtQuestionTitle" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:textSize="18sp" /> 

     <RelativeLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent"> 

      <com.bozapro.circularsliderrange.CircularSliderRange 
       android:id="@+id/cirAns" 
       android:layout_width="wrap_content" 
       android:layout_height="343dp" 
       circular:start_angle="270" 
       circular:end_angle="300" 
       circular:start_thumb_size="0dp" 
       android:paddingLeft="75dp" 
       android:paddingRight="75dp" /> 

      <TextView 
       android:text="5%" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_alignTop="@+id/linearLayout2" 
       android:layout_centerHorizontal="true" 
       android:id="@+id/txtPercent" 
       android:textAlignment="center" 
       android:textSize="36sp" 
       android:layout_marginTop="150dp" /> 
     </RelativeLayout> 

     <LinearLayout 
      android:orientation="horizontal" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent"> 

      <Button 
       android:text="Back" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:id="@+id/btnQnsBack" 
       android:layout_weight="1" /> 

      <Button 
       android:text="Next" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:id="@+id/btnQnsNext" 
       android:layout_weight="1" /> 
     </LinearLayout> 

    </LinearLayout> 

</RelativeLayout> 

das lustige daran ist, es mehrere Male zuvor, und ich arbeitete hat überhaupt keine Änderungen vorgenommen. Ich kann es auch neu aufbauen und säubern es ohne Fehler bauen. Merkwürdig ist, dass die meine Backup-Versionen identisch sind, erzeugen diese ONE gleichen Fehler für meine 6 verschiedene XML-Dateien hier:

Error:(5) Error: Suspicious namespace and prefix combination [NamespaceTypo] 

Es weist auf dieser Linie in jeder der 6 Dateien:

xmlns:app="http://schemas.android.com/tools" 

Meine Vermutung Ich rufe nicht etwas in der MainActivity an (aber das würde nicht erklären, warum es immer funktioniert hat - mit voll funktionsfähigem .apk) Irgendwelche Gedanken?

Vielen Dank! James

+0

das Problem hier ist, dass Sie nicht über ein Layout mit id ‚linearLayout2‘, aber sie versuchen, darauf zuzugreifen. Versuchen Sie, android: layout_alignTop = "@ + id/linearLayout2" aus Ihrer Textansicht –

Antwort

0

Entfernen Sie diese Zeile

android:layout_alignTop="@+id/linearLayout2" 

Von

<TextView 
      android:text="5%" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_alignTop="@+id/linearLayout2" 
      android:layout_centerHorizontal="true" 
      android:id="@+id/txtPercent" 
      android:textAlignment="center" 
      android:textSize="36sp" 
      android:layout_marginTop="150dp" /> 

Da ich kein Layout mit id linearLayout2 in der Datei oben zu sehen. Fehler dieser Art werden nicht im Debug-Build, sondern im realease-Build generiert.

+0

Vielen Dank Mate! Es funktionierte! – solodeveloper

+0

Gut zu wissen. Plz markieren die Antwort als richtig, so dass es auch für andere hilfreich sein kann. Auch plz upvote die Antwort. Danke –

0

Als @Malik Ahhsan sagte, entfernen Sie einfach die android:layout_alignTop="@+id/linearLayout2"

+0

Perfekte Jungs! Es hat tatsächlich funktioniert. Einfach entfernen. Ich weiß nicht, warum es in erster Linie während der .apk-Generation hinzugefügt wurde. – solodeveloper

+0

@solodeveloper Viel Glück mein Freund :) – Shareefoo

Verwandte Themen