Having issues running react-native run-android - android

Since I've installed react-native-vector-icons, I've been fancing trouble trying to run the app on my android.
This is what it shows when I try the react-native run-android command:
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring project ':react-native-vector-icons'.
Could not resolve all dependencies for configuration ':react-native-vector-icons:classpath'.
Could not load module metadata from C:\Users\Pichau.gradle\caches\modules-2\metadata-2.71\descriptors\org.jetbrains.kotlin\kotlin-stdlib-common\1.3.20\475b59a03ea03e6388c8f34eee6a9d08\descriptor.bin
Try:
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.
Get more help at https://help.gradle.org
BUILD FAILED in 10s
error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run
CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring project ':react-native-vector-icons'.
Could not resolve all dependencies for configuration ':react-native-vector-icons:classpath'.
Could not load module metadata from C:\Users\Pichau.gradle\caches\modules-2\metadata-2.71\descriptors\org.jetbrains.kotlin\kotlin-stdlib-common\1.3.20\475b59a03ea03e6388c8f34eee6a9d08\descriptor.bin
Try:
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.
Get more help at https://help.gradle.org
BUILD FAILED in 10s
at checkExecSyncError (child_process.js:621:11)
at execFileSync (child_process.js:639:15)
at runOnAllDevices (C:\Users\Pichau\Desktop\PetCare-RN\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:74:39)
at buildAndRun (C:\Users\Pichau\Desktop\PetCare-RN\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\index.js:158:41)
at C:\Users\Pichau\Desktop\PetCare-RN\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\index.js:125:12
at processTicksAndRejections (internal/process/task_queues.js:85:5)
at async Command.handleAction (C:\Users\Pichau\Desktop\PetCare-RN\node_modules\#react-native-community\cli\build\cliEntry.js:160:7)

Here's my package.json file
{
"name": "petcare",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "react-native start",
"test": "jest"
},
"dependencies": {
"react": "16.8.6",
"react-native": "0.60.5",
"react-native-gesture-handler": "^1.3.0",
"react-native-vector-icons": "^6.6.0",
"react-navigation": "^3.11.1"
},
"devDependencies": {
"#babel/core": "^7.5.0",
"#babel/runtime": "^7.5.0",
"#react-native-community/eslint-config": "^0.0.3",
"babel-jest": "^24.1.0",
"jest": "^24.1.0",
"metro-react-native-babel-preset": "0.54.1",
"react-test-renderer": "16.8.6"
},
"jest": {
"preset": "react-native"
}
}

Related

eas build error: assets_images_bgbanner.png: AAPT: error: file failed to compile

I'm trying to build an expo app using command "eas build -p android" and got the error like this:
[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:mergeReleaseResources'.
[stderr] > A failure occurred while executing com.android.build.gradle.internal.res.Aapt2CompileRunnable
[stderr] > Android resource compilation failed
[stderr] ERROR:/home/expo/workingdir/build/android/app/build/generated/res/react/release/drawable-mdpi/assets_images_bgbanner.png: AAPT: error: file failed to compile.
[stderr]
[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 6m 56s
here is my app.json file:
{
"expo": {
"name": "eworkbook-mobile",
"slug": "eworkbook-mobile",
"version": "1.0.0",
"orientation": "portrait",
"userInterfaceStyle": "light",
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
],
"ios": {
"supportsTablet": true,
"bundleIdentifier": "com.hatieudao.eworkbook"
},
"android": {
"package": "com.hatieudao.eworkbook",
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#FFFFFF"
}
},
"extra": {
"eas": {
"projectId": "38e1dc19-4d84-4060-xxxx-xxxxxxxxxxx"
}
},
"plugins": [
[
"expo-build-properties",
{
"android": {
"compileSdkVersion": 31,
"targetSdkVersion": 31,
"buildToolsVersion": "31.0.0"
},
"ios": {
"deploymentTarget": "13.0"
}
}
]
]
}
}
I dont know what to do with the error since I can't find the file "assets_images_bgbanner.png" or "bgbanner.png" anywhere in my project folder. In the asset folder there is just 4 images: adaptive-icon.png,favicon.png,icon.png,splash.png (just default expo images). Maybe the "assets_images_bgbanner.png" is the default image when build on cloud? If so how can I get rid off it or is there any way to fix this error?
I've tried to create my own "bgbanner.png" and put it in the asset folder, but the error is still the same
Ok, I found it. It's "bg-banner.png" not "bgbanner.png". Moreover, the file seem corrupted or something. I tried to open it with paint and save it. It's work.

