Reputation: 65
I created a react native app using
expo init AwesomeProject
I chose bare workflow.
As soon as I try to run the app using yarn android
, the build crashes.
This is the error:
> Task :unimodules-react-native-adapter:compileDebugJavaWithJavac FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.8/userguide/command_line_interface.html#sec:command_line_warnings
284 actionable tasks: 284 executed
C:\Users\prana\Desktop\new-app\new-app\SphereV2\node_modules\expo-modules-autolinking\build\index.js:14
.option('-i, --ignore-paths <ignorePaths...>', 'Paths to ignore when looking up for modules.', (value, previous) => (previous ?? []).concat(value))
^
SyntaxError: Unexpected token '?'
at wrapSafe (internal/modules/cjs/loader.js:1053:16)
at Module._compile (internal/modules/cjs/loader.js:1101:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Module.require (internal/modules/cjs/loader.js:1025:19)
at require (internal/modules/cjs/helpers.js:72:18)
at [eval]:1:1
at Script.runInThisContext (vm.js:120:18)
at Object.runInThisContext (vm.js:309:38)
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: C:\Users\prana\Desktop\new-app\new-app\SphereV2\node_modules\expo-application\android\src\main\java\expo\modules\application\ApplicationModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Users\prana\Desktop\new-app\new-app\SphereV2\node_modules\expo-updates\android\src\main\java\expo\modules\updates\UpdatesConfiguration.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: C:\Users\prana\Desktop\new-app\new-app\SphereV2\node_modules\expo-constants\android\src\main\java\expo\modules\constants\ConstantsService.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Users\prana\Desktop\new-app\new-app\SphereV2\node_modules\expo-file-system\android\src\main\java\expo\modules\filesystem\FileSystemModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Users\prana\Desktop\new-app\new-app\SphereV2\node_modules\expo-file-system\android\src\main\java\expo\modules\filesystem\FileSystemModule.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
C:\Users\prana\Desktop\new-app\new-app\SphereV2\node_modules\@unimodules\react-native-adapter\android\src\main\java\org\unimodules\adapters\react\ModuleRegistryAdapter.java:26: error: cannot find symbol
mModuleRegistryProvider = new ReactModuleRegistryProvider(new ExpoModulesPackageList().getPackageList(), null);
^
symbol: class ExpoModulesPackageList
location: class ModuleRegistryAdapter
1 error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':unimodules-react-native-adapter:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 5m 40s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
C:\Users\prana\Desktop\new-app\new-app\SphereV2\node_modules\expo-modules-autolinking\build\index.js:14
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
enter code here
This is my environment after running react-native info
:
System:
OS: Windows 10 10.0.19043
CPU: (8) x64 Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz
Memory: 682.79 MB / 7.79 GB
Binaries:
Node: 12.18.3 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.10 - ~\AppData\Roaming\npm\yarn.CMD
npm: 6.14.6 - C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK: Not Found
Windows SDK: Not Found
IDEs:
Android Studio: Version 4.1.0.0 AI-201.8743.12.41.6953283
Visual Studio: Not Found
Languages:
Java: 11.0.2
Python: 3.8.4
npmPackages:
@react-native-community/cli: Not Found
react: 16.13.1 => 16.13.1
react-native: ~0.63.4 => 0.63.4
react-native-windows: Not Found
npmGlobalPackages:
*react-native*: Not Found
/android/gradle/wrapper/gradle-wrapper.properites:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
/android/build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "29.0.3"
minSdkVersion = 21
compileSdkVersion = 30
targetSdkVersion = 30
}
repositories {
google()
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:4.1.0")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
google()
jcenter()
maven { url 'https://www.jitpack.io' }
}
}
The current Gradle version on my system is Gradle 6.8. I have tried using Gradle 7.0 as well, and in that case, I end up getting an error saying:
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
Does anyone know how to fix this?? I am running the latest expo SDK version 42.
Upvotes: 5
Views: 5492
Reputation: 465
You need to setup Node v16
In linux, Android studio uses the Node under /usr/local/bin/node
.
If you still get this issue even though node --version returns v16.14.0
, you need to update the symbolic link
sudo ln -s $(which node) /usr/local/bin/node
Upvotes: 0
Reputation: 11
I had a similar issue after install expo-location
plugin, in my case installing expo-modules-autolinking
the error go away, maybe you wanna try it 🥷
Upvotes: 1
Reputation: 65
this was a bug when running on windows. uninstall react-native-unimodules and reinstall it to get the latest version of @unimodules/react-native-adapter (6.3.3)
Upvotes: 1
Reputation: 24
expo-modules-autolinking is built for esnext. This is why ??
operator is unrecognized in the index.js file.
You can update to node v16
Or recompiled it for es5 by changing target in tsconfig.json of the expo-modules-autolinking module. Then by doing cd node_modules/expo-modules-autolinking
, I recompiled it with npx tsc
command
Upvotes: 0