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

Summary

image

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)

Most upvoted comments

+1 After updating to Expo SDK 42

@wbroek - something changes about the semantics when you run ./gradlew clean assembleRelease vs invoking the commands in two separate calls:

./gradlew clean
./gradlew assembleRelease

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 generateExpoModulesPackageList was 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 of preBuild.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 generateExpoModulesPackageList to preBuild.dependsOn "generateExpoModulesPackageList"

Then not only did the build run correctly with ./gradlew clean assembleRelease but it also was put down as a task in the build task list:

> Task :unimodules-react-native-adapter:clean
> Task :unimodules-react-native-adapter:generateExpoModulesPackageList    <--** task name
generateExpoModulesPackageList DEBUG                                      <--** debug statement

> Task :unimodules-react-native-adapter:preBuild
> Task :unimodules-react-native-adapter:preReleaseBuild
> Task :unimodules-react-native-adapter:compileReleaseAidl NO-SOURCE
> Task :unimodules-react-native-adapter:packageReleaseRenderscript NO-SOURCE
> Task :unimodules-react-native-adapter:writeReleaseAarMetadata FROM-CACHE
> Task :unimodules-react-native-adapter:mergeReleaseShaders FROM-CACHE
> Task :unimodules-react-native-adapter:compileReleaseShaders NO-SOURCE
> Task :unimodules-react-native-adapter:generateReleaseAssets UP-TO-DATE
> Task :unimodules-react-native-adapter:packageReleaseAssets FROM-CACHE
> Task :unimodules-react-native-adapter:compileReleaseRenderscript NO-SOURCE
> Task :unimodules-react-native-adapter:generateReleaseResValues FROM-CACHE
> Task :unimodules-react-native-adapter:generateReleaseResources UP-TO-DATE
> Task :unimodules-react-native-adapter:packageReleaseResources FROM-CACHE
> Task :unimodules-react-native-adapter:extractDeepLinksRelease FROM-CACHE
> Task :unimodules-react-native-adapter:processReleaseManifest FROM-CACHE
> Task :unimodules-react-native-adapter:compileReleaseLibraryResources FROM-CACHE
> Task :unimodules-react-native-adapter:parseReleaseLocalResources FROM-CACHE
> Task :unimodules-react-native-adapter:generateReleaseRFile FROM-CACHE
> Task :unimodules-react-native-adapter:generateReleaseBuildConfig FROM-CACHE
> Task :unimodules-react-native-adapter:compileReleaseKotlin FROM-CACHE
> Task :unimodules-react-native-adapter:javaPreCompileRelease FROM-CACHE

Make a PR of it now and testing it with bare-expo, which failed with the ./gradlew clean assembleRelease as well

I have the same error as this, after upgrading react-native-unimodules from v0.13.3 into v0.14.1.

@wbroek - something changes about the semantics when you run ./gradlew clean assembleRelease vs invoking the commands in two separate calls:

./gradlew clean
./gradlew assembleRelease

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

You’re right, running clean and bundle separately 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 ExpoModulesPackageList which after some searching I think is /gradlew :unimodules-react-native-adapter:generateExpoModulesPackageList but this also did not generate the file node_modules/@unimodules/react-native-adapter/android/build/generated/expo/src/main/java/org/unimodules/adapters/react/ExpoModulesPackageList.java on Appcenter system.

The gradle task runs the newly written commands (in typescript) with the following command:

node --eval  "require('expo-modules-autolinking')(process.argv.slice(1))" -- generate-package-list --platform android --namespace org.unimodules.adapters.react --target node_modules/@unimodules/react-native-adapter/android/build/generated/expo/src/main/java/org/unimodules/adapters/react/ExpoModulesPackageList.java --empty

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

/Users/runner/work/1/s/android/gradlew -DAPPCENTER_BUILD_VERSION=289 -DMOBILECENTER_BUILD_VERSION=289 -p android clean :app:assembleRelease

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 clean and assembleRelease it still fails. If I remove the clean command and only do assembleRelease it works?

So to reproduce:

npx react-native doctor output:

Common
 ✓ Node.js
 ✓ yarn
 ✓ npm
 ✓ Watchman - Used for watching changes in the filesystem when in development mode

Android
 ✖ JDK
   - Version found: 1.8.0_292
   - Version supported: >= 8
 ✓ Android Studio - Required for building and installing your app on Android
 ✓ Android SDK - Required for building and installing your app on Android
 ✓ ANDROID_HOME

iOS
 ✓ Xcode - Required for building and installing your app on iOS
 ✓ CocoaPods - Required for installing iOS dependencies
 ✓ ios-deploy - Required for installing your app on a physical device with the CLI

Errors:   1
Warnings: 0

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.

Could you check if this works for you?

[Expo 42] Bare app build failing #13475

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 clean doesn’t do anything.