For Android Gradle Plugin 8.0 and newer, it’s necessary to use our Gradle plugin 2.0.0+. Please follow instructions below.

Backup your resources #️⃣

If you already have existing translations into other languages, backup your resources before using Localazy Gradle plugin! Due to internal changes introduced to AGP 8.0+, we can no longer process your resources without modifying them as we could in the previous versions.

We never touch your values folder and never modify it! In locale-based folders (values-fr, values-de, etc.) we scan all XML files, remove known strings, string arrays and plurals that are already translated on Localazy and generate a new file strings_localazy.xml with updated translations.

Please do not modify strings_localazy.xml. It’s automatically generated and changes would be lost on the next build.

Do not worry, we never modify your source code or anything else except for strings, string arrays and plurals.

Gradle with Kotlin DSL #️⃣

1. Open Android Studio, locate gradle.build.kts file in your project’s root directory and create a new buildscript section. The resulting file should look like:

buildscript {  
    repositories {  
        maven { 
	        setUrl("https://maven.localazy.com/repository/release/")
        } 
    }  
    dependencies {  
        classpath("com.localazy:gradle:2.0.1")
    }    
}  
  
plugins {  
  id("com.android.application") version "8.1.4" apply false  
  id("org.jetbrains.kotlin.android") version "1.8.10" apply false  
}

2. Open the settings.gradle.kts file and add Localazy repository https://maven.localazy.com/repository/release/ like this:

pluginManagement {  
    repositories {  
        google()  
        mavenCentral()  
        gradlePluginPortal()  
    }  
}  
dependencyResolutionManagement {  
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)  
    repositories {          
        google()  
        mavenCentral()  
        maven { 
	        setUrl("https://maven.localazy.com/repository/release/")
        }  
    }  
} 

rootProject.name = "my-awesome-app"  
include(":app")

3. Open gradle.build.kts file in your app’s module and add following snippet a the end of the file:

// Always be sure to add this after android { ... } section
apply(plugin = "com.localazy.gradle")
 
localazy {
    readKey = "the-read-key-for-the-project"
    writeKey = "the-write-key-for-the-project"
}

Read more about injection options to configure what type of library is injected and whether OTA updates are available for all users or loyal ones only.

Now, you can configure the plugin.

Gradle with Groovy #️⃣

1. Open Android Studio, locate gradle.build file in your project’s root directory and create a new buildscript section. The resulting file should look like:

buildscript {  
    repositories {  
        maven { url "https://maven.localazy.com/repository/release/" } 
    }  
    dependencies {  
        classpath "com.localazy:gradle:2.0.1"  
    }    
}  
  
plugins {  
    id 'com.android.application' version '8.1.4' apply false  
    id 'org.jetbrains.kotlin.android' version '1.8.10' apply false  
}

2. Open the settings.gradle file and add Localazy repository https://maven.localazy.com/repository/release/ like this:

pluginManagement {  
    repositories {  
        google()  
        mavenCentral()  
        gradlePluginPortal()  
    }  
}  
dependencyResolutionManagement {  
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)  
    repositories {  
        maven { url "https://maven.localazy.com/repository/release/" }  
        google()  
        mavenCentral()  
    }  
}  

rootProject.name = "my-awesome-app"  
include ':app'

3. Open gradle.build file in your app’s module and add following snippet a the end of the file:

// Always be sure to add this after android { ... } section
apply plugin: 'com.localazy.gradle'
 
localazy {
    readKey "the-read-key-for-the-project"
    writeKey "the-write-key-for-the-project"
}

Read more about injection options to configure what type of library is injected and whether OTA updates are available for all users or loyal ones only.

Now, you can configure the plugin.

Git Tip #️⃣

You can safely mark strings_localazy.xml as ignored in your .gitignore as it can be restored from Localazy any time needed.