【KMM】KDoctor って生きてるの?

公式にこんなの書いてるけど。

kdoctor

👉 Set up an environment | Kotlin hatena-bookmark


❯ kdoctor                       
[v] System                                           
    OS: macOS (12.6)
    CPU: Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz
[v] Java
    Java (openjdk version "11.0.13" 2021-10-19)
    Location: /Users/maochanz/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/213.7172.25.2113.9014738/Android Studio.app/Contents/jre/Contents/Home/bin/java
    
    JAVA_HOME=/Users/maochanz/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/213.7172.25.2113.9014738/Android Studio.app/Contents/jre/Contents/Home
    
    * Note that, by default, Xcode uses Java environment returned by /usr/libexec/java_home:
      /usr/local/Cellar/openjdk@11/11.0.16.1_1/libexec/openjdk.jdk/Contents/Home
      It does not match current JAVA_HOME environment variable:
      /Users/maochanz/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/213.7172.25.2113.9014738/Android Studio.app/Contents/jre/Contents/Home
          Set JAVA_HOME in XCode -> Preferences -> Locations -> Custom Paths to
          /Users/maochanz/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/213.7172.25.2113.9014738/Android Studio.app/Contents/jre/Contents/Home
    
    * Note that, by default, Android Studio uses bundled JDK for Gradle tasks execution.
          Gradle JDK can be configured in Android Studio Preferences under Build, Execution, Deployment -> Build Tools -> Gradle section
    
[x] Android Studio
    * Android Studio (2021.3)
      Location: /Users/maochanz/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/213.7172.25.2113.9014738/Android Studio.app
      Bundled Java: openjdk 11.0.13 2021-10-19
      Kotlin Plugin: 213-1.7.10-release-for-android-studio-AS6777.52
      Kotlin Multiplatform Mobile Plugin: not installed
          Install Kotlin Multiplatform Mobile plugin - https://plugins.jetbrains.com/plugin/14936-kotlin-multiplatform-mobile
    
[v] Xcode
    Xcode (14.0.1)
    Location: /Applications/Xcode.app
    
[x] Cocoapods
    ruby (ruby 2.7.6p219 (2022-04-12 revision c9c2245c0a) [x86_64-darwin21])
    
    ruby gems (3.3.11)
    
    cocoapods (1.11.3)
    
    * cocoapods-generate plugin not found
          Get cocoapods-generate from https://github.com/square/cocoapods-generate#installation
    
Failures: 2
KDoctor has diagnosed one or more problems while checking your environment.
Please check the output for problem description and possible solutions.

Failures: 2 ですけど!!

👉 Kotlin/kdoctor: Environment analysis tool hatena-bookmark

 

■ JAVA_HOME

Homebrew で OpenJDK11 最新を入れておく。

👉 Mac に Homebrew で OpenJDK11 を インストール する hatena-bookmark


export JAVA_HOME=$(/usr/libexec/java_home -v11)
export PATH="$JAVA_HOME/bin:$PATH"


❯ java -version
openjdk version "11.0.16.1" 2022-08-12
OpenJDK Runtime Environment Homebrew (build 11.0.16.1+0)
OpenJDK 64-Bit Server VM Homebrew (build 11.0.16.1+0, mixed mode)

❯ javac -version
javac 11.0.16.1

❯ which java
/usr/local/Cellar/openjdk@11/11.0.16.1_1/libexec/openjdk.jdk/Contents/Home/bin/java

❯ which javac
/usr/local/Cellar/openjdk@11/11.0.16.1_1/libexec/openjdk.jdk/Contents/Home/bin/javac

❯ ./gradlew --version

------------------------------------------------------------
Gradle 7.5.1
------------------------------------------------------------

Build time:   2022-08-05 21:17:56 UTC
Revision:     d1daa0cbf1a0103000b71484e1dbfe096e095918

Kotlin:       1.6.21
Groovy:       3.0.10
Ant:          Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM:          11.0.16.1 (Homebrew 11.0.16.1+0)
OS:           Mac OS X 12.6 x86_64

AndroidStudio 内の設定で選択肢から指定するだけでいい。

JAVA_HOME

👉 AndroidStudio 利用する Java (JDK) の選択・設定の方法 hatena-bookmark

 

■ Kotlin Multiplatform Mobile Plugin

KMM プラグインをインストールしても、ずっと


Kotlin Multiplatform Mobile Plugin: not installed

のままです。

どうやら、JetBrains ToolBox で Android Studio を使ってる場合の現象のようです。

KDoctor が KMM プラグインを見つけられないようです。

Android Studio: Cannot detect installed Kotlin Multiplatform Mobile Plugin
👉 Android Studio: Cannot detect installed Kotlin Multiplatform Mobile Plugin · Issue #25 · Kotlin/kdoctor hatena-bookmark

 

■ cocoapods-generate


~/AndroidStudioProjects/KMM main
❯ gem 'cocoapods-generate'
ERROR:  While executing gem ... (Gem::UnknownCommandError)
    Unknown command cocoapods-generate

~/AndroidStudioProjects/KMM main
❯ gem install cocoapods-generate
ERROR:  While executing gem ... (Errno::EACCES)
    Permission denied @ dir_s_mkdir - /usr/local/lib/ruby/gems/2.7.0/gems/cocoapods-disable-podfile-validations-0.1.1

❯ pod env --verbose
  CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because checking is only performed in repo update

### Stack

```
   CocoaPods : 1.11.3
        Ruby : ruby 2.7.6p219 (2022-04-12 revision c9c2245c0a) [x86_64-darwin21]
    RubyGems : 3.3.11
        Host : macOS 12.6 (21G115)
       Xcode : 14.0.1 (14A400)
         Git : git version 2.33.0
Ruby lib dir : /usr/local/Cellar/ruby@2.7/2.7.6_1/lib
Repositories : trunk - CDN - https://cdn.cocoapods.org/
```

### Installation Source

```
Executable Path: /usr/local/bin/pod
```

### Plugins

```
cocoapods-deintegrate : 1.0.5
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.1
cocoapods-trunk       : 1.6.0
cocoapods-try         : 1.2.0

```

Kotlin 1.7.0 以降は、


sudo gem install cocoapods

だけでいいんじゃね?

Set up an environment to work with CocoaPods

👉 CocoaPods overview and setup | Kotlin hatena-bookmark

 

■ まとめ

GitHub リポジトリを見てる限り、

KDoctor is a command-line tool that helps to set up the environment for Kotlin Multiplatform Mobile app development.
最終更新日時、

古すぎん?

生きてないのかな、KDoctor。

👉 Kotlin/kdoctor: Environment analysis tool hatena-bookmark
👉 CocoaPods/CocoaPods: The Cocoa Dependency Manager. hatena-bookmark
👉 square/cocoapods-generate: A CocoaPods plugin that allows you to easily generate a workspace from a podspec. hatena-bookmark


関連ワード:  androidAndroidStudioGooglegradleIDEAJetBrainskmmアプリツール初心者開発