Tag: gradle

  • Emoji error! Using the latest Compose with compileSDK < 34

    Emoji error! Using the latest Compose with compileSDK < 34

    Wanting to use the latest versions of Compose, but your app compileSdk is falling behind? I’ve been there! If you have a compileSdk < 34 but want to use Compose version > 1.5.0 you’ll come across a horrid build error. Let’s fix that! The error is question is this: Compose dependencies with a version >…

  • Setting JDK level in Android Gradle builds

    Setting JDK level in Android Gradle builds

    The correct, complete, 2024, settings to configure the Java version in Gradle for Android.

  • build.gradle.kts conversion for Android Studio Empty Activity

    build.gradle.kts conversion for Android Studio Empty Activity

    Quick blog posting showing you the build.gradle.kts version of the default build.gradle file from the “empty activity” Android Studio template. This post will go stale fast, get it whilst its hot. 🙂 The original templates come from the New Project, other templates are explained here: https://developer.android.com/studio/projects/templates Google has an explainer of converting build configuration scripts…

  • Applying a 3rd Party Gradle Plugin as a Composite Plugin

    Applying a 3rd Party Gradle Plugin as a Composite Plugin

    This post shows you how to wrap a 3rd party Gradle plugin in your own plugin, so that you can interactive with it programmatically.

  • Make a monorepo for your Android projects

    Make a monorepo for your Android projects

    This post describes how you can share code between your side projects without code duplication, remote hosting or versioning.

  • Speed up your build: Non-transitive R files

    Speed up your build: Non-transitive R files

    Non-transitive R files became available to all modules in AGP 4.2. Non-transitive R files allow your builds to be incrementally faster and your AAB/APK’s smaller. This post will explain how to implement and build your app with non-transitive R files. Non-transitive what? In mathematics, non-transitivity is a property of binary relations that are not transitive relations.…

  • Tame Your Gradle Dependencies just BECAUSE!

    Did you know you can specify a reason for using a certain dependency or certain version of a dependency? Yep it’s in the API here and referenced in the DOCS here. void because?(@Nullable String reason) Sets the reason why this dependency should be used. Since: 4.6 Below is a basic example of how its used:…

  • Use the latest version of any library with Android Studio & Gradle

    Isn’t it annoying whenever you want to add a new dependency to your project you have to know the exact version to add, not any more! This ‘hack’ makes use of the Gradle + syntax that allows you to not specify a version of the application. However using + syntax in your code is dangerous…

  • [TUT] Android Gradle App with Espresso Instrumentation tests

    This tutorial will show you the skeleton of an Android application that uses the Gradle build system and runs Espresso Instrumentation tests on Android classes. This follows on from my tutorials about Robolectric JUnit tests & JVM JUnit tests, you can have Espresso tests without Robolectric or JVM tests, but the idea is they all…

  • [TUT] Android Gradle App with Robolectric JUnit tests

    This tutorial will show you the skeleton of an Android application that uses the Gradle build system and runs Robolectric JUnit tests on Android classes. This follows on from my tutorial about JVM JUnit tests, you can have one type of testing without the other. For instance you could bundle all your JVM tests inside…

  • [TUT] Android Gradle App with JVM JUnit tests

    This tutorial will show you the skeleton of an Android application that uses the Gradle build system and runs JUnit tests on java classes. If your here and reading this, I assume you already know Android code runs on Dalvik and the SDK’s used when developing on a computer are stubs. (Hence the Stub! exception…

  • [TUT] Setting up Android Studio & Gradle [windows 7]

    This is a simple walk through of setting up the new Android Studio IDE and Gradle. Gradle is the new build system for all Android projects. Prerequisites: you have a JDK installed. JAVA_HOME is set. (you can test this by typing java -version in a console) warning: This post is very image heavy, so get…