What if commas are in an Android project directory name?

I make a copy of an Android project that was running well, and ran it, but an error I had never seen before occurred. Let’s find out what happens if there are commas in the directory (folder) name.

How to make a copy of your Android project

While studying app development over the past couple of months, I experienced a lot of errors. This time, another error appeared.

When there are important changes to a project code, I habitually make a copy and start a new project. I’m not sure if this is the best yet, but one good thing is that it gives me peace of mind that I always have my code back at some point in time. If I don’t remember something, looking back at past code will immediately resolve my questions.

To make a copy of a project, once the original project is open in Android Studio, do the following:

Build > Clean Project

In this way, all files created during the build process are deleted, leaving only the net, so the capacity is greatly reduced. Then, copy the entire directory (folder) in your file browser and change it to a different name.

Now you can open the newly created project in Android Studio and continue working. But rather than doing that, I like to even change the project name. Even if the name of the top-level directory of the project is changed, the name of the project does not change. Renaming a project may be a good thing because when you install the app on your device, both past and current versions of the app can coexist on your device.

Therefore, my making a copy of the project results in changing the name of the project.

Renaming Android project

The most important file is app/build.gradle.kts. I’ll name the app Abc Def for convenience. Change it as follows.

applicationId = "com.example.abcdef"
namespace = "com.example.abcdef"

Additionally, edit settings.gradle.kts and app/src/main/res/values/strings.xml. Also take a look at the app/src/main/AndroidManifest.xml file.

You can edit the files you’ve modified so far in an editor other than Android Studio (I often do that).

Now run Android Studio and open the newly created project. There are still more important revisions to be made.

You must change the package name in Android Studio to match the new name (what is called a package in Android Studio appears as a directory in file browser).

In the left Project tab > Drop-down menu: Select Project >  The name of the previous project appears under app/src/main/java/com/example/. To change it to a new name: Right click -> Refactor -> Rename: Enter the new name ie abcdef in the text field.  Select both of Search in comments and strings & Search for text occurrences > Refactor.
The changed path eventually looks as follows:
app/src/main/java/com/example/abcdef

‘app:kspDebugKotlin FAILED’ error occurred!

I’ve changed project names several times, and now I can do it without looking at what I’ve recorded. But unexpectedly, when I ran the app, an error I had never seen before occurred.

> Task :app:kspDebugKotlin FAILED Wrong plugin option format: null, should be plugin:<pluginId>:<optionName>=<value>

It was different from the previous error.
https://hhtt.kr/102903

An error that cannot be resolved by any means

Several attempts were made to resolve this error. I made various efforts while carefully looking at the records I had made when I had changed project names several times before. I lost three hours last night. Is it because I upgraded my Android studio?

Then I suddenly realized.

‘I have the original. The project that is bothering me right now is just a copy. Let’s run the original.’

The original ran well. This means that there was a problem while changing the project name.

I woke up and tried again to figure out what the problem was. I don’t think it’s a big problem since I have the original running fine. But I have to find out the answer. So I lost three hours again today.

Then I suddenly saw the project directory. The project’s top-level directory had a name like this:

basic-android-kotlin-compose-training-aaaaa-app4(bbbbb,room,retrofit)

Did commas cause problems? I looked at all the top-level directory names of other projects. Except for this project, none of the projects had commas in the their directory name. Eventually, I renamed the project as follows.

basic-android-kotlin-compose-training-aaaaa-app4(bbbbb-room-retrofit)

When I ran the app, it ran well.

I lost 6 hours because of the comma!

There were commas in the project’s top-level directory name, but it seemed fine before running the app. Perhaps the compiler or ksp has a problem handling commas.

My PC operating system and Android Studio information are as follows.

* Operating system: Ubuntu 20.04
* Android Studio version:
Android Studio Hedgehog | 2023.1.1
Build #AI-231.9392.1.2311.11076708, built on November 10, 2023

From now on, I will have to be more careful when using symbols or special characters in directory names.

“Commas! How do you make up for my precious 6 hours you stole?”

Leave a Comment