22

I have a kotlin project and i used Navigation component. in my local machine i can use gradle build and it's work ok. but in my remote ubuntu when i call gradle build i get this message can anyone help me

root@sarvdata:/home/test2/WooShop# gradle build Task :app:generateSafeArgsDebug FAILED

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':app:generateSafeArgsDebug'.

    org.xmlpull.v1.XmlPullParserException: only whitespace content allowed before start tag and not \u0 (position: START_DOCUMENT seen \u0... @1:1)

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

gradle build

morteza jafari
  • 270
  • 2
  • 12

6 Answers6

22

Got the same error. Did a search with grep -r "\x00" app/src/main/res and a app/src/main/res/navigation/.DS_Store file came up. Deleted it and everything played out.

Victor Benetatos
  • 396
  • 3
  • 12
5

I have this problem in Android Project with Navigation component and I have navigation dir with empty navigation xml file just remove navigation dir and rebuild then I can build.

1

I had the same error, after proper checking, I realized there was an error in my navigation graph's code. The error was gone after correctly formatting and correcting the error. I suggest you check your navigation graph's code for any misspellings or errors and if you are not using navigation then delete the graph entirely. The error is shown below.

WRONG:

 <fragment
        android:id="@+id/SecondFragment"
        android:name="com.example.opeyemiabdulsalam.carowners.CarOwnersFragment"
        android:label="@string/second_fragment_label"
        tools:layout="@layout/car_owners_list">

        <action
            android:id="@+id/action_SecondFragment_to_FirstFragment"
            app:destination="@id/FirstFragment" />
        <argument
            android:name="filterValue"
            app:argType="com.example.opeyemiabdulsalam.data.Filter"
            <!--            app:popEnterAnim="@anim/slide_in_left"-->
            pop
                app:popExitAnim="@anim/slide_out_right"/>
        </fragment>

RIGHT:

<fragment
    android:id="@+id/SecondFragment"
    android:name="com.example.opeyemiabdulsalam.carowners.CarOwnersFragment"
    android:label="@string/second_fragment_label"
    tools:layout="@layout/car_owners_list">

    <action
        android:id="@+id/action_SecondFragment_to_FirstFragment"
        app:destination="@id/FirstFragment" />
    <argument
        android:name="filterValue"
        app:argType="com.example.opeyemiabdulsalam.data.Filter"
        app:popEnterAnim="@anim/slide_in_left"
        app:popExitAnim="@anim/slide_out_right"/>
</fragment>
0

I faced the same problem. Trying to find xml file with this character but I think its generated by Safe Args gradle plugin. Solved problem by creating empty Android project and copied existing code and resources into this.

alx_gord
  • 181
  • 1
  • 6
  • I solved it by deleting the project and downloading it again from vc, but i still wouldnt consider that as a solution. – Nanoc Jul 09 '19 at 07:42
0

something starting with \u0 seems the be escaped Unicode ...so this might be an encoding issue. searching XML files for string \u0 should locate the problematic file and shed some light on the actual cause.

Martin Zeitler
  • 1
  • 19
  • 155
  • 216
0

I had a similar problem with the additional message:

simplenames must not contain empty items: []

Came out that I forgot to add some value to app:argType="" inside my nav_graph_xml_file

Check your Navigation Graph file like @Abdulsalam Opeyemi mentioned above.

M_droid
  • 2,447
  • 2
  • 25
  • 35