Reputation: 1705
I recently upgraded my expo's SDK version from 35 to 41 and also upgraded expo-cli from 3.18.5 to 4.4.3.
However, when I try to build a standalone APK/AAB, I'm getting the following error:
× Build failed. Standalone build failed!
In order to understand what was exactly causing this issue, I examined the Gradle logs of build Gradle on expo, and here's what I was able to find.
Installing unimodules:
[email protected] from /app/turtle/workingdir/android/sdk41/packages/@unimodules/core
[email protected] from /app/turtle/workingdir/android/sdk41/packages/@unimodules/react-native-adapter
[email protected] from /app/turtle/workingdir/android/sdk41/packages/expo-application
[email protected] from /app/turtle/workingdir/android/sdk41/packages/expo-barcode-scanner
[email protected] from /app/turtle/workingdir/android/sdk41/packages/expo-camera
[email protected] from /app/turtle/workingdir/android/sdk41/packages/expo-constants
[email protected] from /app/turtle/workingdir/android/sdk41/packages/expo-error-recovery
[email protected] from /app/turtle/workingdir/android/sdk41/packages/expo-file-system
[email protected] from /app/turtle/workingdir/android/sdk41/packages/expo-font
[email protected] from /app/turtle/workingdir/android/sdk41/packages/expo-image-loader
[email protected] from /app/turtle/workingdir/android/sdk41/packages/expo-keep-awake
[email protected] from /app/turtle/workingdir/android/sdk41/packages/expo-notifications
[email protected] from /app/turtle/workingdir/android/sdk41/packages/unimodules-app-loader
[email protected] from /app/turtle/workingdir/android/sdk41/packages/expo-permissions
[email protected] from /app/turtle/workingdir/android/sdk41/packages/unimodules-barcode-scanner-interface
[email protected] from /app/turtle/workingdir/android/sdk41/packages/unimodules-camera-interface
[email protected] from /app/turtle/workingdir/android/sdk41/packages/unimodules-constants-interface
[email protected] from /app/turtle/workingdir/android/sdk41/packages/unimodules-face-detector-interface
[email protected] from /app/turtle/workingdir/android/sdk41/packages/unimodules-file-system-interface
[email protected] from /app/turtle/workingdir/android/sdk41/packages/unimodules-font-interface
[email protected] from /app/turtle/workingdir/android/sdk41/packages/unimodules-image-loader-interface
[email protected] from /app/turtle/workingdir/android/sdk41/packages/unimodules-permissions-interface
[email protected] from /app/turtle/workingdir/android/sdk41/packages/unimodules-sensors-interface
[email protected] from /app/turtle/workingdir/android/sdk41/packages/unimodules-task-manager-interface
Could not find google-services.json while looking in [src/nullnull/debug, src/debug/nullnull, src/nullnull, src/debug, src/nullnullDebug]
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
Could not find google-services.json while looking in [src/nullnull/release, src/release/nullnull, src/nullnull, src/release, src/nullnullRelease]
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
> Task :app:preBuild UP-TO-DATE
> Task :app:extractProguardFiles
> Task :app:preReleaseBuild
> Task :app:compileReleaseRenderscript NO-SOURCE
> Task :app:generateReleaseResValues
> Task :app:generateReleaseResources
> Task :app:processReleaseGoogleServices
Parsing json file: /app/turtle/workingdir/android/sdk41/android-shell-app/app/google-services.json
> Task :app:createReleaseCompatibleScreenManifests
> Task :app:extractDeepLinksRelease
> Task :app:mergeReleaseResources
> Task :app:processReleaseMainManifest
[com.facebook.soloader:soloader:0.8.2] /root/.gradle/caches/transforms-3/cfd0b9e5b303f54f13e669e38ab029ae/transformed/jetified-soloader-0.8.2/AndroidManifest.xml Warning:
Package name 'com.facebook.soloader' used in: com.facebook.soloader:soloader:0.8.2, com.facebook.soloader:annotation:0.8.2.
/app/turtle/workingdir/android/sdk41/android-shell-app/app/src/main/AndroidManifest.xml:35:1-94 Warning:
Element uses-permission#android.permission.SYSTEM_ALERT_WINDOW at AndroidManifest.xml:35:1-94 duplicated with element declared at AndroidManifest.xml:16:3-76
/app/turtle/workingdir/android/sdk41/android-shell-app/app/src/main/AndroidManifest.xml:23:1-101 Warning:
uses-permission#android.permission.ACCESS_BACKGROUND_LOCATION was tagged at AndroidManifest.xml:23 to remove other declarations but no other declaration present
/app/turtle/workingdir/android/sdk41/android-shell-app/app/src/main/AndroidManifest.xml:24:1-87 Warning:
uses-permission#android.permission.RECORD_AUDIO was tagged at AndroidManifest.xml:24 to remove other declarations but no other declaration present
/app/turtle/workingdir/android/sdk41/android-shell-app/app/src/main/AndroidManifest.xml:26:1-89 Warning:
uses-permission#android.permission.WRITE_CONTACTS was tagged at AndroidManifest.xml:26 to remove other declarations but no other declaration present
/app/turtle/workingdir/android/sdk41/android-shell-app/app/src/main/AndroidManifest.xml:32:1-88 Warning:
uses-permission#android.permission.USE_BIOMETRIC was tagged at AndroidManifest.xml:32 to remove other declarations but no other declaration present
/app/turtle/workingdir/android/sdk41/android-shell-app/app/src/main/AndroidManifest.xml:33:1-82 Warning:
uses-permission#android.permission.VIBRATE was tagged at AndroidManifest.xml:33 to remove other declarations but no other declaration present
/app/turtle/workingdir/android/sdk41/android-shell-app/app/src/main/AndroidManifest.xml:34:1-91 Warning:
uses-permission#android.permission.READ_PHONE_STATE was tagged at AndroidManifest.xml:34 to remove other declarations but no other declaration present
/app/turtle/workingdir/android/sdk41/android-shell-app/app/src/main/AndroidManifest.xml:35:1-94 Warning:
uses-permission#android.permission.SYSTEM_ALERT_WINDOW was tagged at AndroidManifest.xml:35 to remove other declarations but no other declaration present
/app/turtle/workingdir/android/sdk41/android-shell-app/app/src/main/AndroidManifest.xml:37:1-83 Warning:
uses-permission#android.permission.READ_SMS was tagged at AndroidManifest.xml:37 to remove other declarations but no other declaration present
/app/turtle/workingdir/android/sdk41/android-shell-app/app/src/main/AndroidManifest.xml:38:1-99 Warning:
uses-permission#android.permission.REQUEST_INSTALL_PACKAGES was tagged at AndroidManifest.xml:38 to remove other declarations but no other declaration present
/app/turtle/workingdir/android/sdk41/android-shell-app/app/src/main/AndroidManifest.xml:41:1-104 Warning:
uses-permission#com.android.launcher.permission.INSTALL_SHORTCUT was tagged at AndroidManifest.xml:41 to remove other declarations but no other declaration present
/app/turtle/workingdir/android/sdk41/android-shell-app/app/src/main/AndroidManifest.xml:208:5-213:39 Warning:
activity#com.facebook.FacebookActivity@android:theme was tagged at AndroidManifest.xml:208 to replace other declarations but no other declaration present
/app/turtle/workingdir/android/sdk41/android-shell-app/app/src/main/AndroidManifest.xml:17:9-26:20 Warning:
provider#expo.modules.filesystem.FileSystemFileProvider@android:authorities was tagged at AndroidManifest.xml:17 to replace other declarations but no other declaration present
> Task :app:processReleaseManifest
> Task :app:processApplicationManifestReleaseForBundle
> Task :app:mergeReleaseShaders
> Task :app:compileReleaseShaders NO-SOURCE
> Task :app:generateReleaseAssets UP-TO-DATE
> Task :app:mergeReleaseAssets
> Task :app:compileReleaseAidl
NO-SOURCE
> Task :app:generateReleaseBuildConfig
> Task :app:checkReleaseDuplicateClasses
> Task :app:javaPreCompileRelease
> Task :app:checkReleaseAarMetadata
> Task :app:processReleaseJavaRes NO-SOURCE
> Task :app:bundleReleaseResources
> Task :app:mergeReleaseJniLibFolders
> Task :app:collectReleaseDependencies
> Task :app:configureReleaseDependencies
> Task :app:parseReleaseIntegrityConfig
> Task :app:validateSigningRelease
> Task :app:processReleaseManifestForPackage
> Task :app:mergeReleaseNativeLibs
> Task :app:processReleaseResources
> Task :app:mergeReleaseJavaResource
> Task :app:compileReleaseJavaWithJavac
[stderr] /app/turtle/workingdir/android/sdk41/android-shell-app/app/src/main/java/host/exp/exponent/generated/AppConstants.java:8: error: package expo.modules.splashscreen does not exist
[stderr] import expo.modules.splashscreen.SplashScreenImageResizeMode;
[stderr] ^
[stderr] /app/turtle/workingdir/android/sdk41/android-shell-app/app/src/main/java/host/exp/exponent/generated/AppConstants.java:25: error: cannot find symbol
[stderr] public static SplashScreenImageResizeMode SPLASH_SCREEN_IMAGE_RESIZE_MODE = SplashScreenImageResizeMode.CONTAIN;
[stderr] ^
[stderr] symbol: class SplashScreenImageResizeMode
[stderr] location: class AppConstants
[stderr] /app/turtle/workingdir/android/sdk41/android-shell-app/app/src/main/java/host/exp/exponent/generated/AppConstants.java:25: error: cannot find symbol
[stderr] public static SplashScreenImageResizeMode SPLASH_SCREEN_IMAGE_RESIZE_MODE = SplashScreenImageResizeMode.CONTAIN;
[stderr] ^
[stderr] symbol: variable SplashScreenImageResizeMode
[stderr] location: class AppConstants
[stderr] /app/turtle/workingdir/android/sdk41/android-shell-app/app/src/main/java/host/exp/exponent/generated/AppConstants.java:53: error: cannot access SplashScreenImageResizeMode
[stderr] constants.SPLASH_SCREEN_IMAGE_RESIZE_MODE = SPLASH_SCREEN_IMAGE_RESIZE_MODE;
[stderr] ^
[stderr] class file for expo.modules.splashscreen.SplashScreenImageResizeMode not found
[stderr] 4 errors
> Task :app:compileReleaseJavaWithJavac FAILED
[stderr] FAILURE: Build failed with an exception.
[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. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
[stderr] * Get more help at https://help.gradle.org
[stderr] BUILD FAILED in 35s
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
26 actionable tasks: 26 executed
Error: ./gradlew exited with non-zero code: 1
at ChildProcess.completionListener (/app/turtle/node_modules/@expo/xdl/node_modules/@expo/spawn-async/build/spawnAsync.js:52:23)
at Object.onceWrapper (events.js:418:26)
at ChildProcess.emit (events.js:311:20)
at ChildProcess.EventEmitter.emit (domain.js:482:12)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
...
at spawnAsync (/app/turtle/node_modules/@expo/xdl/node_modules/@expo/spawn-async/build/spawnAsync.js:17:21)
at spawnAsyncThrowError (/app/turtle/node_modules/@expo/xdl/build/detach/ExponentTools.js:201:45)
at buildShellAppAsync (/app/turtle/node_modules/@expo/xdl/build/detach/AndroidShellApp.js:976:11)
at async Object.createAndroidShellAppAsync (/app/turtle/node_modules/@expo/xdl/build/detach/AndroidShellApp.js:396:5)
at async runShellAppBuilder (/app/turtle/build/builders/android.js:95:9)
at async Object.buildAndroid [as android] (/app/turtle/build/builders/android.js:43:28)
at async build (/app/turtle/build/jobManager.js:181:33)
at async processJob (/app/turtle/build/jobManager.js:118:32)
at async Object.doJob (/app/turtle/build/jobManager.js:49:5)
at async main (/app/turtle/build/server.js:66:13)
If we notice the above logs, it can be seen that the issue is mostly pertaining to the Splash screen.
[stderr] /app/turtle/workingdir/android/sdk41/android-shell-app/app/src/main/java/host/exp/exponent/generated/AppConstants.java:8: error: package expo.modules.splashscreen does not exist
[stderr] import expo.modules.splashscreen.SplashScreenImageResizeMode;
[stderr] ^
[stderr] /app/turtle/workingdir/android/sdk41/android-shell-app/app/src/main/java/host/exp/exponent/generated/AppConstants.java:25: error: cannot find symbol
[stderr] public static SplashScreenImageResizeMode SPLASH_SCREEN_IMAGE_RESIZE_MODE = SplashScreenImageResizeMode.CONTAIN;
[stderr] ^
[stderr] symbol: class SplashScreenImageResizeMode
[stderr] location: class AppConstants
[stderr] /app/turtle/workingdir/android/sdk41/android-shell-app/app/src/main/java/host/exp/exponent/generated/AppConstants.java:25: error: cannot find symbol
[stderr] public static SplashScreenImageResizeMode SPLASH_SCREEN_IMAGE_RESIZE_MODE = SplashScreenImageResizeMode.CONTAIN;
[stderr] ^
[stderr] symbol: variable SplashScreenImageResizeMode
[stderr] location: class AppConstants
[stderr] /app/turtle/workingdir/android/sdk41/android-shell-app/app/src/main/java/host/exp/exponent/generated/AppConstants.java:53: error: cannot access SplashScreenImageResizeMode
[stderr] constants.SPLASH_SCREEN_IMAGE_RESIZE_MODE = SPLASH_SCREEN_IMAGE_RESIZE_MODE;
[stderr] ^
[stderr] class file for expo.modules.splashscreen.SplashScreenImageResizeMode not found
[stderr] 4 errors
> Task :app:compileReleaseJavaWithJavac FAILED
[stderr] FAILURE: Build failed with an exception.
[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. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
[stderr] * Get more help at https://help.gradle.org
[stderr] BUILD FAILED in 35s
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.
Here's my app.json
{
"expo": {
"name": "APP_NAME",
"slug": "APP_SLUG",
"platforms": [
"ios",
"android",
"web"
],
"version": "1.0.1",
"orientation": "portrait",
"icon": "./assets/icon.png",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
],
"ios": {
"supportsTablet": true,
"bundleIdentifier": "BUNDLE_IDENTIFIER"
},
"android": {
"package": "APP_PACKAGE",
"softwareKeyboardLayoutMode": "pan",
"versionCode": 1,
"permissions": [
"CAMERA"
],
"enableDangerousExperimentalLeanBuilds": true
}
}
}
The builds were successful with the older SDK version, but few packages were not compatible with the older SDK, hence I had to upgrade it to the latest. The application is running perfectly fine in the expo go
mobile application, but unable to build a standalone app.
How to solve this problem? Or, is it possible to downgrade from SDK 41 to 40 or 39? Any suggestions or recommendation is appreciated.
Upvotes: 1
Views: 1983
Reputation: 1705
There are two major reasons for this cause.
enableDangerousExperimentalLeanBuils
to true
.expo-splash-screen
package.The error is because it's(Gradle build) looking for expo-modules-splashscreen
package, which is supposedly moved out of expo's main module in SDK 41, hence needs to be separately installed.
In order to fix this, there are two workarounds:
enableDangerousExperimentalLeanBuilds
property. (Not tested)npm install expo-splash-screen
.(Tested and working)Upvotes: 1