KDoctor - A command-line tool that helps to set up the environment for Kotlin Multiplatform Mobile app development

Related tags

Utility kdoctor
Overview

KDoctor

KDoctor is a command-line tool that helps to set up the environment for Kotlin Multiplatform Mobile app development.

Overview

KDoctor ensures that all required components are properly installed and ready for use. If something is missed or not configured Kdoctor highlights the problem and suggests how to fix the problem.

KDoctor runs the following diagnostics:

  • System - checks operating system version
  • JDK - checks that JDK installation and JAVA_HOME setting
  • Android Studio - checks Android Studio installation, Kotlin and Kotlin Multiplatform Mobile plugins
  • Xcode - checks Xcode installation and setup
  • Cocoapods - checks ruby environment, cocoapods and cocoapods-generate gems installation

Requirements

KDoctor works on macOS only.

Installation

Manual

You can download an archive from GitHub:

  1. Go to Releases page
  2. Download the latest available version there
  3. Unpack it to preferred place

Build From Source

To build from source use:

git clone https://github.com/Kotlin/kotlin-interactive-shell
cd kdoctor
./gradlew assembleReleaseExecutableMacOs

Usage

Call KDoctor in the console and wait till it completes the diagnostics

kdoctor
Diagnosing Kotlin Multiplatform Mobile environment...

Once KDoctor finishes the diagnostics, it yields a report. If no problems are found your system is ready for Kotlin Multiplatform Mobile development:

Your system is ready for Kotlin Multiplatform Mobile Development!

If KDoctor notifies that there are problems, please review the report:

KDoctor has diagnosed one or more problems while checking your environment.
Please check the output for problem description and possible solutions.

Check the results of each diagnostic. There are 3 possible statuses:

  • [v] - Success
  • - Failure
  • [!] - Warning

Pay the most attention to the failed diagnostics ([x]) and look for messages that start with * for problem description and potential solution.

It is also worth checking diagnostics with warnings ([!]) and even successful messages as they may contain useful notes and tips.

Execute KDoctor with a -v option to print the tool's version

kdoctor -v
0.0.1

##Sample output

[v] System                                           
    macOS (11.6.2)
    CPU:  Dual-Core Intel Core i5
    
[v] Java
    Java (java 17.0.1 2021-10-19 LTS)
    Location: /Library/Java/JavaVirtualMachines/jdk-17.0.1.jdk/Contents/Home/bin/java
    
    JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-17.0.1.jdk/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
    
[v] Android Studio
    Android Studio (2020.3)
    Location: /Applications/Android Studio.app
    Bundled Java: openjdk 11.0.10 2021-01-19
    Kotlin Plugin: 203-1.6.10-release-923-AS7717.8
    Kotlin Multiplatform Mobile Plugin: 0.3.0(203-1.6.0-release-795-IJ)-54
    
[v] Xcode
    Xcode (13.2.1)
    Location: /Applications/Xcode.app
    
[v] Cocoapods
    ruby (ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin20])
    
    ruby gems (3.0.9)
    
    cocoapods (1.11.2)
    
    cocoapods-generate (2.2.2)

License

Apache-2.0

