Before anyone asks, I have read all of these questions and none of them fixed my issue: [1](https://stackoverflow.com/questions/66952098/the-use-of-safeargs-in-android-studio-is-causing-an-error-and-i-cannot-build-the), [2](https://stackoverflow.com/questions/70937015/android-studio-bumblebee-unable-to-use-safeargs), [3](https://stackoverflow.com/questions/70376213/new-build-gradle-in-android-studio-bumblebee-2021-1-1-beta-5-error-adding-depe), [4](https://stackoverflow.com/questions/67602765/i-was-learning-build-your-first-android-app-see-below-link-and-using-android-s), [5](https://stackoverflow.com/questions/74054576/after-update-my-android-studio-dolphin-2021-3-1-xml-layout-preview-cant-sh), [6](https://stackoverflow.com/questions/71181410/gradle-applying-a-plugin-in-android-studio-safeargs-for-navigationbar).

I am currently learning Android app development and I have been following through the [first tutorial on the Android Developer site](https://developer.android.com/codelabs/build-your-first-android-app-kotlin#8).
I created my project using the "Basic Activity" template (as instructed).  

In step 5 on the page linked above, it says to enable safe args by doing the following:

> 
> Open **Gradle Scripts > build.gradle (Module: My First App)**
> Find the `dependencies` section in the `buildscript` section, and add the following lines after the other classpath entries:  
> 
> `def nav_version = "2.3.0-alpha02"`  
> 
> `classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"`
> 
> 
> Open **Gradle Scripts > build.gradle (Module: app)**
> Just below the other lines that begin with apply plugin add a line to enable SafeArgs:  
> 
> `apply plugin: 'androidx.navigation.safeargs.kotlin'`
> 
> 
> Android Studio should display a message about the Gradle files being changed. Click Sync Now on the right hand side.
> After a few moments, Android Studio should display a message in the Sync tab that it was successful.
> 
> 
> Choose Build > Make Project. This should rebuild everything so that Android Studio can find FirstFragmentDirections.
> 
> 
> 

Unfortunately, the "Basic Activity" template in my version of Android Studio (see below) doesn't seem to be structured in a way that supports the changes in the instructions.

```
Android Studio Dolphin | 2021.3.1 Patch 1
Build #AI-213.7172.25.2113.9123335, built on September 30, 2022
Runtime version: 11.0.13+0-b1751.21-8125866 amd64

```

Firstly, it says to "find the dependencies section in the buildscript section".
In my `build.gradle (:app)` file (I'm not even sure if this is the right file), there is just a top-level dependencies section containing `implementation` entry. Adding a `classpath` entry doesn't seem correct.

Next, it says to add the `apply plugin` entry to my `(Module: app)` file "just below the other lines that begin with `apply plugin`". No such lines exist, which makes be suspect the tutorial is out of date.

---

After a bit of searching, I came to the conclusion that I needed to add safeargs in a different way. In my `build.gradle` project file, I've made it look like so (this is the full file):

```
plugins {
    id 'com.android.application' version '7.3.1' apply false
    id 'com.android.library' version '7.3.1' apply false
    id 'org.jetbrains.kotlin.android' version '1.7.10' apply false
    id 'androidx.navigation.safeargs.kotlin' version '2.5.3' apply false  // I added this
}

```

And the **top** of my `build.gradle` module file looks like this:

```
plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
    id "androidx.navigation.safeargs.kotlin" // I added this
}

```

There are no other changes to the files.

Syncing works fine, but I run into issues when I try to rebuild (even if I clean first).
I find that I always get the error below, after the checkDebugDuplicateClasses check fails:

```
Duplicate class javax.activation.ActivationDataFlavor found in modules jakarta.activation-api-1.2.1 (jakarta.activation:jakarta.activation-api:1.2.1) and javax.activation-1.2.0 (com.sun.activation:javax.activation:1.2.0)
Duplicate class javax.activation.CommandInfo found in modules jakarta.activation-api-1.2.1 (jakarta.activation:jakarta.activation-api:1.2.1) and javax.activation-1.2.0 (com.sun.activation:javax.activation:1.2.0)
Duplicate class javax.activation.CommandInfo$Beans found in modules jakarta.activation-api-1.2.1 (jakarta.activation:jakarta.activation-api:1.2.1) and javax.activation-1.2.0 (com.sun.activation:javax.activation:1.2.0)

[...]

Duplicate class org.xmlpull.v1.XmlPullParser found in the following modules: kxml2-2.3.0 (net.sf.kxml:kxml2:2.3.0), xmlpull-1.1.3.1 (xmlpull:xmlpull:1.1.3.1) and xpp3-1.1.4c (xpp3:xpp3:1.1.4c)
Duplicate class org.xmlpull.v1.XmlPullParserException found in the following modules: kxml2-2.3.0 (net.sf.kxml:kxml2:2.3.0), xmlpull-1.1.3.1 (xmlpull:xmlpull:1.1.3.1) and xpp3-1.1.4c (xpp3:xpp3:1.1.4c)
Duplicate class org.xmlpull.v1.XmlPullParserFactory found in the following modules: kxml2-2.3.0 (net.sf.kxml:kxml2:2.3.0), xmlpull-1.1.3.1 (xmlpull:xmlpull:1.1.3.1) and xpp3-1.1.4c (xpp3:xpp3:1.1.4c)
Duplicate class org.xmlpull.v1.XmlSerializer found in the following modules: kxml2-2.3.0 (net.sf.kxml:kxml2:2.3.0), xmlpull-1.1.3.1 (xmlpull:xmlpull:1.1.3.1) and xpp3-1.1.4c (xpp3:xpp3:1.1.4c)

Go to the documentation to learn how to Fix dependency resolution errors.

```

It is unclear what needs to be done from here. I am unable to run the app in the emulator at all because the build completely fails. Any suggestions would be appreciated.