morteza jafari
morteza jafari

Reputation: 270

Gradle > Task :app:generateSafeArgsDebug FAILED

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.

gradle build

Upvotes: 22

Views: 7056

Answers (6)

M_droid
M_droid

Reputation: 2788

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.

Upvotes: 1

Abdulsalam Opeyemi
Abdulsalam Opeyemi

Reputation: 983

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>

Upvotes: 1

Victor Benetatos
Victor Benetatos

Reputation: 416

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.

Upvotes: 24

Wiwat Fongkan
Wiwat Fongkan

Reputation: 66

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.

Upvotes: 5

Martin Zeitler
Martin Zeitler

Reputation: 76699

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.

Upvotes: 0

alx_gord
alx_gord

Reputation: 180

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.

Upvotes: 0

Related Questions