Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: #1341

Open
LucasPabloGuzman opened this issue Apr 3, 2025 · 3 comments
Open

bug: #1341

LucasPabloGuzman opened this issue Apr 3, 2025 · 3 comments

Comments

@LucasPabloGuzman
Copy link

Provide environment information

Build fails on android on the latest version of this repo.

Describe the bug

Did all the steps and returns TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" when doing pnpm dlx expo prebuild --clean and wont run when doing pnpm android at all, it returns this error: Could not find method useExpoVersionCatalog() for arguments [] on extension 'expoAutolinking' of type expo.modules.plugin.ExpoAutolinkingSettingsExtension.

Link to reproduction

https://github.com/t3-oss/create-t3-turbo

To reproduce

Clone a clean copy, dopnpm i, cd apps/expo, pnpm dlx expo prebuild --clean and pnpm android. I will fail on the last two steps

Additional information

Im using windows 11, node v22.14.0.

@JacoboGanon
Copy link

Hello just wondering if you managed to fix this because I'm getting the same error

@psyrenpark
Copy link

psyrenpark commented Apr 5, 2025

Title: useExpoVersionCatalog() not recognized in settings.gradle

Description:
I'm encountering the same issue mentioned in [this PR](https://github.com/expo/expo/pull/35789/files), and it seems to be related to recent changes.

Error Log

> @acme/[email protected] android /apps/expo
> expo run:android

› Building app...
FAILURE: Build failed with an exception.

* Where:
Settings file '/apps/expo/android/settings.gradle' line: 36

* What went wrong:
A problem occurred evaluating settings 'memo'.
> Could not find method useExpoVersionCatalog() for arguments [] on extension 'expoAutolinking' of type expo.modules.plugin.ExpoAutolinkingSettingsExtension.

My settings.gradle snippet

plugins {
  id("com.facebook.react.settings")
  id("expo-autolinking-settings")
}

extensions.configure(com.facebook.react.ReactSettingsExtension) { ex ->
  if (System.getenv('EXPO_USE_COMMUNITY_AUTOLINKING') == '1') {
    ex.autolinkLibrariesFromCommand()
  } else {
    ex.autolinkLibrariesFromCommand(expoAutolinking.rnConfigCommand)
  }
}
expoAutolinking.useExpoModules()

rootProject.name = 'memo'

expoAutolinking.useExpoVersionCatalog() // <-- ERROR HERE

Environment

  • Expo SDK version: [53.0.0-canary-20250304-f08e984]
  • CLI: expo-cli and pnpm
  • Platform: Android
  • Monorepo setup: Yes (using Turborepo)

@SkinnyAG
Copy link

SkinnyAG commented Apr 7, 2025

Encountering the same error in my project. Tried cloning a fresh project from main, but still getting the error. I decided to take a look at the settings.gradle file in another team members repo, and his looked significantly different from mine. I am fairly certain the problem occured after running a clean prebuild.

To reproduce

  • Clone repo from main
  • Install dependencies
  • pnpx expo run:android
  • In an existing project with the old settings.gradle this can also be reproduced by running pnpx expo prebuild --clean

This gives me the same error as the person above

Environment

  • Expo SDK version: [53.0.0-canary-20250304-f08e984]
  • CLI: expo-cli and pnpm
  • Platform: Android
  • Monorepo setup: Yes (using Turborepo)

settings.gradle before clean prebuild

pluginManagement {
    includeBuild(new File(["node", "--print", "require.resolve('@react-native/gradle-plugin/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim()).getParentFile().toString())
}
plugins { id("com.facebook.react.settings") }

extensions.configure(com.facebook.react.ReactSettingsExtension) { ex ->
  if (System.getenv('EXPO_USE_COMMUNITY_AUTOLINKING') == '1') {
    ex.autolinkLibrariesFromCommand()
  } else {
    def command = [
      'node',
      '--no-warnings',
      '--eval',
      'require(require.resolve('expo-modules-autolinking', { paths: [require.resolve('expo/package.json')] }))(process.argv.slice(1))',
      'react-native-config',
      '--json',
      '--platform',
      'android'
    ].toList()
    ex.autolinkLibrariesFromCommand(command)
  }
}

rootProject.name = 'expo'

dependencyResolutionManagement {
  versionCatalogs {
    reactAndroidLibs {
      from(files(new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim(), "../gradle/libs.versions.toml")))
    }
  }
}

apply from: new File(["node", "--print", "require.resolve('expo/package.json')"].execute(null, rootDir).text.trim(), "../scripts/autolinking.gradle");
useExpoModules()

include ':app'
includeBuild(new File(["node", "--print", "require.resolve('@react-native/gradle-plugin/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim()).getParentFile())

settings.gradle after clean prebuild

pluginManagement {
  def reactNativeGradlePlugin = new File(
    providers.exec {
      workingDir(rootDir)
      commandLine("node", "--print", "require.resolve('@react-native/gradle-plugin/package.json', { paths: [require.resolve('react-native/package.json')] })")
    }.standardOutput.asText.get().trim()
  ).getParentFile().absolutePath
  includeBuild(reactNativeGradlePlugin)
  
  def expoPluginsPath = new File(
    providers.exec {
      workingDir(rootDir)
      commandLine("node", "--print", "require.resolve('expo-modules-autolinking/package.json', { paths: [require.resolve('expo/package.json')] })")
    }.standardOutput.asText.get().trim(),
    "../android/expo-gradle-plugin"
  ).absolutePath
  includeBuild(expoPluginsPath)
}

plugins {
  id("com.facebook.react.settings")
  id("expo-autolinking-settings")
}

extensions.configure(com.facebook.react.ReactSettingsExtension) { ex ->
  if (System.getenv('EXPO_USE_COMMUNITY_AUTOLINKING') == '1') {
    ex.autolinkLibrariesFromCommand()
  } else {
    ex.autolinkLibrariesFromCommand(expoAutolinking.rnConfigCommand)
  }
}
expoAutolinking.useExpoModules()

rootProject.name = 'expo'

expoAutolinking.useExpoVersionCatalog()

include ':app'
includeBuild(expoAutolinking.reactNativeGradlePlugin)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants