Some Errors I’ve Found Developing With KMM
Tags: kotlin, kotlinmultiplatform, android, iosappdevelopment
Published: 2022-06-01 20:45:47

---
title: Some Errors I’ve Found Developing With KMM
published: true
date: 2022-02-09 14:29:22 UTC
tags: kotlin,kotlinmultiplatform,android,iosappdevelopment
canonical_url: https://betterprogramming.pub/some-errors-ive-found-developing-with-kmm-d7480161f15d
---

#### The list of the ones I solved and the one that still bugs me

![](https://cdn-images-1.medium.com/max/800/0*5Aaavg13HW85xZkM.png)

So you are trying to code a Kotlin Multiplatform module.

After setting up a build gradle file for the Android project with this new module, you are led to believe that you will:

- Build on android.
- Then run pod install to install this new precompiled module into an iOS project.
- Then you go on Xcode, run build, and everything should work out. Right?

Wrong!

As of today, Kotlin Multiplatform isn’t in Beta yet. So there have been some errors along the way. Here’s some that I’ve found.

### MAC Problems with Access

Make sure these Applications have full Access to folders (or at least the folders required by the android and iOS projects):

Terminal, Xcode, Android Studio.

### MAC Cannot find PodFile

If you haven’t created one already, one blueprint for one is:

<iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/937ac78eadd1ad3cec816488504a6ecd/href">https://medium.com/media/937ac78eadd1ad3cec816488504a6ecd/href</a></iframe>

If you have a PodFile already, there’s a few things that can happen:

- Android Studio can’t find PodFile declared in the build.gradle.kts because it isn’t there.
- Android Studio doesn’t have permission to search that folder.

Example:

<iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4838ced1357cdf02ca9b793b018de6ac/href">https://medium.com/media/4838ced1357cdf02ca9b793b018de6ac/href</a></iframe>

In this case, check if the file exists there and it is the correct path.

Also, check if Android Studio has permission to access that path.

If nothing works you can delete that line declaring the podfile on build.gradle.kts, run pod install manually after you build on android.

### MAC M1 Problems

#### Installing Cocoapods for the M1

Check out this answer:

[How to install Cocoapods on Apple Silicon M1 computers? by Nikolay Nikonov](https://medium.com/p-society/cocoapods-on-apple-silicon-m1-computers-86e05aa10d3e)

### Simulator + M1

If you are on a Mac M1 and are gonna build for the simulator, here’s what you should do.

<iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/273fb3549ba005d7420edd7c9302b0ae/href">https://medium.com/media/273fb3549ba005d7420edd7c9302b0ae/href</a></iframe>

If you are running with the physical iPhone, no need for Rosetta.

#### M1 + Room Library

You should [change your room dependency value](https://stackoverflow.com/questions/68884589/caused-by-java-lang-exception-no-native-library-is-found-for-os-name-mac-and-o):

```
From: ext.room_version = '2.3.0' 
To: ext.room_version = '2.4.0-alpha03'
```

#### JAVA\_HOME on Xcode M1

Download OpenJDK from [Azul’s M1 OpenJDK builds](https://www.azul.com/downloads/zulu-community/?os=macos&architecture=arm-64-bit&package=jdk). Make it that the default version used is no greater than 11. XCode bugs with greater than 11 version during building Gradle.

Here’s a more [detailed answer](https://developer.apple.com/forums/thread/666681).

#### Cannot find [yourSharedModule].klib in XCode

See if you gave access for Xcode and Terminal to search in the android folder’s project.

Delete .gradle from the android project.

Delete .konan from ios project.

Go in gradle folder in your android project and type

```
chmod -R +x * 
-R means recursive through directories 
+x means add to every file the permission to be executed
* means all files and directories in the current folder
```

Rebuild all of them. (Build Android, Pod install, Build iOS).

Now I found some Mac Intels that just don’t like this .klib file and can’t seem to find it. I’m still trying to solve this for a particular annoying mac, you can [check how it’s going here](https://stackoverflow.com/questions/70974616/kotlin-multiplatform-error-linkpoddebugframeworkios-failed).

That’s it, that sums up about a month of hitting my head on the desk to solve each individual problem that the KMM had so far.

_Originally published at_ [_https://skiraindustries.com_](https://skiraindustries.com/2022/02/09/some-errors-ive-found-developing-with-kmm/)

* * *