1
votes

i have tried lots of things but nothing works...

Android resource compilation failed Output: C:\Users\user\Desktop\NEW android\test1_tp7\app\src\main\res\layout\activity_main.xml:1: error: not well-formed (invalid token). Command: C:\Users\user.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\2aa1a50b275688b3c8017d916765ab19\aapt2-3.2.1-4818971-windows\aapt2.exe compile --legacy \ -o \ C:\Users\user\Desktop\NEW android\test1_tp7\app\build\intermediates\res\merged\debug \ C:\Users\user\Desktop\NEW android\test1_tp7\app\src\main\res\layout\activity_main.xml Daemon: AAPT2 aapt2-3.2.1-4818971-windows Daemon #2

<?xmlversion="1.0"encoding="utf-8"?>

<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <TabWidget android:id="@android:id/tabs"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />

    <FrameLayout android:id="@android:id/tabcontent"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
        <AnalogClock android:id="@+id/tab1"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" />
        <Button android:id="@+id/tab2"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:text="Unboutonpresquealéatoire" />


 </FrameLayout>
</LinearLayout>
</TabHost>

Plus suddenly I can't see my phone device when I run my project. I have tried to download google USB driver, clean project, restart cache but nothing seems to work

enter image description here

2
Can you post that xml code ?Naveen Avidi
This error indicates that your xml file probably contains a typo or a spelling error. Have a look at that file (can just be a missing semicolon) or post the content for us to help.Glains
to show device go to sdk > platform-tools > adb kill-server and adb start-serverkaran
where can i find "sdk" ?user9718332
i guess the platform-tools is missing ?user9718332

2 Answers

4
votes

You are missing space in between ?xml and version, version and encoding in xml declaration. add a space and it should work fine.

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

Please close the tag <TabHost> it will solve your problem

Follow the below code:

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

<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <TabWidget android:id="@android:id/tabs"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />

    <FrameLayout android:id="@android:id/tabcontent"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
        <AnalogClock android:id="@+id/tab1"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" />
        <Button android:id="@+id/tab2"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:text="Unboutonpresquealéatoire" />


 </FrameLayout>
</LinearLayout>
</TabHost>