Junie is JetBrains' coding agent, meaning that Junie can not only tell answer your questions but also do things on your behalf (e.g., scan files, update multiple files, perform command line tasks). More details provided at https://www.jetbrains.com/junie/ ↗
Install Junie in Android Studio
As mentioned in the main post ↗, we are going bleeding edge with the nightly build so that we can get all of the latest goodies: https://developer.android.com/studio/nightly ↗
Once you have Android Studio preview installed, you need to install the Junie plugin (Android Studio -> Settings -> Plugins -> Search for Junie). You can activate a 30-day trial without a credit card.
## Add JetBrains' KMP Plugin
While adding plugins, let's add JetBrains KMP Plugin. This plugin has some nice features - we will be adding some details on what comes in this plugin soon - but for now we are just focused on creating a new KMP Project. So install the plugin (Android Studio -> Settings -> Plugins -> Search for Kotlin Multiplatform), restart Android Studio, and you should be able to create a new KMP Project at File -> New -> New Project -> Kotlin Multiplatform App.
## Add Koin to Project
To test out AI in your new KMP project, let's try adding Koin. Koin is a dependency injection framework. It serves a similar function to Dagger Hilt ↗. and is quite popular in KMP (currently ranked #7 on klibs.io ↗ with 9.4k ⭐️).
Junie Prompt: Can you help me to add Koin to this application - adding the library and identifying areas to use it.
Junie will make a bunch of code change recommendations that you can review and approve.
I ended up with an error. This is pretty common when coding with AI (whether Junie or any other agents I have tried). Do small units of work, test often, and be ready to roll back. Here is the error that I got.
Configuration cache state could not be cached: field `__librarySourceSets__` of task `:composeApp:mapDebugSourceSetPaths` of type `com.android.build.gradle.tasks.MapSourceSetPathsTask`: error writing value of type 'org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection'
> Could not resolve all files for configuration ':composeApp:debugRuntimeClasspath'.
> Could not find io.insert-koin:koin-compose:3.5.3.
Searched in the following locations:
- https://repo.maven.apache.org/maven2/io/insert-koin/koin-compose/3.5.3/koin-compose-3.5.3.pom
Required by:
project :composeApp
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
It ended up suggesting something that was not correct (I confirmed that neither of these was required by visiting the Koin docs https://insert-koin.io/docs/4.1/setup/koin/ ↗) - so I rejected this recommendation.
Instead I opened up the Version Catalog (libs.version.toml) and saw the squiggly line under Koin 3.5.3 and accepted Android Studio's suggestion to Change to 4.0.4.
This made the project buildable. Next up, we will actually put some dependency injection to work....[to be continued:)]