Amper Update November 2024 – Project File Tooling, Compose Resources, KSP2, and Android Release Builds
Amper 0.5.0 is now available! With this release, we’ve improved the IDE experience when working with multiple modules and project.yaml
files, made nested completion in Amper configuration files more powerful, introduced support for Compose Resources and KSP2, improved Android release builds, and more!
For the full list of changes and bug fixes in Amper 0.5.0, see the release notes.
To get support for Amper’s latest features, use Fleet 1.42 or IntelliJ IDEA 2024.3 (or later versions).
Tooling support for working with modules and project files
In the previous update, we introduced project files for standalone Amper projects. With this release, you’ll now get additional tooling to work with these files.
When working in the configuration file of a newly created module, you’ll see a warning and a quick-fix that helps you add it to the list of modules:
When referencing a module that doesn’t exist yet, you can use a quick-fix to create that new module:
Improved nested completion
The settings block in Amper files offers nested completion for all of the available values you can configure, letting you easily search for values even if you don’t know where in the structure they’re nested.
To make this even more convenient, you’ll now get this completion support even when you’re at the top level of a module file:
Compose resources
You can now use Compose Multiplatform resources in standalone Amper projects, which allows you to easily access images, strings, fonts, and files in your Compose application.
You can configure resources under settings.compose
to change the package name or the visibility of the generated Res
class:
settings: compose: enabled: true resources: packageName: com.example.app exposedAccessors: true
Kotlin Symbol Processing
The standalone version of Amper now has support for Kotlin Symbol Processing. Many third-party libraries use KSP to generate code as part of the compilation process.
Amper works with KSP2, so any processors used must be updated for KSP2 as well. We’re expecting most processors to make this upgrade soon, as KSP1 is deprecated and will no longer be supported in Kotlin 2.1. However, at the time of this release, you might still see some gaps in support, such as issues with native targets.
To add a processor to your module, use the settings.kotlin.ksp
section. You can also specify the options that you want to pass to KSP here.
settings: kotlin: ksp: processors: - androidx.room:room-compiler:2.7.0-alpha09 processorOptions: room.schemaLocation: ./schema
In multiplatform modules, configuration in the settings block is applied to all platforms by default, including KSP processors. If you need to specify which platforms to run a KSP processor on, use a settings block with a platform qualifier:
settings@android: kotlin: ksp: processors: - androidx.room:room-compiler:2.7.0-alpha09
Android release builds
Amper can now create signed release builds of Android apps in both Gradle-based and standalone Amper projects. These builds will use R8 automatically, with minification and shrinking enabled.
To enable signing for release builds, use the new android.signing
option in the settings block:
settings: android: signing: enabled
You can provide the signing details by creating a keystore.properties
file in the module:
storeFile=/Users/example/.keystores/release.keystore storePassword=store_password keyAlias=alias keyPassword=key_password
There are options available to customize R8’s obfuscation and to change the location of the properties file containing the signing details. Amper can also generate a new keystore for you if you don’t have one already.
You can refer to the documentation about configuring Android builds for more details, and you can also look at samples to see custom Proguard configuration in both standalone and Gradle-based Amper projects.
Parcelize support for Android
In projects using the standalone version of Amper, you can now turn on the Parcelize plugin for Android, using the new settings entry:
settings: android: parcelize: enabled
This lets you annotate Parcelable
classes with @Parcelize
to generate an implementation automatically:
import kotlinx.parcelize.Parcelize @Parcelize class User(val firstName: String, val lastName: String, val age: Int): Parcelable
As Parcelize is an Android-specific feature, it requires some additional configuration in multiplatform projects, which is described in the documentation.
Updated dependencies and defaults
Amper now uses these new versions of dependencies and default values:
- Kotlin 2.0.20
- Kotlin language version 2.0
- Android compile SDK and target SDK 35
This release also uses kotlinx.serialization 1.7.3 by default and allows you to customize this version if needed:
settings: kotlin: serialization: enabled: true version: 1.7.3
To make it easier to set up serialization for various formats, the required dependencies are available from the built-in version catalog:
dependencies: - $kotlin.serialization.json - $kotlin.serialization.protobuf
New, unified cache folder
There is now a unified location for caching downloaded dependencies, whether Amper is invoked from the command line or used in an IDE. The ~/.amper
folder that was used in previous versions can be safely deleted.
The new cache locations are as follows:
- On Windows:
~/AppData/Local/Amper
- On macOS:
~/Library/Caches/Amper
- On Linux:
~/.cache/Amper
(or ifXDG_CACHE_HOME
is defined,$XDG_CACHE_HOME/.cache/Amper
)
Update your existing projects
To update a project using the standalone version of Amper, update your amper
scripts by following the download instructions on the Usage page of the documentation.
If you’re using a Gradle-based Amper project, update your plugin version to 0.5.0:
plugins { id("org.jetbrains.amper.settings.plugin").version("0.5.0") }
Try Amper
To get started with Amper, try the sample projects with standalone Amper or the samples with Gradle-based projects.
For full support of the latest Amper features, use Fleet 1.42 and IntelliJ IDEA 2024.3 (or later versions).
Share your feedback
Amper is still experimental and under active development. You can provide feedback about your experience by joining the discussion in the Kotlinlang Slack’s #amper channel or sharing your suggestions and ideas in a YouTrack issue. Your input and your use cases help shape the future of Amper!