Can't build since upgrading to Expo 47

Hello,

App is working fine with expo start but I can’t build it anymore on android.
I use expo prebuild before.

Here is the error :

Running 'gradlew :app:assembleDebug' in /home/expo/workingdir/build/android
Downloading https://services.gradle.org/distributions/gradle-6.9-all.zip
Unzipping /home/expo/.gradle/wrapper/dists/gradle-6.9-all/dooywd8nv05k16orzxge2b1bs/gradle-6.9-all.zip to /home/expo/.gradle/wrapper/dists/gradle-6.9-all/dooywd8nv05k16orzxge2b1bs
Set executable permissions for: /home/expo/.gradle/wrapper/dists/gradle-6.9-all/dooywd8nv05k16orzxge2b1bs/gradle-6.9/bin/gradle
Welcome to Gradle 6.9!
Here are the highlights of this release:
 - This is a small backport release.
- Java 16 can be used to compile when used with Java toolchains
- Dynamic versions can be used within plugin declarations
- Native support for Apple Silicon processors
For more details see https://docs.gradle.org/6.9/release-notes.html
To honour the JVM settings for this build a single-use Daemon process will be forked. See https://docs.gradle.org/6.9/userguide/gradle_daemon.html#sec:disabling_the_daemon.
Daemon will be stopped at the end of the build
[stderr] FAILURE: Build completed with 2 failures.
[stderr] 1: Task failed with an exception.
[stderr] -----------
[stderr] * Where:
[stderr] Build file '/home/expo/workingdir/build/android/app/build.gradle' line: 83
[stderr] * What went wrong:
[stderr] A problem occurred evaluating project ':app'.
[stderr] > Cannot invoke method getAbsolutePath() on null object
[stderr] * Try:
[stderr] 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.
[stderr] ==============================================================================
[stderr] 2: Task failed with an exception.
[stderr] -----------
[stderr] * What went wrong:
[stderr] A problem occurred configuring project ':app'.
[stderr] >
[stderr] compileSdkVersion is not specified. Please add it to build.gradle
[stderr] * Try:
[stderr] Run with --stacktrace option to get the stack trace. Run with --info or
[stderr] --debug option to get more log output. Run with --scan to get full insights.
[stderr] ==============================================================================
[stderr] * Get more help at https://help.gradle.org
[stderr] BUILD FAILED in 27s
Error: Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.

The first error seems to be on this line :

hermesCommand: new File(["node", "--print", "require.resolve('hermes-engine/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsolutePath() + "/%OS-BIN%/hermesc"

I do not use hermes so not sure what happens here (I also tried to use hermes but the error is the same).

The seconds error is weird too. In my local android/build.gradle, I have buildscript.ext.compileSdkVersion = 30 so I don’t know why I get this error.

Could somebody help me ? Thanks.

“Fixed” by not using prebuild anymore.

1 Like

My opinion is that it is best to avoid “prebuild” if you can, since it basically switches your app to the bare workflow.

However, you could probably have fixed the build by running npx expo prebuild --clean to regenerate the native projects from scratch.

I already tried that.
Some month ago, I was forced to use prebuild to exclude permissions from android manifest file. Now you can do it in app.json.

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.