Socket
Book a DemoInstallSign in
Socket

expo-gradle-ext-vars

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

expo-gradle-ext-vars

Expo plugin to append custom vars to the root android/build.gradle

0.1.3
latest
Source
npmnpm
Version published
Weekly downloads
8.9K
2.81%
Maintainers
1
Weekly downloads
 
Created
Source

expo-gradle-ext-vars

By Transistor Software, creators of React Native Background Geolocation

A simple Expo Config Plugin for appending Android ext vars to the android/build.gradle. ext vars are a common Android method for configuring project-wide, global configuration properties which can be shared by other plugins in order to avoid dependency conflicts.

A common usage of ext vars is to align Google / AndroidX dependency version across different plugins using the same dependencies. For example:

dependencies {
    implementation "androidx.appcompat:appcompat:${rootProject.ext.appCompatVersion}"
    implementation "com.google.android.gms:play-services-location:${rootProject.ext.playServicesLocationVersion}"
}

Example Result: android/build.gradle

import org.apache.tools.ant.taskdefs.condition.Os

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
+       // @generated begin expo-gradle-ext-vars - expo prebuild (DO NOT MODIFY) sync-8c85b9ad3863726565f7eff0645ac3f5c56ce733
+       googlePlayServicesLocationVersion = "20.0.0"
+       appCompatVersion = "1.4.2"
+       // @generated end expo-gradle-ext-vars

        buildToolsVersion = findProperty('android.buildToolsVersion') ?: '31.0.0'
        minSdkVersion = Integer.parseInt(findProperty('android.minSdkVersion') ?: '21')
        compileSdkVersion = Integer.parseInt(findProperty('android.compileSdkVersion') ?: '31')
        targetSdkVersion = Integer.parseInt(findProperty('android.targetSdkVersion') ?: '31')
        if (findProperty('android.kotlinVersion')) {
            kotlinVersion = findProperty('android.kotlinVersion')
        }
        frescoVersion = findProperty('expo.frescoVersion') ?: '2.5.0'

        if (System.properties['os.arch'] == 'aarch64') {
            // For M1 Users we need to use the NDK 24 which added support for aarch64
            ndkVersion = '24.0.8215888'
        } else {
            // Otherwise we default to the side-by-side NDK version from AGP.
            ndkVersion = '21.4.7075529'
        }
    }
 }

Installation

npx expo install expo-gradle-ext-vars

Usage

Add the following block to your Expo app's app.json.

:warning: The variables below are only an example. You should only provide variables as prescribed by some other plugin you're installing.

{
  "expo": {
    "plugins": [
      [
        "expo-gradle-ext-vars", {
          "googlePlayServicesLocationVersion": "20.0.0",
          "appCompatVersion": "1.4.2"
        }
      ]
    ]
 }

After adding the plugin, run:

npx expo prebuild

Keywords

react-native

FAQs

Package last updated on 05 May 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.