Comments
  • Android Studio: Cannot detect installed Kotlin Multiplatform Mobile Plugin

    Android Studio: Cannot detect installed Kotlin Multiplatform Mobile Plugin

    Running kdoctor shows:

    [x] Android Studio
        * Android Studio (2021.3)
          Location: /Users/wumo/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
    

    But the plugin is installed: WeChatWorkScreenshot_7919f94a-38d4-4240-a4b2-9fc3a88af95a

    opened by wumo 9
  • On Kotlin versions at or above 1.7.0, cocoapods-generate is still required

    On Kotlin versions at or above 1.7.0, cocoapods-generate is still required

    After Kotlin 1.7.0, the cocoapods-generate tool is no longer required. I still get the following:

    * cocoapods-generate plugin not found
              Get cocoapods-generate from https://github.com/square/cocoapods-generate#installation
        
    Failures: 1
    KDoctor has diagnosed one or more problems while checking your environment.
    Please check the output for problem description and possible solutions.
    

    Should this be included in the output still? It's useful information if the user is below Kotlin 1.7.0, but not useful for users using Kotlin 1.7.0 or higher.

    opened by LandryNorris 2
  • Add more strict message about M1 + system Ruby installation

    Add more strict message about M1 + system Ruby installation

    There is a problem with system Ruby on M1 macs when someone tries to use cocoapod-generate gem. It looks like error:

      /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': dlopen(/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/lib/ffi_c.bundle, 0x0009): tried: '/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/lib/ffi_c.bundle' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')) - /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/lib/ffi_c.bundle (LoadError)
    

    or something like this.

    Work around is to use custom Ruby installation (and reinstall cocoapods and cocoapod-generate gems): https://youtrack.jetbrains.com/issue/KT-49418#focus=Comments-27-5429773.0-0

    It would be better to help kdoctor users with this case

    opened by terrakok 2
  • Fixed sporadic errors while executing a shell command

    Fixed sporadic errors while executing a shell command

    Sometimes (literally sometimes, I see no consistent pattern) when you're trying to execute some shell command using System.execute(), it returns with returnCode 65280, and error == null, output == null. Meanwhile, an execvp() documentation says that the list of arguments must be null-terminated.

    Also, added shell commands logging

    opened by amatsegor 1
  • Add info about custom JAVA_HOME in Xcode

    Add info about custom JAVA_HOME in Xcode

    https://github.com/Kotlin/kmm-production-sample/issues/40#issuecomment-1094497900

    Open XCode > Preferences > Locations > Custom Paths and add a custom path with name JAVA_HOME pointing to my current JAVA_HOME directory.

    opened by terrakok 0
  • cocoapods not found

    cocoapods not found

    After running kdoctor I've got this error:

    [x] Cocoapods
        ruby (ruby 2.6.8p205 (2021-07-07 revision 67951) [universal.arm64e-darwin21])
    
        * System ruby is currently used
              Consider installing ruby via Homebrew, rvm or other package manager in case of issues with cocoapods installation
    
        ruby gems (3.0.3.1)
    
        * cocoapods not found
              Get cocoapods from https://guides.cocoapods.org/using/getting-started.html#installation
    

    But my cocoapods is fine:

    pod --version
    1.11.2
    

    My Cocoapods is installed from homebrew.

    This may be a wrong error, I actually don't have pod-gen installed, because my env works fine without it - I don't use any pod dependencies from Kotlin part.

    opened by PhilipDukhov 0
  • Vkormushkin/dev

    Vkormushkin/dev

    Fixes:

    • Fixed the case when LC_CTYPE env var is empty but there is still a value in locale settings
    • Use -version instead --version for getting java version cause the last is not supported by JAVA 8
    • Filter off Toolbox backup versions of Android Studio
    opened by vkormushkin 0
  • Refactor System methods

    Refactor System methods

    1. System.execute: redirect stderr of a child process to a separate pipe to avoid mixing of output streams. For example, gem -- version prints valid version and some warning to stderr
    gem --version
    Ignoring ffi-1.15.0 because its extensions are not built. Try: gem pristine ffi --version 1.15.0
    3.0.3.1
    
    1. System method for file reading: extract common logic to private functions
    opened by vkormushkin 0
  • Vkormushkin/dev

    Vkormushkin/dev

    Various bug fix:

    1. Apple chips support for System Diagnostics
    2. Search Android Studio in Jetbrains Toolbox default folder
    3. Additional notes regarding Xcode and Android Studio using different Java environments by default
    opened by vkormushkin 0
  • Feature request: add an option to clean `~/.konan` directory

    Feature request: add an option to clean `~/.konan` directory

    ~/.konan directory contains all Kotlin/Native compilers and their dependencies. This directory tends to grow to tens of gigabytes (47gb on my machine, though I'm kinda an edge case 🌝). It would be nice to have a CLI option that just removes this directory altogether, so that only relevant artifacts will be downloaded when user starts to work on their project.

    opened by sbogolepov 1
  • Confirmation of Gradle project configuration worth considering?

    Confirmation of Gradle project configuration worth considering?

    Hello friends!

    First of all - thank you for building this tool for KMM development! I was excited when I saw it mentioned in the Kotlin blog a little while back, as I've been using KMM for the last couple of years. 😃

    I am curious about how you envision this tool evolving in the future.

    The most challenging aspect of KMM development that I have found is managing and maintaining the Gradle configuration for the shared modules using Gradle. As KMM has evolved and the Gradle configuration needs to change, it has been challenging for me to determine the proper Gradle configuration for all components to work together harmoniously. Once it's working, I tend to try not to touch it as I perceive it to be quite brittle, and even still sometimes IntelliJ will indicate issues with the configuration even though it appears to be working to me. My "Gradle-fu" is admittedly relatively limited, and I desire to focus on the development of the product and not get lost in configuration details, so these are likely contributing factors.

    Specifically, I'm referring to the build.gradle.kts (or build.gradle) file for any shared module. This includes the configuration of the targets (Android, iOS, or otherwise), Android-specific configuration, and the configuration for building the framework to be used with iOS (including Debug/Release/Custom build configurations, managing architectural differences such as simulator vs. device, etc.).

    If this is a part of your vision for this product, then I'd be willing to get involved in some conversations about how I might be able to contribute to this somehow. If this isn't a part of your vision - no worries at all, and maybe I can look to find a better place to share this feedback. I just thought it might be worth asking here to see. 👍đŸģ

    Thanks for your kind consideration! 🙇đŸģ‍♂ī¸

    opened by derekleerock 0
  • Cocoapods failure not appropriate when Cocoapods support is not desired

    Cocoapods failure not appropriate when Cocoapods support is not desired

    Hello friends!

    First of all - thank you for building this tool for KMM development! I was excited when I saw it mentioned in the Kotlin blog a little while back as I've been using KMM for the last couple of years.

    I just ran the tool and here is the output that was generated for reference:

    [v] System
        OS: macOS (12.4)
        CPU: Apple M1 Max
    [v] Java
        Java (openjdk version "11.0.12" 2021-07-20)
        Location: /Library/Java/JavaVirtualMachines/Android Studio JRE/Contents/Home/bin/java
    
        JAVA_HOME=/Library/Java/JavaVirtualMachines/Android Studio 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
    
    [v] Android Studio
        Android Studio (2021.2)
        Location: /Applications/Android Studio.app
        Bundled Java: openjdk 11.0.12 2021-07-20
        Kotlin Plugin: 212-1.7.0-release-281-AS5457.46
        Kotlin Multiplatform Mobile Plugin: 0.3.3(212-1.7.0-RC-release-217-IJ)-104
    
    [v] Xcode
        Xcode (13.4.1)
        Location: /Applications/Xcode.app
    
    [x] Cocoapods
        * ruby version ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [arm64-darwin21] is not compatible with cocoapods-generate
          More details: https://github.com/rubygems/rubygems/issues/4338
              Downgrade ruby to version < 3.0.0
    
        ruby (ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [arm64-darwin21])
    
        ruby gems (3.2.3)
    
        cocoapods (1.11.2)
    
        * cocoapods-generate plugin not found
              Get cocoapods-generate from https://github.com/square/cocoapods-generate#installation
    
    Failures: 1
    KDoctor has diagnosed one or more problems while checking your environment.
    Please check the output for problem description and possible solutions.
    

    While I happen to have Cocoapods installed (via Homebrew) for some other Xcode projects, based on personal preference for my own projects, I do not use Cocoapods. Therefore, receiving information regarding how cocoapods is not configured properly for me is irrelevant.

    I'm not sure if there are other developers who are similar to me, however, if there are, then I would suggest it might be helpful to make the Cocoapods confirmation optional as it is not required for KMM (or iOS) development, or change the verification result from "error" to warning with a stipulation that it is only important if you are actively using Cocoapods.

    opened by derekleerock 1
Releases(v0.0.6)
  • v0.0.6(Dec 13, 2022)

  • v0.0.5(Dec 1, 2022)

    What's Changed

    • New colored output
    • New short output by default and verbose output with -v option
    • Added a remote compatibility matrix for useful notifications
    • All diagnostics were covered with unit tests

    Full Changelog: https://github.com/Kotlin/kdoctor/compare/v0.0.4...v0.0.5

    Source code(tar.gz)
    Source code(zip)
    kdoctor_0.0.5+75.zip(2.12 MB)
  • v0.0.4(Apr 19, 2022)

    What's Changed

    • Fix for #16: Failure if system ruby is used on a M1 mac by @vkormushkin in https://github.com/Kotlin/kdoctor/pull/18
    • Fix for #17: Check for JAVA_HOME set in Xcode custom paths by @vkormushkin in https://github.com/Kotlin/kdoctor/pull/19

    Full Changelog: https://github.com/Kotlin/kdoctor/compare/v0.0.3...v0.0.4

    Source code(tar.gz)
    Source code(zip)
    kdoctor_0.0.4+62.zip(1.68 MB)
  • v0.0.3(Mar 29, 2022)

    What's Changed

    • Fix clone repository of README.md by @takahirom in https://github.com/Kotlin/kdoctor/pull/10
    • Rosetta detection and support added by @amatsegor in https://github.com/Kotlin/kdoctor/pull/12
    • Fixed sporadic errors while executing a shell command by @amatsegor in https://github.com/Kotlin/kdoctor/pull/14
    • Implemented detection of Cocoapods installed via Homebrew by @amatsegor in https://github.com/Kotlin/kdoctor/pull/15

    New Contributors

    • @takahirom made their first contribution in https://github.com/Kotlin/kdoctor/pull/10
    • @amatsegor made their first contribution in https://github.com/Kotlin/kdoctor/pull/12

    Full Changelog: https://github.com/Kotlin/kdoctor/compare/v0.0.2...v0.0.3

    Source code(tar.gz)
    Source code(zip)
    kdoctor_0.0.3+59.zip(1.69 MB)
Owner
Kotlin
Kotlin Tools and Libraries
Kotlin
A beautiful set of predefined colors and a set of color methods to make your Android development life easier.

Colours is a port of the Colours Library for iOS made by my good friend Ben Gordon. You can find that project here. Installation Maven Central Colours

Matthew York 634 Dec 28, 2022
Small command-line utility to safely merge multiple WhatsApp backups (msgstore.db) into one.

whatsapp-database-merger A small command-line utility that can be used to merge multiple WhatsApp databases (msgstore.db) into one. A few notes: input

Mattia Iavarone 31 Dec 27, 2022
A command line utility to help you investigate the sensitive data associated with Macie findings.

Macie Finding Data Reveal This project contains a command line utility to help you investigate the sensitive data associated with Macie findings.

AWS Samples 8 Nov 16, 2022
Handy library to send & receive command with payload between subscribers for Android.

Commander Handy library to send & receive command with payload between subscribers for Android. Features Subscription based No dependency on Framework

Romman Sabbir 3 Oct 19, 2021
Command framework built around Kord, built to be robust and scalable, following Kord's convention and design patterns.

Command framework built around Kord, built to be robust and scalable, following Kord's convention and design patterns.

ZeroTwo Bot 4 Jun 15, 2022
Simple Mobile Tools 172 Dec 26, 2022
Access and process various types of personal data in Android with a set of easy, uniform, and privacy-friendly APIs.

PrivacyStreams PrivacyStreams is an Android library for easy and privacy-friendly personal data access and processing. It offers a functional programm

null 269 Dec 1, 2022
A set of helper classes for using dagger 1 with Android components such as Applications, Activities, Fragments, BroadcastReceivers, and Services.

##fb-android-dagger A set of helper classes for using dagger with Android components such as Applications, Activities, Fragments, BroadcastReceivers,

Andy Dennie 283 Nov 11, 2022
A set of lint rules to check for common mistakes when styling and theming on Android

A set of lint rules to check for common mistakes when styling and theming on Android

GuilhE 6 Aug 29, 2022
compaKTset is a small library aimed at providing you with the most memory efficient Set implementation for any particular data type of your choosing.

compaKTset is a small library aimed at providing you with the most memory efficient Set implementation for any particular data type of your choosing.

Ignat Beresnev 3 Nov 16, 2021
Matches incoming and/or outgoing text messages against set rules and sends them over to webhook.

Textmatic If you ever wanted a tool to simply push the SMS (or text messages) from your phone to somewhere remote, this is it. This app matches all in

Float 2 Jan 7, 2022
XClipper is a clipboard manager for Windows & Android which helps to track clipboard activities and makes it easier to interact with them.

XClipper XClipper is a clipboard manager for Windows & Android which helps to track clipboard activities and makes it easier to interact with them ❤ī¸

Kaustubh Patange 134 Dec 31, 2022
recompose is a tool for converting Android layouts in XML to Kotlin code using Jetpack Compose.

recompose is a tool for converting Android layouts in XML to Kotlin code using Jetpack Compose.

Sebastian Kaspari 565 Jan 2, 2023
A tool to validate text inside TextInputLayout

Download dependencies { implementation 'com.github.anderscheow:validator:2.2.1' } Usage Available rules LengthRule MaxRule MinRule NotEmptyRule NotN

Anders Cheow 129 Nov 25, 2022
An easy-to-use, cross-platform measurement tool that pulls data out of CD pipelines and analysis the four key metrics for you.

Maintained by SEA team, ThoughtWorks Inc. Read this in other languages: English, įŽ€äŊ“中文 Table of Contents About the Project Usage How to Compute Contrib

Thoughtworks 277 Jan 7, 2023
An intelligent diff tool for the output of Gradle's dependencies task

Dependency Tree Diff An intelligent diff tool for the output of Gradle's dependencies task which always shows the path to the root dependency. +--- c

Jake Wharton 693 Dec 26, 2022
Utility tool to make you a computer ninja.

Cmd Window Never spend 6 minutes doing something by hand when you can spend 6 hours failing to automate it - Zhuowej Zhang What is this about? This to

Marcin Radoszewski 3 Feb 1, 2022
BinGait is a tool to disassemble and view java class files, developed by BinClub.

BinGait Tool to diassemble java class files created by x4e. Usage To run BinGait, run java -jar target/bingait-shadow.jar and BinGait will launch. If

null 18 Jul 7, 2022
Tool to look for several security related Android application vulnerabilities

Quick Android Review Kit This tool is designed to look for several security related Android application vulnerabilities, either in source code or pack

LinkedIn 2.9k Jan 2, 2023