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

How to patch expo module build.gradle file for a managed expo workflow? #147

Open
aerielcruz opened this issue Feb 7, 2024 · 2 comments

Comments

@aerielcruz
Copy link

aerielcruz commented Feb 7, 2024

Gradle 8 Migration for Custom Expo Modules
https://github.com/expo/fyi/blob/main/expo-modules-gradle8-migration.md#error-task-current-target-is-17-and-compilereleasekotlin-task-current-target-is-11-jvm-target-compatibility-should-be-set-to-the-same-java-version

It says that you have to patch the build.gradle file of the expo module but am I supposed to edit it from node_modules?

An example would be expo-splash-screen

* What went wrong:
A problem occurred evaluating project ':expo-splash-screen'.
> Could not set unknown property 'classifier' for task ':expo-splash-screen:androidSourcesJar' of type org.gradle.api.tasks.bundling.Jar.

This issue only happens for Android and not iOS.

@aerielcruz
Copy link
Author

Fixed it! 🥳
This is what I did

  1. I started to run this command to see the relation of expo-splash-screen (replace this with the expo module)
    npm why expo-splash-screen
    
  2. This is the result
    [email protected]
    node_modules/expo-splash-screen
      expo-splash-screen@"~0.17.0" from [email protected]    
      node_modules/expo-app-loading
        expo-app-loading@"~2.1.1" from the root project
    
  3. I checked expo-app-loading and it is a deprecated package
  4. I uninstalled expo-app-loading, build again and voila problem solved! 😄

Even this solved my issue, I still want to know how to update the build.gradle file for a managed workflow.

@anhtuan219
Copy link

@aerielcruz You can use config plugin to modify the native files for a managed workflow
Here's an example that modifies file /android/app/build.gradle
If you want to modify file /android/build.gradle, use withProjectBuildGradle from @expo/config-plugins instead

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

2 participants