Execution failed for task ':expo-file-system:compileDebugKotlin' on RN 0.66.4

See original GitHub issue

Summary

Using bare, clean react native application with rn 0.66.4, after installation expo-modules expo run:android doesn’t compile.

The reason why I’m using the newest RN version is that realm requires (https://github.com/realm/realm-js/issues/3940#issuecomment-924767386) at least 0.66.0.rc3.

Is there a workaround or known fix to make it work? Or should I wait for next expo release?

My build.gradle

buildscript {
    ext {
        buildToolsVersion = "30.0.2"
        minSdkVersion = 21
        compileSdkVersion = 30
        targetSdkVersion = 30
        ndkVersion = "21.4.7075529"
    }

LOG:

> Task :expo-file-system:compileDebugKotlin FAILED
e: /RD/error/node_modules/expo-file-system/android/src/main/java/expo/modules/filesystem/FileSystemModule.kt: (769, 36): Type mismatch: inferred type is String? but String was expected
e: /RD/error/node_modules/expo-file-system/android/src/main/java/expo/modules/filesystem/FileSystemModule.kt: (794, 107): Using 'parse(String): MediaType?' is an error. moved to extension function
e: /RD/error/node_modules/expo-file-system/android/src/main/java/expo/modules/filesystem/FileSystemModule.kt: (819, 40): Using 'body(): ResponseBody?' is an error. moved to val
e: /RD/error/node_modules/expo-file-system/android/src/main/java/expo/modules/filesystem/FileSystemModule.kt: (820, 39): Using 'code(): Int' is an error. moved to val
e: /RD/error/node_modules/expo-file-system/android/src/main/java/expo/modules/filesystem/FileSystemModule.kt: (821, 60): Using 'headers(): Headers' is an error. moved to val
e: /RD/error/node_modules/expo-file-system/android/src/main/java/expo/modules/filesystem/FileSystemModule.kt: (869, 18): Function invocation 'isCanceled()' expected
e: /RD/error/node_modules/expo-file-system/android/src/main/java/expo/modules/filesystem/FileSystemModule.kt: (879, 29): Using 'body(): ResponseBody?' is an error. moved to val
e: /RD/error/node_modules/expo-file-system/android/src/main/java/expo/modules/filesystem/FileSystemModule.kt: (882, 37): Using 'code(): Int' is an error. moved to val
e: /RD/error/node_modules/expo-file-system/android/src/main/java/expo/modules/filesystem/FileSystemModule.kt: (883, 58): Using 'headers(): Headers' is an error. moved to val
e: /RD/error/node_modules/expo-file-system/android/src/main/java/expo/modules/filesystem/FileSystemModule.kt: (903, 37): Using 'buffer(Source): BufferedSource' is an error. moved to extension function
e: /RD/error/node_modules/expo-file-system/android/src/main/java/expo/modules/filesystem/FileSystemModule.kt: (903, 49): Using 'source(InputStream): Source' is an error. moved to extension function
e: /RD/error/node_modules/expo-file-system/android/src/main/java/expo/modules/filesystem/FileSystemModule.kt: (906, 27): Using 'buffer(Sink): BufferedSink' is an error. moved to extension function
e: /RD/error/node_modules/expo-file-system/android/src/main/java/expo/modules/filesystem/FileSystemModule.kt: (906, 39): Using 'sink(File): Sink' is an error. moved to extension function
e: /RD/error/node_modules/expo-file-system/android/src/main/java/expo/modules/filesystem/FileSystemModule.kt: (937, 31): Using 'buffer(Sink): BufferedSink' is an error. moved to extension function
e: /RD/error/node_modules/expo-file-system/android/src/main/java/expo/modules/filesystem/FileSystemModule.kt: (937, 43): Using 'sink(File): Sink' is an error. moved to extension function
e: /RD/error/node_modules/expo-file-system/android/src/main/java/expo/modules/filesystem/FileSystemModule.kt: (938, 38): Using 'body(): ResponseBody?' is an error. moved to val
e: /RD/error/node_modules/expo-file-system/android/src/main/java/expo/modules/filesystem/FileSystemModule.kt: (942, 43): Using 'code(): Int' is an error. moved to val
e: /RD/error/node_modules/expo-file-system/android/src/main/java/expo/modules/filesystem/FileSystemModule.kt: (943, 64): Using 'headers(): Headers' is an error. moved to val
e: /RD/error/node_modules/expo-file-system/android/src/main/java/expo/modules/filesystem/FileSystemModule.kt: (1006, 57): Using 'body(): ResponseBody?' is an error. moved to val
e: /RD/error/node_modules/expo-file-system/android/src/main/java/expo/modules/filesystem/FileSystemModule.kt: (1101, 37): Using 'body(): ResponseBody?' is an error. moved to val
e: /RD/error/node_modules/expo-file-system/android/src/main/java/expo/modules/filesystem/FileSystemModule.kt: (1111, 37): Using 'code(): Int' is an error. moved to val
e: /RD/error/node_modules/expo-file-system/android/src/main/java/expo/modules/filesystem/FileSystemModule.kt: (1112, 58): Using 'headers(): Headers' is an error. moved to val
e: /RD/error/node_modules/expo-file-system/android/src/main/java/expo/modules/filesystem/FileSystemModule.kt: (1119, 19): Function invocation 'isCanceled()' expected
e: /RD/error/node_modules/expo-file-system/android/src/main/java/expo/modules/filesystem/FileSystemModule.kt: (1142, 30): Using 'buffer(Source): BufferedSource' is an error. moved to extension function
e: /RD/error/node_modules/expo-file-system/android/src/main/java/expo/modules/filesystem/FileSystemModule.kt: (1307, 31): Using 'size(): Int' is an error. moved to val

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':expo-file-system:compileDebugKotlin'.
> Compilation error. See log for more details

Managed or bare workflow? If you have ios/ or android/ directories in your project, the answer is bare!

bare

What platform(s) does this occur on?

Android

SDK Version (managed workflow only)

No response

Environment

Expo CLI 5.0.1 environment info: System: OS: macOS 12.0.1 Shell: 5.8 - /bin/zsh Binaries: Node: 12.19.0 - ~/.nvm/versions/node/v12.19.0/bin/node Yarn: 1.22.17 - ~/.yarn/bin/yarn npm: 6.14.8 - ~/.nvm/versions/node/v12.19.0/bin/npm Watchman: 2021.11.15.00 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.2 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.0.1, iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0 Android SDK: API Levels: 28, 30, 31 Build Tools: 28.0.3, 29.0.2, 30.0.2, 31.0.0 System Images: android-29 | Google Play Intel x86 Atom, android-30 | Google Play Intel x86 Atom IDEs: Android Studio: 3.6 AI-192.7142.36.36.6241897 Xcode: 13.1/13A1030d - /usr/bin/xcodebuild npmPackages: expo: ^44.0.0 => 44.0.0 react: 17.0.2 => 17.0.2 react-native: 0.66.4 => 0.66.4 npmGlobalPackages: eas-cli: 0.41.0 expo-cli: 5.0.1 Expo Workflow: bare

Reproducible demo

To reproduce, please run:

npx react-native init error
cd error
npx install-expo-modules
expo run:android

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:4
  • Comments:11

github_iconTop GitHub Comments

14reactions
jerry-inccommented, Jan 3, 2022

why was this issue closed? this is clearly not fixed yet

0reactions
lucassouza16commented, Nov 7, 2022

In my case, I was able to solve the problem by making this change in android/build.gradle:

I declared this variable:

def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())

Then I added this in allprojects:

configurations.all {
        resolutionStrategy {
            force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
        }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Execution failed for task ':react-native-webview ...
After upgrading react native from 0.61.2 to 0.68.2 with RN update helper, gradle cant build app.
Read more >
Troubleshooting - React Native
If you encounter a ShellCommandUnresponsiveException exception such as: Execution failed for task ':app:installDebug'.
Read more >
react native task :app:checkdebugaarmetadata failed - You.com
React Native error Task :app:checkDebugAarMetadata | Execution failed for ... The project was on RN-0.66.4 (I upgraded it to the recent version RN-0.70.4)....
Read more >
How to solve this error : r/reactnative - Reddit
My RN version is 0.66.4 * What went wrong: Execution failed for task ':app:checkDebugAarMetadata'. > Could not resolve all files for ...
Read more >
react native expo - Execution failed for task
Everything worked fine, build successfully, but when I execute the command eas build -p android --profile preview , it crashes/build-fails after ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found