Skip to content

Android app not building properly #28

@Nesh108

Description

@Nesh108

Hello, thanks for the great package!

I have tried using it on Expo 50 and I got:

* What went wrong:
A problem occurred evaluating project ':bam-tech-react-native-app-security'.
> Failed to apply plugin class 'KotlinExpoModulesCorePlugin'.
   > Could not find method android() for arguments [KotlinExpoModulesCorePlugin$_apply_closure4@4db431f8] on project ':bam-tech-react-native-app-security' of type org.gradle.api.Project.

Looking at build.gradle, I made this change:

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'maven-publish'

// --- MOVED THE EXPO PLUGIN APPLICATION HERE ---
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
if (expoModulesCorePlugin.exists()) {
  apply from: expoModulesCorePlugin
  applyKotlinExpoModulesCorePlugin()
}
// ---------------------------------------------

group = 'tech.bam.rnas'
version = '0.1.0'

buildscript {
  // --- REMOVED THE "apply from" FROM INSIDE THIS BLOCK ---

  // Simple helper that allows the root project to override versions declared by this library.
  ext.safeExtGet = { prop, fallback ->
    rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
  }

  // Ensures backward compatibility
  ext.getKotlinVersion = {
    if (ext.has("kotlinVersion")) {
      ext.kotlinVersion()
    } else {
      ext.safeExtGet("kotlinVersion", "1.8.10")
    }
  }
...

That allowed me to build it properly. Just wanted to report it 👍

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions