Skip to content

Android Build Fails in Expo Project due to minSdkVersion and Gradle Dependency Errors #29

@dunapanta

Description

@dunapanta

I am attempting to integrate react-native-godot into a standard Expo project. While the integration works perfectly on iOS, the build process for Android fails due to what appears to be two separate issues related to project configuration and Gradle dependency resolution.

Environment:
react-native-godot: 1.0.1
LibGodot: 4.5.1.migeran.2 (using Godot Engine 4.5.1)
expo: ~54.0.32
react-native: 0.81.5
OS: macOS

Problem Breakdown:
Step 1: Godot Project Export (Successful)
First, I export the Godot project for Android using the provided scripts. This step appears to complete without any critical errors. The script successfully packages the project into a .zip file and inflates it into the android/app/src/main/assets/skeleton directory.

$ ./export_godot_skeleton.sh android

# ... (Godot Engine initialization logs) ...
[   0% ] savezip | Started Empaquetando (102 steps)
# ... (savezip logs showing all files being archived) ...
[ DONE ] savezip

cannot connect to daemon at tcp:5037: Connection refused
Archive:  /Users/danielunapanta/Desktop/projects/tiktok-game/android/app/src/main/assets/skeleton.zip
  inflating: .godot/imported/cloud_1.png-d9f3821e0d58b8b79ac7a8bc81287ae8.ctex
  # ... (all files inflated successfully) ...
  inflating: project.binary

The cannot connect to daemon message appears but does not seem to stop the export process.

Step 2: Android Build Failure (npx expo run:android)
When I try to build the native Android app, the process fails. The logs reveal two underlying problems:

  1. minSdkVersion is Incorrectly Set to 24

The build log clearly shows that Gradle is configured with minSdk: 24, even though react-native-godot requires API 29+ for its native C++ code (AChoreographer_postFrameCallback64).

> Configure project :
[ExpoRootProject] Using the following versions:
  - buildTools:  36.0.0
  - minSdk:      24  <-- PROBLEM HERE
  - compileSdk:  36
  - targetSdk:   36

This happens even after setting "minSdkVersion": 29 in app.json and running npx expo prebuild --clean. The Expo configuration is not being correctly applied to the native Android project, which leads to C++ compilation errors if the dependency issue were resolved.

  1. Gradle Fails to Resolve libgodot SNAPSHOT Dependency

This is the error that ultimately stops the build. Gradle cannot find the required libgodot library, even though it was downloaded by the yarn download-prebuilt script.

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not resolve all dependencies for configuration ':app:debugCompileClasspath'.
   > Could not find com.migeran.libgodot:godot-debug:4.5.1.migeran.2-SNAPSHOT.
     Required by:
         project :app > project :borndotcom_react-native-godot

It seems that Gradle is unable to map the generic -SNAPSHOT version to the actual timestamped .aar file that was downloaded. Attempts to fix this by cleaning the build or using --refresh-dependencies have not worked.

Summary
The combination of Expo's failure to set the correct minSdkVersion and Gradle's inability to resolve the SNAPSHOT dependency makes the library unusable on Android within a standard Expo workflow. Given that the iOS build works flawlessly, this points to specific issues in the Android native configuration and dependency management scripts.

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