RL - Eas build apk error: Don't know which android drawable suffix to use for asset

I am maintaining the RL app.
After modifying the code, I want to test it by building it with apk.
I'm going to create an apk using eas build -p android --profile preview. (This is my first time using Eas Build).
However, the following error occurs during the build:
> Task :app:bundleReleaseJsAndAssets FAILED
[stderr] error Don't know which android drawable suffix to use for asset: {"__packager_asset":true,"fileSystemLocation":"/home/expo/workingdir/build/assets/images/navigation/service","httpServerLocation":"/assets/assets/images/navigation/service","width":320,"height":130,"scales":[1,2,3,4,5],"files":["/home/expo/workingdir/build/assets/images/navigation/service/reservation_thum_img_1.png","/home/expo/workingdir/build/assets/images/navigation/service/reservation_thum_img_1#2x.png","/home/expo/workingdir/build/assets/images/navigation/service/reservation_thum_img_1#3x.png","/home/expo/workingdir/build/assets/images/navigation/service/reservation_thum_img_1#4x.png","/home/expo/workingdir/build/assets/images/navigation/service/reservation_thum_img_1#5x.png"],"hash":"b74c4d596b7a00b174f1cbbf6373edac","name":"reservation_thum_img_1","type":"png","fileHashes":["f8e111b8eadda7d33612a89b3337968d","08bbb315b8db585383bafaf3bbbb159f","b410e37fc8c275c98f2b07711193b9d2","5bc21bf4e96ae2a26d0f1f41a0bb9dc8","f9883a5447a863dde859d547da0c0fe7"]}.
w: Detected multiple Kotlin daemon sessions at build/kotlin/sessions
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.3.3/userguide/command_line_interface.html#sec:command_line_warnings
Execution optimizations have been disabled for 3 invalid unit(s) of work during this build to ensure correctness.
Please consult deprecation warnings for more details.
933 actionable tasks: 933 executed
[stderr] FAILURE: Build failed with an exception.
[stderr] * What went wrong:
[stderr] Execution failed for task ':app:bundleReleaseJsAndAssets'.
[stderr] > Process 'command 'node'' finished with non-zero exit value 1
[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] * Get more help at https://help.gradle.org
[stderr] BUILD FAILED in 12m 49s
Error: Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.
It's my package.json and eas.json code
// package.json
{
"name": "my-app",
"version": "1.0.0",
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"eject": "expo eject",
"test": "jest --watchAll"
},
"jest": {
"preset": "jest-expo"
},
"resolutions": {},
"dependencies": {
"#expo/react-native-action-sheet": "^4.0.1",
"#expo/samples": "~3.0.3",
"#expo/vector-icons": "^13.0.0",
"#fortawesome/fontawesome-svg-core": "^6.2.1",
"#fortawesome/free-solid-svg-icons": "^6.2.1",
"#fortawesome/react-native-fontawesome": "^0.3.0",
"#react-native-async-storage/async-storage": "^1.17.11",
"#react-native-community/datetimepicker": "6.1.2",
"axios": "^1.2.6",
"crypto-js": "^4.1.1",
"expo": "^45.0.0",
"expo-app-loading": "~2.0.0",
"expo-asset": "~8.5.0",
"expo-blur": "~11.1.0",
"expo-camera": "~12.2.0",
"expo-cli": "^6.2.1",
"expo-constants": "~13.1.1",
"expo-file-system": "~14.0.0",
"expo-font": "~10.1.0",
"expo-image-manipulator": "~10.3.1",
"expo-image-picker": "~13.1.1",
"expo-linking": "~3.1.0",
"expo-location": "~14.2.2",
"expo-notifications": "~0.15.4",
"expo-splash-screen": "^0.15.1",
"expo-status-bar": "~1.3.0",
"expo-updates": "~0.13.4",
"expo-web-browser": "~10.2.1",
"global": "^4.4.0",
"immutable": "^4.2.2",
"intl": "^1.2.5",
"jwt-decode": "^3.1.2",
"moment": "^2.29.4",
"qs": "^6.11.0",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-geocode": "^0.2.3",
"react-native": "0.68.2",
"react-native-dash": "^0.0.11",
"react-native-easy-toast": "^2.3.0",
"react-native-elements": "^3.4.3",
"react-native-gesture-handler": "~2.2.1",
"react-native-image-resizer": "^1.0.1",
"react-native-maps": "0.30.2",
"react-native-measureme": "^0.0.2",
"react-native-modal": "^13.0.1",
"react-native-modal-datetime-picker": "^14.0.1",
"react-native-picker-select": "^8.0.4",
"react-native-push-notification-popup": "^1.6.1",
"react-native-qrcode": "^0.2.7",
"react-native-safe-area-context": "4.2.4",
"react-native-screens": "~3.11.1",
"react-native-status-bar-height": "^2.6.0",
"react-native-svg": "12.3.0",
"react-native-svg-transformer": "^1.0.0",
"react-native-web": "0.17.7",
"react-native-webview": "11.18.1",
"react-navigation": "^3.11.0",
"react-redux": "^8.0.5",
"redux": "^4.2.1",
"redux-actions": "^2.6.5",
"redux-devtools-extension": "^2.13.8",
"redux-pender": "^2.0.12",
"underscore": "^1.13.6"
},
"devDependencies": {
"#babel/core": "^7.12.9"
},
"private": true
}
.
// eas.json
{
"cli": {
"version": ">= 3.5.2"
},
"build": {
"development": {
"developmentClient": true,
"distribution": "internal"
},
"preview": {
"distribution": "internal"
},
"production": {
"android": {
"buildType": "apk"
}
}
},
"submit": {
"production": {}
}
}
May I know the cause and solution for this problem?
Thank you.
I think this is a duplicate of this question. Please try the solutions provided for this question.
Question link: Detected multiple Kotlin daemon sessions at build\kotlin\sessions - React-Native

