Cannot build expo-gl using unimodules

Please provide the following:

  1. SDK Version: expo-gl:10.1.0, “react-native-unimodules”: “^0.12.0”,
  2. Platforms(Android/iOS/web/all):Android

I am trying to add expo-three and expo-gl to my existing react-native app using unimodules

I followed the instructions here: Installing react-native-unimodules - Expo Documentation and was able to get it to work on ios (with a few more steps with the bridge delegate) but I cannot get it working on android.

I end up with this error

app/node_modules/expo-gl/android/src/main/java/expo/modules/gl/GLObject.java:3: error: package expo.modules.gl.cpp does not exist

If i remove expo-gl then this will all compile, so it is something to do with that package.

I have these versions:
“expo-gl”: “^10.1.0”,
“expo-gl-cpp”: “^10.0.0”,
“expo-three”: “^5.6.2”,
“react-native-unimodules”: “^0.12.0”,

buildscript {
    repositories {
        maven { url 'https://plugins.gradle.org/m2/'}
    }
    dependencies {
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.4, 0.99.99]'
    }
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply from: '../../node_modules/react-native-unimodules/gradle.groovy'
repositories {
    maven { url 'https://maven.google.com' }
}

buildscript {
    repositories {

        mavenCentral()
    }


    
}
apply plugin: "com.android.application"

repositories {
    google()
    mavenCentral()

}

import com.android.build.OutputFile


repositories {
    mavenCentral()
}

project.ext.react = [
    enableHermes: false
]

apply from: "../../node_modules/react-native/react.gradle"

def enableSeparateBuildPerCPUArchitecture = false

def enableProguardInReleaseBuilds = false

def useIntlJsc = false

android {
    signingConfigs {
        release {
            storeFile file(MYAPP_RELEASE_STORE_FILE)
            storePassword MYAPP_RELEASE_STORE_PASSWORD
            keyAlias MYAPP_RELEASE_KEY_ALIAS
            keyPassword MYAPP_RELEASE_KEY_PASSWORD
        }
    }
    defaultConfig {
        resConfigs "en", "US" , "es"

    }
    compileSdkVersion rootProject.ext.compileSdkVersion

    dexOptions {
        javaMaxHeapSize "3g"
    } 
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        applicationId "com.myapp"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 109
        versionName "1.8.12"
        multiDexEnabled true
         manifestPlaceholders = [onesignal_app_id: "<ID>",
                                onesignal_google_project_number: "REMOTE"]
        ndk {
            abiFilters  "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
        }
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
        }
    }
    buildTypes {
        release {
            // Caution! In production, you need to generate your own keystore file.
            // see https://facebook.github.io/react-native/docs/signed-apk-android.
            minifyEnabled enableProguardInReleaseBuilds
            signingConfig signingConfigs.release
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
       
    }

    packagingOptions {
        pickFirst "lib/armeabi-v7a/libc++_shared.so"
        pickFirst "lib/arm64-v8a/libc++_shared.so"
        pickFirst "lib/x86/libc++_shared.so"
        pickFirst "lib/x86_64/libc++_shared.so"
    }

    // applicationVariants are e.g. debug, release
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }
        }
    }
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    //noinspection GradleDynamicVersion
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'androidx.annotation:annotation:1.0.2'
    implementation 'com.facebook.soloader:soloader:0.5.1'
   
    implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"


    debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
      exclude group:'com.facebook.fbjni'
    }
    debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
        exclude group:'com.facebook.flipper'
    }
    debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
        exclude group:'com.facebook.flipper'
    }
    
    implementation 'com.onesignal:OneSignal:[3.11.2, 3.99.99]'
    
    implementation 'com.google.firebase:firebase-analytics:17.2.2'
    implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
    implementation 'com.facebook.android:facebook-android-sdk:[5,6)'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'


     addUnimodulesDependencies([
            exclude      : [
                    // You can exclude unneeded modules here, e.g.,
                    // 'unimodules-face-detector-interface',
                    'expo-av',
                    
                    'expo-image-loader',
                    'expo-permissions',
                    'unimodules-image-loader-interface',
                    'unimodules-permissions-interface',
                    'unimodules-sensors-interface',
                    'unimodules-task-manager-interface',
                    'unimodules-face-detector-interface',
                    'unimodules-barcode-scanner-interface',
                    'unimodules-font-interface',
                    'unimodules-camera-interface',
                    // Adding a name here will also remove the package
                    // from auto-generated BasePackageList.java
            ]
    ])

    // JSC from node_modules
    if (useIntlJsc) {
        implementation 'org.webkit:android-jsc-intl:+'
    } else {
        implementation 'org.webkit:android-jsc:+'
    }

}
 
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}

apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
apply plugin: 'com.google.gms.google-services'
apply plugin: 'io.fabric'

Further information:

I tried loading it in android studio and I got the error

“No variants found for ‘expo-gl-cpp’. Check build files to ensure at least one variant exists.”

I have no idea what this means

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.