Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle > Task :app:generateSafeArgsDebug FAILED

Tags:

android

gradle

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

like image 578
morteza jafari Avatar asked Jul 01 '19 10:07

morteza jafari


3 Answers

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.

like image 168
Victor Benetatos Avatar answered Sep 30 '22 17:09

Victor Benetatos


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.

like image 21
Wiwat Fongkan Avatar answered Sep 30 '22 16:09

Wiwat Fongkan


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>
like image 31
Abdulsalam Opeyemi Avatar answered Sep 30 '22 18:09

Abdulsalam Opeyemi