Nice article! I was waiting one detailed article like this some time ago. However I still don’t understand the initial process of the setup of the project. Could you describe a little bit more about the steps to follow in order to get this configuration? It would be super helpful for me!
Hi @itspecialists! If you’re using IntelliJ IDEA (which I recommend for any kotlin related project since the Community Edition is 100% free) you can get a pretty similar setup (everything is getting updated really quickly so maybe something can change) with the default project creation:
start IDEA, then File>New>Project and a popup will appear;
on the left panel select “Kotlin”, and the right panel will change
on the right panel select “Kotlin (Mobile Android/iOS)”
complete the setup with your project name and other stuff the wizard will ask you (project/sdk location, kotlin version, java version and so on)
Enjoy your brand new project, that’s it!
If you need help with something else don’t hesitate :]
Thank you very much for your response! I followed the steps:
So I first created a new project from Kotlin (Mobile Android/iOS) template. then clicked on next and the following configuration was like this:
After that, this error screen was displayed:
So I clicked on “Re-download dependencies and sync project” and the following appeared:
I clicked ok, but that didn’t fix the problem. And my build.gradle is showing this message:
I tried to hit “try again” but nothing happened, I’m not sure what I’m missing. I followed all the tutorial successfully.
Thanks for your time and your help, I really appreciate it!
Can you try to press on the “Ok, apply suggestion!” link above the “Try Again”? I never experienced this issue so I’m not sure on what’s the cause. I just created a new project with the IntelliJ IDEA 2018.3.5 and everything worked without any issue (I just had to setup the android sdk path in the local.properties file)
I feel the article is missing some information at the end.
There’s a paragraph saying " At this point, you need to call toNativeImage() on your ByteArray and return it from the success callback. Compile and that’s it!"
I was searching through the article because I thought I was missing something. But it turns out your article doesn’t show any loading of that ByteArray, so there’s no place to call toNativeImage(). I find this confusing.
The toNativeImage() method should be called in the getPokemonSprite(…) method inside the shared code. The ByteArray is returned from the network call.
Unfortunately right now I don’t have a pc with me so I can’t tell you file names or show images, but if you check the final project it should be pretty easy to figure out where the method is called.
Sorry if this seems too confusing, if you need additional help just leave a comment!
Thanks! I understand toNativeImage() has to be done in getPokemonSprite(…). But the tutorial doesn’t include any implementation of it so I felt a bit lost. I already tried to look at the full completed project in the article, but I cannot find any link to it. Can you show me where it is?
I’m not a master of anything so I maybe asking a stupid question here but please be patient.
this line → “$SRCROOT/…/gradlew” -p “$SRCROOT/…/app” copyFramework
If I understand it correctly, locates the gradlew and invoke the copyFramework task. What does the -p option do though?
the remaining lines sets some properties →
-Pconfiguration.build.dir=“$CONFIGURATION_BUILD_DIR”
-Pkotlin.build.type=“$KOTLIN_BUILD_TYPE”
-Pkotlin.target=“$KOTLIN_TARGET”
which if I understand it correctly is used by the copyFramework task but what I dont understand is where the values $CONFIGURATION_BUILD_DIR, $KOTLIN_BUILD_TYPE, $KOTLIN_TARGET come from?
Hello!
I am having a problem trying to compile the first hello example from the multiplattform video series.
My OS is macOS Mojave
kotlin-native-1.3.60
Java 1.8.0_141-b15
I am getting the following error: kotlin-native-macos-1.3.60/konan/nativelib/libllvmstubs.dylib: code signature in (/bin/kotlin-native-macos-1.3.60/konan/nativelib/libllvmstubs.dylib) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.