APK file generation of my expo project failed

When trying to generate the app APK file of my expo project, I get the following error during the build process:

WARNING:Software Components will not be created automatically for Maven publishing from Android Gradle Plugin 8.0. To opt-in to the future behavior, set the Gradle property android.disableAutomaticComponentCreation=true in the `gradle.properties` file or use the new publishing DSL.

[stderr] 
FAILURE: Build failed with an exception.

[stderr] 
* Where:

[stderr] 
Build file '/home/expo/workingdir/build/admin/node_modules/react-native-picker/android/build.gradle' line: 25

[stderr] 
* What went wrong:

[stderr] 
A problem occurred evaluating project ':react-native-picker'.

[stderr] 
> Could not find method compile() for arguments [directory 'libs'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

[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

[stderr] 
--scan to get full insights.

[stderr] 
* Get more help at https://help.gradle.org

[stderr] 
BUILD FAILED in 2m 19s

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

5 actionable tasks: 5 executed

Error: Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.

I would like to know how to proceed to correct this problem

This indicates that you’re using an outdated library that still uses compile instead of implementation in its build.gradle.

Could you post your dependencies and devDependencies from package.json? Is it possible you’re using the old built-in React Native “Picker” instead of e.g. @react-native-picker/picker?

here is the used dependencies:

"dependencies": {
    "@react-native-async-storage/async-storage": "~1.17.3",
    "@react-native-picker/picker": "2.4.8",
    "@react-navigation/bottom-tabs": "6.2.0",
    "@react-navigation/material-bottom-tabs": "6.1.1",
    "@react-navigation/material-top-tabs": "6.1.1",
    "@react-navigation/native": "6.0.8",
    "@react-navigation/native-stack": "6.5.0",
    "expo": "^47.0.0",
    "expo-barcode-scanner": "~12.1.0",
    "expo-calendar": "~11.0.1",
    "expo-device": "~5.0.0",
    "expo-firebase-recaptcha": "~2.3.1",
    "expo-google-sign-in": "~10.1.0",
    "expo-image-manipulator": "~11.0.0",
    "expo-image-picker": "~14.0.2",
    "expo-linking": "~3.3.1",
    "expo-location": "~15.0.1",
    "expo-notifications": "~0.17.0",
    "expo-print": "~12.0.0",
    "expo-sharing": "~11.0.1",
    "expo-status-bar": "~1.4.2",
    "expo-updates": "~0.15.6",
    "firebase": "^10.0.0",
    "firebase-admin": "^11.9.0",
    "i18n-js": "^4.2.0",
    "idb-keyval": "6.1.0",
    "moment": "2.29.1",
    "moment-with-locales-es6": "^1.0.1",
    "parse": "3.4.1",
    "react": "18.1.0",
    "react-dom": "18.1.0",
    "react-native": "0.70.8",
    "react-native-bottom-modal": "0.5.6",
    "react-native-calendar-picker": "7.1.2",
    "react-native-element-dropdown": "1.8.2",
    "react-native-elements": "3.4.2",
    "react-native-fs": "2.19.0",
    "react-native-gesture-handler": "~2.8.0",
    "react-native-image-picker": "4.7.3",
    "react-native-image-resizer": "1.4.5",
    "react-native-maps": "1.3.2",
    "react-native-multiple-select": "0.5.7",
    "react-native-pager-view": "6.0.1",
    "react-native-paper": "4.11.2",
    "react-native-photo-upload": "1.3.0",
    "react-native-picker": "^4.3.7",
    "react-native-picker-checkbox": "2.0.2",
    "react-native-picker-select": "8.0.4",
    "react-native-qrcode-svg": "6.1.2",
    "react-native-reanimated": "~2.12.0",
    "react-native-safe-area-context": "4.4.1",
    "react-native-screens": "~3.18.0",
    "react-native-simple-radio-button": "2.7.4",
    "react-native-svg": "13.4.0",
    "react-native-tab-view": "3.1.1",
    "react-native-vector-icons": "9.1.0",
    "react-native-view-shot": "3.4.0",
    "react-native-web": "~0.18.7",
    "react-redux": "7.2.6",
    "redux": "4.1.2",
    "util": "^0.12.5",
    "uuidv4": "6.2.13"
  },
  "devDependencies": {
    "@babel/core": "^7.19.3",
    "jest-node-exports-resolver": "^1.1.6"
  },

Try removing react-native-picker. Version 4.3.7 was published 5 years ago.

I see you also have react-native-element-dropdown - npm installed. This is a similar sort of thing, so you might want to choose one and use that rather than both of them.

There are some other dependencies that are similar to each other. e.g.:

Many thanks, you made my day.

After removing “yarn remove react-native-element-dropdown” and “react-native-picker”: “^4.3.7”, the apk is well generated.

1 Like

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