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

[Android] Build failed compileDebugKotlin; Expo 49 & Router v2 #23590

Closed
rnnyrk opened this issue Jul 18, 2023 · 4 comments
Closed

[Android] Build failed compileDebugKotlin; Expo 49 & Router v2 #23590

rnnyrk opened this issue Jul 18, 2023 · 4 comments
Labels
Development Builds needs review Issue is ready to be reviewed by a maintainer outdated

Comments

@rnnyrk
Copy link

rnnyrk commented Jul 18, 2023

Summary

I'm trying to create an example with Expo Router V2 and Social Authentication with Supabase for everyone to use. Although I'm struggling a lot with building my project.

Building on iOS works without any issues, but it seems like I can't build the project for Android.

After running expo prebuild && expo run:android

I keep running into the error:

Execution failed for task ':expo-modules-core:compileDebugKotlin'.

Screenshot 2023-07-18 at 14 36 42

I've been trying everything I can find on the internet to make it work.

  • pinning Kotlin versions in build.gradle
  • Changing JDK versions
  • Adding android.defaults.buildfeatures.buildconfig=true in gradle.properties, because without that I run into defaultConfig contains custom BuildConfig fields, but the feature is disabled. error constantly.
  • All the changes to fix to Android build are in this commit
  • Removing react-native-reanimated as suggested over here

Seems like there is very little to find about the issues I'm encountering. So any help would be appreciated a lot.

Managed or bare workflow?

bare

What platform(s) does this occur on?

Android

Package versions

    "app-icon-badge": "0.0.12",
    "dotenv": "16.3.1",
    "expo": "^49.0.3",
    "expo-application": "~5.3.0",
    "expo-build-properties": "~0.8.3",
    "expo-constants": "~14.4.2",
    "expo-dev-client": "~2.4.6",
    "expo-linking": "~5.0.2",
    "expo-router": "2.0.0",
    "expo-secure-store": "~12.3.1",
    "expo-splash-screen": "~0.20.4",
    "expo-status-bar": "~1.6.0",
    "expo-system-ui": "2.4.0",
    "expo-web-browser": "~12.3.2",
    "react-native-gesture-handler": "~2.12.0",
    "react-native-reanimated": "~3.3.0",
    "react-native-safe-area-context": "4.6.3",
    "react-native-screens": "~3.22.0",
    "react-native-svg": "13.9.0",
    "react-native-url-polyfill": "1.3.0",
    "typescript": "5.1.6"

Environment


  expo-env-info 1.0.5 environment info:
    System:
      OS: macOS 13.4.1
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 18.16.1 - ~/.nvm/versions/node/v18.16.1/bin/node
      npm: 9.5.1 - ~/.nvm/versions/node/v18.16.1/bin/npm
      Watchman: 2023.07.03.00 - /opt/homebrew/bin/watchman
    Managers:
      CocoaPods: 1.12.1 - /usr/local/bin/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4
      Android SDK:
        API Levels: 32, 33, 34
        Build Tools: 30.0.3, 34.0.0
        System Images: android-34 | Google APIs ARM 64 v8a
    IDEs:
      Android Studio: 2022.2 AI-222.4459.24.2221.10121639
      Xcode: 14.3.1/14E300c - /usr/bin/xcodebuild
    npmPackages:
      expo: ^49.0.3 => 49.0.3
      react: 18.2.0 => 18.2.0
      react-dom: 18.2.0 => 18.2.0
      react-native: 0.72.3 => 0.72.3
    npmGlobalPackages:
      eas-cli: 3.15.1
      expo-cli: 6.3.10
    Expo Workflow: bare

Reproducible demo

The code over here is as minimum as possible for my use case https://github.com/rnnyrk/expo-router-supabase-social-auth.

EDIT

I just found out that building the project through Android Studio works. Although this messes with my environment settings. So help on fixing the npm run android and e.g. npm run android:production commands are more than welcome.

@rnnyrk rnnyrk added Development Builds needs validation Issue needs to be validated labels Jul 18, 2023
@rnnyrk rnnyrk changed the title [Android] Build failed [Android] Build failed (Expo Router V2) Jul 18, 2023
@expo-bot expo-bot added needs review Issue is ready to be reviewed by a maintainer and removed needs validation Issue needs to be validated labels Jul 18, 2023
@rnnyrk rnnyrk changed the title [Android] Build failed (Expo Router V2) [Android] Build failed compileDebugKotlin; Expo 49 & Router v2 Jul 18, 2023
@qalqi
Copy link

qalqi commented Jul 18, 2023

+1

@rnnyrk
Copy link
Author

rnnyrk commented Jul 18, 2023

I fixed my issues. After running a clean prebuild with expo prebuild --clean, I finally ran into this error:
Screenshot 2023-07-18 at 21 43 44

Which I solved by locating all my installed java version and removing every one except v11.
To locate: /usr/libexec/java_home -V
Remove with rm -rf. After that I had no issues building anymore

@rnnyrk rnnyrk closed this as completed Jul 18, 2023
@frozencap
Copy link

encountering this problem as well
removing java versions like that just sounds dangerous
surely there is a more precise solution ?

@stefan-schweiger
Copy link
Contributor

@shawarmaz as far as I can see the problem is solved with expo-modules-core@1.5.9. You can either use overrides in your package.json or force expo to version "^49.0.7".

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development Builds needs review Issue is ready to be reviewed by a maintainer outdated
Projects
None yet
Development

No branches or pull requests

5 participants