# Android: "INSTALL\_FAILED\_UID\_CHANGED" issue still present if function names have spaces

**URL:** <https://discuss.kotlinlang.org/t/android-install-failed-uid-changed-issue-still-present-if-function-names-have-spaces/40>\
**Category:** Uncategorized\
**Created:** [October 31, 2015, 1:31am UTC](https://discuss.kotlinlang.org/t/android-install-failed-uid-changed-issue-still-present-if-function-names-have-spaces/40 "2015-10-31T01:31:57Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomjb](https://avatars.discourse-cdn.com/v4/letter/t/76d3ee/32.png) [@tomjb](https://discuss.kotlinlang.org/u/tomjb)\
**Post date:** [October 31, 2015, 1:31am UTC](https://discuss.kotlinlang.org/t/android-install-failed-uid-changed-issue-still-present-if-function-names-have-spaces/40/1 "2015-10-31T01:31:57Z")

</div>

Running Android Studio 1.4.1 with Kotlin plugin 1.0.0-beta-1103.

If I create a new project, convert MainActivity.java to Kotlin, enable Kotlin, and then add the following code, this problem (which was fixed in 1.0.0-beta-1103) happens once again:

&nbsp;

```kotlin
fun ` `() {

```

  

Now, when trying to run on my device (Sony Xperia M, running Android 4.1.2), I get this:

```kotlin
Installing com.example.kotlin
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/com.example.kotlin"
     pkg: /data/local/tmp/com.example.kotlin
Failure [INSTALL_FAILED_UID_CHANGED]

DEVICE SHELL COMMAND: pm uninstall com.example.kotlin
Unknown failure
```

Note that removing the space-name function does _not_ resolve this.&nbsp;&nbsp;Once this issue has occurred, it doesn’t seem to go away.

---

<div class="post-metadata">

**Author:** ![mikehearn](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/mikehearn/32/1424_2.png) [@mikehearn](https://discuss.kotlinlang.org/u/mikehearn)\
**Post date:** [November 2, 2015, 12:06pm UTC](https://discuss.kotlinlang.org/t/android-install-failed-uid-changed-issue-still-present-if-function-names-have-spaces/40/2 "2015-11-02T12:06:56Z")

</div>

Wait. You can create a function that has _whitespace_ as its name?

Surely that is a bug.

---

<div class="post-metadata">

**Author:** ![tomjb](https://avatars.discourse-cdn.com/v4/letter/t/76d3ee/32.png) [@tomjb](https://discuss.kotlinlang.org/u/tomjb)\
**Post date:** [November 2, 2015, 12:34pm UTC](https://discuss.kotlinlang.org/t/android-install-failed-uid-changed-issue-still-present-if-function-names-have-spaces/40/3 "2015-11-02T12:34:52Z")

</div>

For more info, this Android issue seems to occur whenever a function has ' ' in its name.&nbsp;&nbsp;For example, the following also triggers it:

```kotlin

```

Once this occurs, removing the function (which isn’t enough to fix this problem) and choosing Build \> Clean Project fails with the following error:

```kotlin
Executing tasks: [clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:compileDebugSources, :app:compileDebugAndroidTestSources]

Configuration on demand is an incubating feature.
:clean UP-TO-DATE
:app:clean FAILED
FAILURE: Build failed with an exception.

What went wrong:
Execution failed for task ‘:app:clean’.
> Unable to delete file: C:Testappbuildintermediatesexploded-aarcom.android.supportappcompat-v723.0.1jarsclasses.jar

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

BUILD FAILED
Total time: 2.813 secs
```

So, once this issue has occurred, everything seems to fall apart, and I’m not sure how to fix it.

---

<div class="post-metadata">

**Author:** ![udalov](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/udalov/32/5679_2.png) [@udalov](https://discuss.kotlinlang.org/u/udalov)\
**Post date:** [November 2, 2015, 12:43pm UTC](https://discuss.kotlinlang.org/t/android-install-failed-uid-changed-issue-still-present-if-function-names-have-spaces/40/4 "2015-11-02T12:43:13Z")

</div>

This is not a bug, whitespaces in names are supported by the VM and are very helpful e.g. in tests vs camel case:

```
@Test fun `test that this thing goes here and that goes there`() {

&nbsp;&nbsp;... }
```

---

<div class="post-metadata">

**Author:** ![mikehearn](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/mikehearn/32/1424_2.png) [@mikehearn](https://discuss.kotlinlang.org/u/mikehearn)\
**Post date:** [November 2, 2015, 3:32pm UTC](https://discuss.kotlinlang.org/t/android-install-failed-uid-changed-issue-still-present-if-function-names-have-spaces/40/5 "2015-11-02T15:32:05Z")

</div>

My mind is boggling right now. Surely the assumption that methods don't have spaces in their names is hard-coded at a very deep level in all kinds of software? I can't imagine this working well with the wider ecosystem of tools.

---

<div class="post-metadata">

**Author:** ![yole](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/yole/32/1425_2.png) [@yole](https://discuss.kotlinlang.org/u/yole)\
**Post date:** [November 2, 2015, 4:17pm UTC](https://discuss.kotlinlang.org/t/android-install-failed-uid-changed-issue-still-present-if-function-names-have-spaces/40/6 "2015-11-02T16:17:17Z")

</div>

If the Android toolchain doesn't support spaces in method names, then there is nothing the Kotlin team could do to fix that, other than highligthting such methods as errors and thus preventing the possibility of using them in environments where spaces work fine.

---

<div class="post-metadata">

**Author:** ![tomjb](https://avatars.discourse-cdn.com/v4/letter/t/76d3ee/32.png) [@tomjb](https://discuss.kotlinlang.org/u/tomjb)\
**Post date:** [November 2, 2015, 6:20pm UTC](https://discuss.kotlinlang.org/t/android-install-failed-uid-changed-issue-still-present-if-function-names-have-spaces/40/7 "2015-11-02T18:20:55Z")

</div>

This seems to be a big problem for Android development, a platform Kotlin explicitly supports (from today's blog post: "We are extremely pleased to present Kotlin 1.0 Beta for JVM and Android!").

It’s not like this users can simply remove the space-name function – as far as I can see, the project is broken from that moment on.

Is the team really willing to release 1.0 with this issue in place? I think anyone new to Kotlin who stumbled upon this issue would drop Kotlin in an instant. (I’m assuming the problem goes away when Kotlin is removed from the project, but I’m not even sure of that, and I can’t check right now.)

---

<div class="post-metadata">

**Author:** ![cy6erGn0m](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/cy6ergn0m/32/1439_2.png) [@cy6erGn0m](https://discuss.kotlinlang.org/u/cy6erGn0m)\
**Post date:** [November 2, 2015, 6:36pm UTC](https://discuss.kotlinlang.org/t/android-install-failed-uid-changed-issue-still-present-if-function-names-have-spaces/40/8 "2015-11-02T18:36:10Z")

</div>

It is common practice in other languages such as Scala and Groovy to use spaces in test function names so it's definitly not a bug

---

<div class="post-metadata">

**Author:** ![yole](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/yole/32/1425_2.png) [@yole](https://discuss.kotlinlang.org/u/yole)\
**Post date:** [November 2, 2015, 6:45pm UTC](https://discuss.kotlinlang.org/t/android-install-failed-uid-changed-issue-still-present-if-function-names-have-spaces/40/9 "2015-11-02T18:45:39Z")

</div>

The project getting stuck in a broken state is a bug that we're definitely going to investigate and fix if it really exists. It's also fairly likely that we'll be able to provide additional&nbsp;&nbsp;diagnostics if we detect that a project with names containing bad characters is being&nbsp;&nbsp;compiled for Android, so that the user would see a clear error from the&nbsp;&nbsp;compiler instead of a cryptic one from the runtime.

As for the possibility to use spaces in method names, I really don’t see why this is so necessary for Android development, and why someone would drop Kotlin in an instant if they discovered that they don’t have this possibility.

---

<div class="post-metadata">

**Author:** ![tomjb](https://avatars.discourse-cdn.com/v4/letter/t/76d3ee/32.png) [@tomjb](https://discuss.kotlinlang.org/u/tomjb)\
**Post date:** [November 2, 2015, 6:48pm UTC](https://discuss.kotlinlang.org/t/android-install-failed-uid-changed-issue-still-present-if-function-names-have-spaces/40/10 "2015-11-02T18:48:07Z")

</div>

I meant that they would drop Kotlin if they encountered this error and ended up with a broken project.

Glad to hear this is going to be investigated.

---

<div class="post-metadata">

**Author:** ![cedricbeust](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/cedricbeust/32/1429_2.png) [@cedricbeust](https://discuss.kotlinlang.org/u/cedricbeust)\
**Post date:** [November 2, 2015, 7:15pm UTC](https://discuss.kotlinlang.org/t/android-install-failed-uid-changed-issue-still-present-if-function-names-have-spaces/40/11 "2015-11-02T19:15:21Z")

</div>

Dmitry,

There are a lot of intermediate steps in the Android build process, most of which are not under the developer’s control. It’s quite possible that some of these steps might be generating methods with spaces in them, and even if it’s not the case today, it might be the case in the future.

I strongly suggest making sure this works fine before shipping 1.0, it will be a big let down in the Android community otherwise, especially after years of Kotlin working fine on Android.

---

<div class="post-metadata">

**Author:** ![Dittert](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/dittert/32/1736_2.png) [@Dittert](https://discuss.kotlinlang.org/u/Dittert)\
**Post date:** [November 2, 2015, 9:30pm UTC](https://discuss.kotlinlang.org/t/android-install-failed-uid-changed-issue-still-present-if-function-names-have-spaces/40/12 "2015-11-02T21:30:16Z")

</div>

There really isn't anything that Kotlin can do about this. For example, Groovy also allows spaces in method names and a library that contains such a name will also break your Android build. The only solution is not to use white spaces in method names if you plan on targeting Android.

On a side note, ` ` seems like a rather peculiar method name to me…

---

<div class="post-metadata">

**Author:** ![tomjb](https://avatars.discourse-cdn.com/v4/letter/t/76d3ee/32.png) [@tomjb](https://discuss.kotlinlang.org/u/tomjb)\
**Post date:** [November 3, 2015, 8:01am UTC](https://discuss.kotlinlang.org/t/android-install-failed-uid-changed-issue-still-present-if-function-names-have-spaces/40/13 "2015-11-03T08:01:43Z")

</div>

I don't feel that this comment addresses the real issue — once a function with a space in its name has been defined and a build is attempted, the build is broken **from that moment on**.&nbsp;&nbsp;Even after a code revert, building fails.

---

<div class="post-metadata">

**Author:** ![slash2314](https://avatars.discourse-cdn.com/v4/letter/s/b5e925/32.png) [@slash2314](https://discuss.kotlinlang.org/u/slash2314)\
**Post date:** [November 9, 2015, 11:38pm UTC](https://discuss.kotlinlang.org/t/android-install-failed-uid-changed-issue-still-present-if-function-names-have-spaces/40/14 "2015-11-09T23:38:51Z")

</div>

Does it crash if kotlin dependencies use spaces in method names? If that is the case, it may make using kotlin dependencies on android problematic.

In a small experiment, I created a kotlin library with an empty method named `test method` and didn’t call it anywhere in the library. I installed this library into my local maven repository. I added it as a dependency to a working android project and it wouldn’t load after that. I removed the empty method and it worked fine with the same dependency. Can anyone repeat this experiment to confirm the results?
