Build M1 binary for Kotlin Native in IntelliJ IDEA - kotlin

I'm playing with Kotlin Native on my M1 Mac using IntelliJ IDEA 2022.3 Community Edition. (Build #IC-223.7571.182, built on November 29, 2022; Runtime version: 17.0.5+1-b653.14 aarch64)
I noticed that the resulting binaries are for x86_64
I can't find in the settings, the IDEA help, or Google how to get it to build for aarch64.
Is it missing or am I just not finding the setting?

I still have not found a way to set this via the GUI and I don't have a Java, Kotlin, Gradle, or JetBrains background, but I found out how to change it in the configuration files for now:
In the project tab I can edit build.gradle.kts and change the kotlin/nativeTarget/hostOS line:
Was:
hostOs == "Mac OS X" -> macosX64("native")
Now:
hostOs == "Mac OS X" -> macosArm64("native")
Thanks to the help of this post on YouTrack from a month ago: New Kotlin Multiplatform Native Application project template won't run on Apple M1 from IntelliJ IDEA

Related

How to solve Could not find com.android.tools.build:gradle:4.1.1.?

Can't build react native app in android studio.
I tried:
Sync Project with Gradle Files, but I can't do it because of an
error
File -> Invalidate Caches/ Restart
Clear cache from $HOME/.gradle
Delete $HOME/.gradle
Change com.android.tools.build:gradle version on 2.3.0, because it's
the latest version in this list
(https://repo.jfrog.org/artifactory/libs-release-bintray/com/android/tools/build/gradle/), but when I use npx react-native init projectName, used Android Plugin Version 4.1.2, but this version there isn't in this list.
Also know the difference between Gradle, Android Gradle Plugin,
Gradle Wrapper, already read https://developer.android.google.cn/studio/releases/gradle-plugin?hl=en. I tryied to use the latest Gradle v. 6.8.2 and Android Gradle Plugin v. 4.1.2, it also didn't help to build the project.
Change distributionUrl in
projectName/android/gradle/wrapper/gradle-wrapper.properties
Change in File->Settings->Build, Execution, Deployment->Gradle use
Gradle from Specified location and set C:/Gradle/gradle-6.8.2, it didn't help and left it at default
I know there are exactly the same questions on stackoverflow and on github, but the solutions haven't helped.
Build output:
Could not find com.android.tools.build:gradle:4.1.1.
Searched in the following locations:
- https://jcenter.bintray.com/com/android/tools/build/gradle/4.1.1/gradle-4.1.1.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project :react-native-settings
Add google Maven repository and sync project
Open File
Now used:
Gradle v. 6.5
Android Gradle Plugin v. 4.1.2
gradle-wrapper 6.5-all
Android Studios 4.1.2
Android SDK Platform: Android 10, 9, 8.1, 8.0, 7.1.1, 7.0
Your google Maven library is missing. Rebuild project after adding it

After Flutter GIT project checkout, unable to run the project

So I created a Flutter project in IntelliJ Idea Community Edition on machine A and then uploaded the whole project on GitHub. Now I cloned/checked out from GitHub in the same IDE on machine B, performed the following:
flutter packages get
flutter upgrade
Set up the dart path and all other prerequisites
But, I am still unable to run the flutter project from IDE.
I mean I can't even press the "Run" button.
Where did I go wrong?
You can try performing the same steps as I did. it if you want. Here's the Git repository code
Edit I can run the same project via terminal.
[Update] As requested by Günter Zöchbauer in the comment log, here's the logs for flutter doctor -v
BoringFlutterProject$ flutter doctor -v
[✓] Flutter (Channel dev, v0.5.8, on Linux, locale en_IN)
• Flutter version 0.5.8 at /home/daksh/flutter
• Framework revision e4b989bf3d (8 days ago), 2018-08-09 09:45:44 -0700
• Engine revision 3777931801
• Dart version 2.0.0-dev.69.5.flutter-eab492385c
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
• Android SDK at /home/daksh/Android/Sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-27, build-tools 27.0.3
• ANDROID_HOME = /home/daksh/Android/Sdk
• Java binary at: /home/daksh/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
• All Android licenses accepted.
[✓] Android Studio (version 3.1)
• Android Studio at /home/daksh/android-studio
• Flutter plugin version 25.0.1
• Dart plugin version 173.4700
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
[✓] IntelliJ IDEA Community Edition (version 2018.1)
• IntelliJ at /home/daksh/Downloads/idea-IC-181.5281.24
• Flutter plugin version 25.0.2
• Dart plugin version 181.4892.1
[✓] VS Code (version 1.26.0)
• VS Code at /usr/share/code
• Flutter extension version 2.17.1
[!] Connected devices
! No devices available
! Doctor found issues in 1 category.
I posted this question because I'm sure many of us will face the same problem, just like we used to face some issues in AndroidStudio back then
It is an Android Studio issue. The IDE doesn't apply the flutter SDK location for every new project you clone.
The workaround is to open the cloned project go to File>Settings(Ctrl+Alt+S). In 'Languages & Frameworks'>Flutter set the SDK path to your Flutter SDK location (e.g. C:\src\flutter). Once you apply the changes and run the 'Packages Get' command the cloned project is fully accessible and understood by Android Studio.
I've succeeded to run you project. When I've first open it showed me that it can't find the location for Dart SDK, once I've set the location of the flutter sdk
as explained here:
Dart SDK is not configured
it automatically update the location of the Dart SDK, then I've had to run get dependencies, then it run.
If you have flutter and Dart plugin installed.
Now the problem is Dart support for this project is disabled now you have to enable it.
Step 1: Go to Settings -> Languages & Frameworks -> Dart
Step 2: Check the "Enable dart support for this project"
Step 3: Set the Dart SDK path to your Dart SDK folder like the picture given bellow
Step 4: Click on Apply
That's all!
Too late but pubspec.yaml-> Pub outdated( on top left of Android Studio's screen) -> build on real device solved my problem
In addition to answer by #Marc Steffens above, to run on Chrome and not an emulator or device, I also had to run "flutter create ." from the project root in the terminal. Note the trailing ".".
What helped in my case, was simply removing the .idea folder in the project root.

IntelliJ IDEA adding numbers to project name

When I "Create a new project from existing sources" in IntelliJ IDEA, it adds _#### to the end of the project name, where #### is a seemingly random 4-digit number.
This happens with this version:
IntelliJ IDEA 2018.1.5 (Community Edition)
Build #IC-181.5281.24, built on June 12, 2018
JRE: 1.8.0_152-release-1136-b39 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.13.5
I know how to rename it, but how can this be disabled?
There is an open bug logged for SBT subsystem in IntelliJ IDEA. Please follow it for updates.
It appears that import doesn't complete properly for some reason.
UPDATE: SCL-13617 is the correct issue to follow.
This behavior was a workaround for another bug and will be changed in the 2018.2 release of the Scala plugin. Instead the import chooses the project directory name as project name.

IntelliJ IDEA: Kotlin missing

I went to Linux Mint 18 from MacOS, first Timer on Linux.
Now I wanted to install Kotlin.
Downloaded it from here: https://www.jetbrains.com/idea/download/index.html#section=linux
Used this install instruction: https://www.youtube.com/watch?v=2jSX6lcFElE
(download IntelliJ from Jetbrains and put it in home-folder)
Now that I wanted to start a new Kotlin project, it seems missing:
No Kotlin in IntelliJ IDEA:
What have I missed out?
Seems to be a problem with the Kotlin language plugin when updating to IntelliJ 18.1
Try to reinstall the corresponding plugin. I was able to fix it this way.

Does IntelliJ Ultimate include Webstorm and Appcode

I'm wondering if the Webstorm & Appcode IDEs come bundled with the ultimate edition.
From the JetBrains website:
IntelliJ IDEA vs WebStorm features
IntelliJ IDEA remains JetBrains' flagship product and IntelliJ IDEA provides full JavaScript
support along with all other features of WebStorm via bundled or
downloadable plugins. The only thing missing is the simplified project
setup.
AppCode is MacOS only, because it relies on an XCode installation, and MacOS X specific features (like the iOS Simulator, MacOS X keychain, etc)
Therefore it is a separate project. It also requires a separate license.