expo: Expo build failed / SDK 48
Summary
Build failed after update to SDK 48 (from SDK 46). No any errors while application running in development mode. Any help?
What platform(s) does this occur on?
Android
SDK Version
48
Environment
System: OS: macOS 13.2.1 Shell: 5.8.1 - /bin/zsh Binaries: Node: 16.16.0 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 8.11.0 - /usr/local/bin/npm IDEs: Xcode: /undefined - /usr/bin/xcodebuild npmPackages: @expo/metro-config: ^0.5.2 => 0.5.2 @expo/webpack-config: ^18.0.1 => 18.0.1 expo: ^48.0.0 => 48.0.8 react: 18.2.0 => 18.2.0 react-dom: 18.2.0 => 18.2.0 react-native: 0.71.3 => 0.71.3 react-native-web: ~0.18.11 => 0.18.12 Expo Workflow: managed
Minimal reproducible example
package.json
{
"name": "eshka.client",
"version": "1.0.4",
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start --no-dev --minify",
"develop": "expo start --clear",
"build:android": "eas build --platform android",
"build:apk": "eas build --platform android --profile stage",
"build:ios": "eas build --platform ios"
},
"dependencies": {
"@ant-design/react-native": "^5.0.0",
"@expo/metro-config": "^0.5.2",
"@expo/webpack-config": "^18.0.1",
"@googlemaps/polyline-codec": "^1.0.28",
"@react-native-async-storage/async-storage": "1.17.11",
"@react-native-community/datetimepicker": "6.7.3",
"@react-native-community/netinfo": "9.3.7",
"axios": "^0.27.2",
"babel-plugin-inline-import": "^3.0.0",
"base-64": "^1.0.0",
"centrifuge": "2.7.6",
"deprecated-react-native-prop-types": "^4.0.0",
"eas-cli": "^3.7.2",
"email-validator": "^2.0.4",
"expo": "^48.0.0",
"expo-app-loading": "~2.1.0",
"expo-asset": "~8.9.1",
"expo-camera": "~13.2.1",
"expo-cli": "5.5.0",
"expo-env-info": "^1.0.5",
"expo-file-system": "~15.2.2",
"expo-font": "~11.1.1",
"expo-image-picker": "~14.1.1",
"expo-localization": "~14.1.1",
"expo-location": "~15.1.1",
"expo-status-bar": "~1.4.4",
"expo-task-manager": "~11.1.1",
"expo-tracking-transparency": "~3.0.3",
"expo-updates": "~0.16.3",
"http-status-codes": "^2.2.0",
"i18n-js": "^4.2.0",
"lodash": "^4.17.21",
"md5": "^2.3.0",
"moment": "^2.29.4",
"patch-package": "^6.5.1",
"prop-types": "^15.8.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-native": "0.71.3",
"react-native-confirmation-code-input": "^1.0.4",
"react-native-gesture-handler": "~2.9.0",
"react-native-keyboard-aware-scroll-view": "^0.9.5",
"react-native-maps": "1.3.2",
"react-native-masked-text": "^1.13.0",
"react-native-modal": "^13.0.1",
"react-native-safe-area-context": "4.5.0",
"react-native-snap-carousel": "^3.9.1",
"react-native-sortable-list": "^0.0.25",
"react-native-svg": "13.4.0",
"react-native-svg-transformer": "^0.14.3",
"react-native-svg-uri": "^1.2.3",
"react-native-ultimate-listview": "^3.3.0",
"react-native-web": "~0.18.11",
"react-native-webview": "11.26.0",
"react-redux": "^8.0.2",
"react-router-native": "~6.3.0",
"redux": "^4.2.0",
"redux-saga": "^1.1.3"
},
"devDependencies": {
"@babel/core": "^7.20.0",
"@expo/metro-config": "^0.5.2",
"@expo/webpack-config": "^18.0.1",
"@types/lodash": "^4.14.182",
"@types/react": "~18.0.27",
"@types/react-native": "~0.69.1",
"babel-plugin-inline-import": "^3.0.0",
"react-native-svg-transformer": "^0.14.3",
"typescript": "^4.9.4"
},
"private": true
}
Stacktrace (if a crash is involved)
[stderr] /home/expo/workingdir/build/android/app/src/main/java/com/eshka2k34/client/MainActivity.java:19: error: package R does not exist
[stderr] setTheme(R.style.AppTheme);
[stderr] ^
[stderr] /home/expo/workingdir/build/android/app/src/main/java/com/eshka2k34/client/MainActivity.java:39: error: cannot find symbol
[stderr] return new ReactActivityDelegateWrapper(this, BuildConfig.IS_NEW_ARCHITECTURE_ENABLED, new DefaultReactActivityDelegate(
[stderr]
^
[stderr] symbol: variable BuildConfig
[stderr] location: class MainActivity
[stderr]
/home/expo/workingdir/build/android/app/src/main/java/com/eshka2k34/client/MainApplication.java:26: error: cannot find symbol
[stderr] return BuildConfig.DEBUG;
[stderr] ^
[stderr] symbol: variable BuildConfig
[stderr] /home/expo/workingdir/build/android/app/src/main/java/com/eshka2k34/client/MainApplication.java:45: error: cannot find symbol
[stderr] return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
[stderr] ^
[stderr] symbol: variable BuildConfig
[stderr] /home/expo/workingdir/build/android/app/src/main/java/com/eshka2k34/client/MainApplication.java:50: error: cannot find symbol
[stderr] return BuildConfig.IS_HERMES_ENABLED;
[stderr] ^
[stderr] symbol: variable BuildConfig
[stderr] /home/expo/workingdir/build/android/app/src/main/java/com/eshka2k34/client/MainApplication.java:63: error: cannot find symbol
[stderr] if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
[stderr] ^
[stderr] symbol: variable BuildConfig
[stderr] location: class MainApplication
[stderr] /home/expo/workingdir/build/android/app/src/main/java/com/eshka2k34/client/MainApplication.java:63: error: illegal parenthesized expression
[stderr] if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
[stderr] ^
[stderr] /home/expo/workingdir/build/android/app/src/main/java/com/eshka2k34/client/MainApplication.java:67: error: cannot find symbol
[stderr] ReactNativeFlipper.initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
[stderr] ^
[stderr] symbol: variable ReactNativeFlipper
[stderr] location: class MainApplication
[stderr] 8 errors
w: Detected multiple Kotlin daemon sessions at build/kotlin/sessions
[stderr] FAILURE: Build completed with 2 failures.
[stderr] 1: Task failed with an exception.
[stderr] -----------
[stderr] * What went wrong:
[stderr] Execution failed for task ':app:compileReleaseJavaWithJavac'.
[stderr] > Compilation failed; see the compiler error output for details.
[stderr] * Try:
[stderr] > Run with --stacktrace option to get the stack trace.
[stderr] > Run with --info or --debug option to get more log output.
[stderr] > Run with --scan to get full insights.
[stderr] ==============================================================================
[stderr] 2: Task failed with an exception.
[stderr] -----------
[stderr] * What went wrong:
[stderr] java.lang.StackOverflowError (no error message)
[stderr] * Try:
[stderr] > Run with --stacktrace option to get the stack trace.
[stderr] > Run with --info or --debug option to get more log output.
[stderr] > Run with --scan to get full insights.
[stderr]
==============================================================================
[stderr] * Get more help at https://help.gradle.org
[stderr] **BUILD FAILED in 5m 47s**
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.5.1/userguide/command_line_interface.html#sec:command_line_warnings
Execution optimizations have been disabled for 6 invalid unit(s) of work during this build to ensure correctness.
Please consult deprecation warnings for more details.
938 actionable tasks: 938 executed
Error: Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 30
- Comments: 72 (2 by maintainers)
Removed expo-cli from dependencies, it worked for me
What worked for me was to make sure that the
namespaceinandroid/app/build.gradlewas correct and then run./gradlew cleanand then run the android app again.For some reason the
namespacegenerated withexpo prebuildwas wrong.I.e. My
MainApplication.javafile was located incom/company/appfolder so the namespace should becom.company.app.I faced same error.
Expo is generated wrong namespace. I fixed the problem following this is steps;
For Example package.json
and app.json
It fixed my problem.
I was able to resolve this issue by running all commands using local package instead of global one i.e.:
npx expo prebuildinstead ofexpo prebuildnpx expo run:androidinstead ofexpo run:androidVery niice, This worked for me.
I deleted
androidbuild folder in the root directory & then triedeas build --platform androidthat seemed to resolve this error.what a clown fiesta
For me, the problem was wrong configuration entries in
expo-build-properties. Removing those fixed it.I needed this to set a specific Kotlin version for the library I use, but Expo SDK 48 uses
Android compileSdkVersion and targetSdkVersion set to API level 33 across all Expo modules.ref: https://blog.expo.dev/expo-sdk-48-ccb8302e231The
compileSdkVersionin particular was the problem for me. I ended up just settingkotlinVersion: "1.6.21"and removing the others and it works fine.These build settings may be in the library or plugin configs, so I would suggest checking those as well. (You may need to update those libraries or settings)
Funciono!
No, it not work ,(
Same problem, no android folder. Just clean expo project with all default files.
It’s very strange that when I don’t build locally its fine, but when i add the --local tag its suddenly broken 🤔
It make me another problems. I solve all this problems by downgrade to SDK 46.
The history:
What about developers who not use gradle? I seems - SDK 48 from a box (as is) should work without any fixes!!! It may work correctly by default as (for example) SDK 46! Now any build in EXPO is - paid! 1$ - Android and 2$ - iOS, …How its solve the problem? ))) Maybe this will up the quality of the EXPO in the future.
Hi there! It looks like your issue requires a minimal reproducible example, but it is invalid or absent. Please prepare such an example and share it in a new issue.
The best way to get attention to your issue is to provide a clean and easy way for a developer to reproduce the issue on their own machine. Please do not provide your entire project, or a project with more code than is necessary to reproduce the issue.
A side benefit of going through the process of narrowing down the minimal amount of code needed to reproduce the issue is that you may get lucky and discover that the bug is due to a mistake in your application code that you can quickly fix on your own.
Resources
Common concerns
“I’ve only been able to reproduce it in private, proprietary code”
You may not have spent enough time narrowing down the root cause of the issue. Try out the techniques discussed in this manual debugging guide to learn how to isolate the problem from the rest of your codebase.
“I didn’t have time to create one”
That’s understandable, it can take some time to prepare. We ask that you hold off on filing an issue until you are able to fully complete the required fields in the issue template.
“You can reproduce it by yourself by creating a project and following these steps”
This is useful knowledge, but it’s still valuable to have the resulting project that is produced from running the steps, where you have verified you can reproduce the issue.
added new plugin such as
and add the link to it inside the app.json “plugins”: [“./plugins/withoutAndroidFlipper”]
Seems like expo team forgot to remove the flipper from the assembled version of the app
I never manage to build the Expo app. it was a wrong decision for me to use it. I can run it in an emulator but when I need to build it I get the same error as yours. too bad.
It worked!! I created my app with the package name “app.name” and for some reason the namespace was “com.name”, it worked as soon as I changed the “com” to “app”
This issue was a journey. I think I finally got everything working the way I needed. I’ll list my steps below.
I basically ran into two main issues:
android/app/build.gradlewas being generated incorrectly (it seemingly references the appnamerather than thepackageID. For example, mynamewas “AppName (env)” and mypackagewas “com.app.env”. In the build.gradle, it was using namespace “com.appnameenv” (seems like the app name with parenthesis and spaces removed). This should have beencom.app.envand caused things not to load correctly.android/app/src/release/java/com/appnameenv/ReactNativeFlipper.javaand used package namecom.appnameenv. Both of these seem to be based on the app name like above, but it should have been generated asandroid/app/src/release/java/com/app/env/ReactNativeFlipper.javawith package namecom.app.env.It’s important to note that the second issue only appears on release builds (I use expo to create builds in the cloud). The first issue impacts dev builds and release builds.
In order to fix this, I referenced several of the other fixes on this thread to create a single expo plugin that:
Inside my
withAndroidExpoFix.jsfile:Inside my
app.config.jsfile:After testing, I’ve been able to run it locally and the release build finally succeeded. Hope this helps anyone else who is dealing with both issues.
It seems I’ve been doing it all wrong this whole time lol. Using npx expo prebuild vs expo prebuild worked for both platforms for the first time. Thank you.
you are right, very strange expo give a wrong namespace.
but the difference is i’m using the old
expo eject(it still works perfectly), notexpo prebuild, after I upgraded from version 47. So changing it to the correct namespace fixed the debug build.===
Oh, I have found that ReactNativeFlipper.java in the release folder is created with the wrong package name. do not forget to change it too
wow… so the error already occured from the default app??
Yes, then after this adjustment make sure your
“resolutions”: { “@expo/config-plugins”: “~6.0.0”, “@expo/prebuild-config”: “~6.0.0”, “expo-modules-autolinking”: “1.1.0” }
is upto date or atleast this version, then run expo doctor to make sure everything is okay from expo end
I downgrade to SDK 47 and …get new problems ,( Expo.IO - is deamn hell! Today it work, tomorrow it don’t work ,(