Error About React Native Execution (React Native gives unknow error after execution completed)

I was implementing Video Call module on my Project before getting this error. When I run react native project using npx react-native run-android. It gives me unknown errors. I have followed many articles to solve it but my problem is still there.
Error Which I got while execution. When 99% execution successfully completes then it gives me the error.
info JS server already running.
info Installing the app...
> Configure project :app
WARNING:The option setting 'android.enableDexingArtifactTransform.desugaring=false' is experimental.
The current default is 'true'.
> Configure project :react-native-firebase_app
:react-native-firebase_app package.json found at C:\Users\ZAIIIN\ChatApp\node_modules\#react-native-firebase\app\package.json
:react-native-firebase_app:firebase.bom using default value: 30.5.0
:react-native-firebase_app:play.play-services-auth using default value: 20.3.0
:react-native-firebase_app package.json found at C:\Users\ZAIIIN\ChatApp\node_modules\#react-native-firebase\app\package.json
:react-native-firebase_app:version set from package.json: 15.7.0 (15,7,0 - 15007000)
:react-native-firebase_app:android.compileSdk using custom value: 31
:react-native-firebase_app:android.targetSdk using custom value: 31
:react-native-firebase_app:android.minSdk using custom value: 21
:react-native-firebase_app:reactNativeAndroidDir C:\Users\ZAIIIN\ChatApp\node_modules\react-native\android
> Configure project :react-native-firebase_auth
:react-native-firebase_auth package.json found at C:\Users\ZAIIIN\ChatApp\node_modules\#react-native-firebase\auth\package.json
:react-native-firebase_app package.json found at C:\Users\ZAIIIN\ChatApp\node_modules\#react-native-firebase\app\package.json
:react-native-firebase_auth:firebase.bom using default value: 30.5.0
:react-native-firebase_auth package.json found at C:\Users\ZAIIIN\ChatApp\node_modules\#react-native-firebase\auth\package.json
:react-native-firebase_auth:version set from package.json: 15.7.0 (15,7,0 - 15007000)
:react-native-firebase_auth:android.compileSdk using custom value: 31
:react-native-firebase_auth:android.targetSdk using custom value: 31
:react-native-firebase_auth:android.minSdk using custom value: 21
:react-native-firebase_auth:reactNativeAndroidDir C:\Users\ZAIIIN\ChatApp\node_modules\react-native\android
> Configure project :react-native-firebase_firestore
:react-native-firebase_firestore package.json found at C:\Users\ZAIIIN\ChatApp\node_modules\#react-native-firebase\firestore\package.json
:react-native-firebase_app package.json found at C:\Users\ZAIIIN\ChatApp\node_modules\#react-native-firebase\app\package.json
:react-native-firebase_firestore:firebase.bom using default value: 30.5.0
:react-native-firebase_firestore package.json found at C:\Users\ZAIIIN\ChatApp\node_modules\#react-native-firebase\firestore\package.json
:react-native-firebase_firestore:version set from package.json: 15.7.0 (15,7,0 - 15007000)
:react-native-firebase_firestore:android.compileSdk using custom value: 31
:react-native-firebase_firestore:android.targetSdk using custom value: 31
:react-native-firebase_firestore:android.minSdk using custom value: 21
:react-native-firebase_firestore:reactNativeAndroidDir C:\Users\ZAIIIN\ChatApp\node_modules\react-native\android
> Configure project :react-native-firebase_storage
:react-native-firebase_storage package.json found at C:\Users\ZAIIIN\ChatApp\node_modules\#react-native-firebase\storage\package.json
:react-native-firebase_app package.json found at C:\Users\ZAIIIN\ChatApp\node_modules\#react-native-firebase\app\package.json
:react-native-firebase_storage:firebase.bom using default value: 30.5.0
:react-native-firebase_storage package.json found at C:\Users\ZAIIIN\ChatApp\node_modules\#react-native-firebase\storage\package.json
:react-native-firebase_storage:version set from package.json: 15.7.0 (15,7,0 - 15007000)
:react-native-firebase_storage:android.compileSdk using custom value: 31
:react-native-firebase_storage:android.targetSdk using custom value: 31
:react-native-firebase_storage:android.minSdk using custom value: 21
:react-native-firebase_storage:reactNativeAndroidDir C:\Users\ZAIIIN\ChatApp\node_modules\react-native\android
> Configure project :react-native-reanimated
AAR for react-native-reanimated has been found
C:\Users\ZAIIIN\ChatApp\node_modules\react-native-reanimated\android\react-native-reanimated-70-hermes.aar
WARNING:We recommend using a newer Android Gradle plugin to use compileSdk = 33
This Android Gradle plugin (7.2.1) was tested up to compileSdk = 32
This warning can be suppressed by adding
android.suppressUnsupportedCompileSdk=33
to this project's gradle.properties
The build will continue, but you are strongly encouraged to update your project to
use a newer Android Gradle Plugin that has been tested with compileSdk = 33
> Task :app:mergeDebugNativeLibs FAILED
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
347 actionable tasks: 3 executed, 344 up-to-date
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:mergeDebugNativeLibs'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.MergeNativeLibsTask$MergeNativeLibsTaskWorkAction
> 2 files found with path 'lib/arm64-v8a/New folder/libjingle_peerconnection_so.so' from inputs:
- C:\Users\ZAIIIN\.gradle\caches\transforms-3\b259cd2cc3b41e1063fc5003f03931e5\transformed\jetified-libjingle_peerconnection.so\arm64-v8a\New folder\libjingle_peerconnection_so.so
- C:\Users\ZAIIIN\.gradle\caches\transforms-3\a88d183cc228d5f56d1c5c48beedc372\transformed\jetified-libjingle_peerconnection.so\arm64-v8a\New folder\libjingle_peerconnection_so.so
If you are using jniLibs and CMake IMPORTED targets, see
https://developer.android.com/r/tools/jniLibs-vs-imported-targets
* Try:
> 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.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
java.lang.StackOverflowError (no error message)
* Try:
> 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.
==============================================================================
* Get more help at https://help.gradle.org
BUILD FAILED in 1m 3s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:mergeDebugNativeLibs'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.MergeNativeLibsTask$MergeNativeLibsTaskWorkAction
> 2 files found with path 'lib/arm64-v8a/New folder/libjingle_peerconnection_so.so' from inputs:
- C:\Users\ZAIIIN\.gradle\caches\transforms-3\b259cd2cc3b41e1063fc5003f03931e5\transformed\jetified-libjingle_peerconnection.so\arm64-v8a\New folder\libjingle_peerconnection_so.so
- C:\Users\ZAIIIN\.gradle\caches\transforms-3\a88d183cc228d5f56d1c5c48beedc372\transformed\jetified-libjingle_peerconnection.so\arm64-v8a\New folder\libjingle_peerconnection_so.so
If you are using jniLibs and CMake IMPORTED targets, see
https://developer.android.com/r/tools/jniLibs-vs-imported-targets
* Try:
> 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.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
java.lang.StackOverflowError (no error message)
* Try:
> 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.
==============================================================================
* Get more help at https://help.gradle.org
BUILD FAILED in 1m 3s
at makeError (C:\Users\ZAIIIN\ChatApp\node_modules\#react-native-community\cli-platform-android\node_modules\execa\in at C:\Users\ZAIIIN\ChatApp\node_modules\#react-native-community\cli-platform-android\node_modules\execa\index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (C:\Users\ZAIIIN\ChatApp\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
at async Command.handleAction (C:\Users\ZAIIIN\ChatApp\node_modules\#react-native-community\cli\build\index.js:142:9)info Run CLI with --verbose flag for more details.
Packags
{
"name": "ChatApp",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"#react-native-community/masked-view": "^0.1.11",
"#react-native-community/netinfo": "^9.3.7",
"#react-native-firebase/app": "^15.7.0",
"#react-native-firebase/auth": "^15.7.0",
"#react-native-firebase/firestore": "^15.7.0",
"#react-native-firebase/storage": "^15.7.0",
"#react-navigation/bottom-tabs": "^6.4.3",
"#react-navigation/native": "^6.0.16",
"#react-navigation/native-stack": "^6.9.4",
"#reduxjs/toolkit": "^1.9.1",
"#videosdk.live/react-native-sdk": "^0.0.41",
"radio-buttons-react-native": "^1.0.4",
"react": "18.1.0",
"react-native": "^0.70.6",
"react-native-flash-message": "^0.3.1",
"react-native-gesture-handler": "^2.8.0",
"react-native-gifted-chat": "^1.0.4",
"react-native-image-picker": "^4.10.2",
"react-native-incall-manager": "^4.0.1",
"react-native-popup-menu": "^0.16.1",
"react-native-push-notification": "^8.1.1",
"react-native-reanimated": "^2.13.0",
"react-native-safe-area-context": "^4.4.1",
"react-native-screens": "^3.18.2",
"react-native-vector-icons": "^9.2.0",
"react-native-video": "^5.2.1",
"react-native-webrtc": "^106.0.1",
"react-navigation": "^4.4.4",
"react-redux": "^8.0.5"
},
"devDependencies": {
"#babel/core": "^7.12.9",
"#babel/runtime": "^7.12.5",
"#react-native-community/eslint-config": "^2.0.0",
"babel-jest": "^29.3.1",
"eslint": "^7.32.0",
"jest": "^29.3.1",
"metro-react-native-babel-preset": "0.72.3",
"react-test-renderer": "18.1.0"
},
"jest": {
"preset": "react-native"
}
}
Android/App/build.gradle
buildToolsVersion = "31.0.0"
minSdkVersion = 21
compileSdkVersion = 31
targetSdkVersion = 31
I faced this problem after applying Video Call Module. Please help me to solve this problem. Thank You!!!

Illegal char <*> at index 98: C:\Users\xujian\project\duxapp\node_modules\react-native\ReactAndroid\build\intermediates\library_*\*\jni

FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
Where:
Build file 'C:\Users\xujian\project\duxapp\node_modules\expo-av\android\build.gradle' line: 13
What went wrong:
A problem occurred evaluating project ':expo-av'.
Illegal char <> at index 98: C:\Users\xujian\project\duxapp\node_modules\react-native\ReactAndroid\build\intermediates\library_*\jni
Try:
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.
==============================================================================
2: Task failed with an exception.
What went wrong:
A problem occurred configuring project ':expo'.
compileSdkVersion is not specified. Please add it to build.gradle
This problem occurs when packaging on windows
"react-native": "^0.69.5",
"expo": "~46.0.9",
"expo-av": "~12.0.4",
"expo-barcode-scanner": "~11.4.0",
"expo-brightness": "~10.3.0",
"expo-camera": "~12.3.0",
"expo-file-system": "~14.1.0",
"expo-image-picker": "~13.3.1",
"expo-keep-awake": "~10.2.0",
"expo-location": "~14.3.0",
"expo-modules-core": "~0.11.4",
"expo-permissions": "~13.2.0",
"expo-sensors": "~11.4.0",

Expo build failed for android

I'm building a react native app that is using the ble plx library.
For that I think it got ejected.
Now I'm trying to publish a internal test in the google play store.
I ran the command expo build -p android to create an apk for this purpose and got the error message:
[stderr] FAILURE: Build failed with an exception.
[stderr] * What went wrong:
[stderr] Execution failed for task ':expo-updates:kaptReleaseKotlin'.
[stderr] > A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptExecution
[stderr] > java.lang.reflect.InvocationTargetException (no error message)
[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 6m 13s
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.9/userguide/command_line_interface.html#sec:command_line_warnings
389 actionable tasks: 389 executed
Error: Gradle build failed with unknown error. Please see logs for the "Run gradlew" phase.
Package.json:
{
"name": "app",
"version": "0.0.4",
"scripts": {
"start": "expo start --dev-client",
"android": "expo run:android",
"ios": "expo run:ios",
"web": "expo start --web",
"eject": "expo eject",
"test": "jest --watchAll"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"#config-plugins/react-native-ble-plx": "^0.0.2",
"#ethersproject/shims": "^5.5.0",
"#expo/vector-icons": "^12.0.0",
"#react-native-clipboard/clipboard": "^1.8.5",
"#react-navigation/bottom-tabs": "^6.2.0",
"#react-navigation/native": "^6.0.8",
"#react-navigation/native-stack": "^6.4.1",
"#reduxjs/toolkit": "^1.7.2",
"base64-arraybuffer": "^1.0.1",
"ethers": "^5.5.4",
"expo": "^44.0.0",
"expo-asset": "~8.4.6",
"expo-constants": "~13.0.1",
"expo-dev-client": "~0.8.4",
"expo-font": "~10.0.4",
"expo-linking": "~3.0.0",
"expo-random": "~12.1.1",
"expo-secure-store": "~11.1.0",
"expo-splash-screen": "~0.14.1",
"expo-status-bar": "~1.2.0",
"expo-updates": "~0.11.6",
"expo-web-browser": "~10.1.0",
"moment": "^2.29.1",
"react": "17.0.1",
"react-dom": "17.0.1",
"react-native": "0.64.3",
"react-native-ble-plx": "^2.0.3",
"react-native-elements": "^3.4.2",
"react-native-gesture-handler": "~2.1.0",
"react-native-get-random-values": "~1.7.0",
"react-native-keep-awake": "^4.0.0",
"react-native-nfc-manager": "^3.13.2",
"react-native-pager-view": "^6.0.0-rc.1",
"react-native-paper": "^4.11.2",
"react-native-reanimated": "~2.3.1",
"react-native-safe-area-context": "3.3.2",
"react-native-screens": "~3.10.1",
"react-native-snackbar": "^2.4.0",
"react-native-step-indicator": "^1.0.3",
"react-native-video": "^5.2.0",
"react-native-web": "0.17.1",
"react-redux": "^7.2.6"
},
"devDependencies": {
"#babel/core": "^7.12.9",
"#types/react": "~17.0.21",
"#types/react-native": "~0.64.12",
"#types/react-native-keep-awake": "^2.0.3",
"#types/react-native-video": "^5.0.13",
"#typescript-eslint/eslint-plugin": "^5.10.2",
"#typescript-eslint/parser": "^5.10.2",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-promise": "^5.2.0",
"eslint-plugin-react": "^7.27.1",
"jest-expo": "^44.0.0",
"json-server": "^0.17.0",
"prettier": "^2.5.1",
"typescript": "~4.3.5"
},
"private": true
}
I tried to run eas build as well but it failed with the same error.
I could guess it's because the app is ejected but I'm not sure how to fix this.
How can I build successfully?
My problem was fixed by adding "image" : "latest" to the eas config.
It seems like the jdk used by default has a bug that prevents from building for release.

Categories

Resources