expo: unimodules-react-native-adapter:compileDebugJavaWithJavac FAILED
Summary

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 4.5.2 environment info: System: OS: Windows 10 10.0.19043 Binaries: Node: 14.17.0 - C:\Program Files\nodejs\node.EXE npm: 6.14.13 - C:\Program Files\nodejs\npm.CMD IDEs: Android Studio: Version 4.2.0.0 AI-202.7660.26.42.7351085 npmPackages: expo: ^41.0.0 => 41.0.0 react: 16.13.1 => 16.13.1 react-dom: 16.13.1 => 16.13.1 react-native: ~0.63.4 => 0.63.4 react-native-web: ~0.13.12 => 0.13.18 Expo Workflow: bare
Reproducible demo or steps to reproduce from a blank project
I was working on ubuntu before, I changed switched to windows and ran :
npm i
npm run android
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 8
- Comments: 33 (11 by maintainers)
+1 After updating to Expo SDK 42
@wbroek - something changes about the semantics when you run
./gradlew clean assembleReleasevs invoking the commands in two separate calls:this works as expected. do you happen to have any idea what the difference is between these approaches? we run the module list generation prior to gradle preBuild: https://github.com/expo/expo/blob/a3f3a9a724bfef6c351dc378258649b3769aaee7/packages/%40unimodules/react-native-adapter/android/build.gradle#L59
@rajeshde - try updating to node v14.7.3 and reinstalling node_modules as per the above comments
edit: 👋 @raajnadar
@brentvatne after some more investigation and some other eyes think I found the problem. As I mentioned in my previous comment I found it odd that the task
generateExpoModulesPackageListwas not mentioned in the task list at all and that it did not run (my debug statement was not printed) only at the beginning of the total build. This was because (what I could find) the value ofpreBuild.dependsOn(generateExpoModulesPackageList) is a direct reference to the task and is immediately executed when the build starts. Also why my debug statement was at the top of the build tasks. When you want to make it a value that the gradle can lookup to execute as a task we need to put into quotes (as they do in the Gradle documentation.So changed
preBuild.dependsOn generateExpoModulesPackageListtopreBuild.dependsOn "generateExpoModulesPackageList"Then not only did the build run correctly with
./gradlew clean assembleReleasebut it also was put down as a task in the build task list:Make a PR of it now and testing it with
bare-expo, which failed with the./gradlew clean assembleReleaseas wellI have the same error as this, after upgrading
react-native-unimodulesfrom v0.13.3 into v0.14.1.You’re right, running
cleanandbundleseparately works… Weird.Did some more investigation in why this does not work on Appcenter for us, but locally it did.
First tried to manual run the Gradle task for creating the
ExpoModulesPackageListwhich after some searching I think is/gradlew :unimodules-react-native-adapter:generateExpoModulesPackageListbut this also did not generate the filenode_modules/@unimodules/react-native-adapter/android/build/generated/expo/src/main/java/org/unimodules/adapters/react/ExpoModulesPackageList.javaon Appcenter system.The gradle task runs the newly written commands (in typescript) with the following command:
When we ran this on Appcenter the file was created but the build still failed with the same error
error: cannot find symbol mModuleRegistryProvider = new ReactModuleRegistryProvider(new ExpoModulesPackageList().getPackageList(), null);Looked like the file was removed again so when we looked at the build command we saw the one below
Besides the DAPPCENTER_BUILD_VERSION which Appcenter adds to the line we see it uses a global gradle, runs from the project root (not the android folder) and does a clean before building.
When I run this command on my local machine it indeed failed with the same error message. Then I downloaded the example from @brentvatne on https://github.com/brentvatne/achmadk and made a build with the same command it also failed. Then I removed all parameters except the
cleanandassembleReleaseit still fails. If I remove the clean command and only doassembleReleaseit works?So to reproduce:
android/gradlew -p android clean assembleReleasenpx react-native doctoroutput:Upgraded react-native-unimodules to latest (as for now 0.14.3) and installing Node v14.7.3 resolved the issue on Bitrise
I did have this issue with Node v10.14.1, after upgrading to v14.17.2 and reinstalling the dependencies it worked fine for me.
Upgrading node from v12 to v14 and applying that patch worked for me!
Same error with react-native-unimodules@0.14.3
Same error after upgrading to Expo SDK42 !
cd android && ./gradlew cleandoesn’t do anything.