[Expo 47] eas build android gradle issue not production

A little bit of context I did upgrade from 46 to 49 and solved all issues (deprecations). We thought that it is stable and I started to release new version (1.3.7/142). Internal testing for iOS through TestFlight was fine and I did internal testing (Google Play Console) for Android and noticed that we have issue when reloading application with Updates.reloadAsync() . So we stop release process.

Today I’m trying to upgrade to 47. I did upgrade with expo-cli upgrade and ran yarn after upgrade. I’ve changed version and versionCode in app.json but it fails when I’m trying to build "distribution": "internal" for Android. iOS is totally fine

FAILURE: Build completed with 2 failures.

[stderr] 
1: Task failed with an exception.

[stderr] 
-----------

[stderr] 
* What went wrong:

[stderr] 
Execution failed for task ':app:checkReleaseDuplicateClasses'.

[stderr] 
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable

[stderr] 
   > Duplicate class kotlin.collections.jdk8.CollectionsJDK8Kt found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk8-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21)

[stderr] 
     Duplicate class kotlin.internal.jdk8.JDK8PlatformImplementations found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk8-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21)

[stderr] 
     Duplicate class kotlin.internal.jdk8.JDK8PlatformImplementations$ReflectSdkVersion found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk8-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21)

[stderr] 
     Duplicate class kotlin.jvm.jdk8.JvmRepeatableKt found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk8-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21)

When I’m switching back to Expo 46 - everything is fine and I can build Android

In your post, please share:

  • managed
  • Your eas-cli version - 3.17.1
  • What you have tried so far - I did research in the internet and tried to change some configs

Here our configs at Expo 47 branch:
app.json:

{
  "expo": {
    "version": "1.3.8",
    "name": "name",
    "slug": "name",
    "orientation": "portrait",
    "icon": "./assets/images/icon.png",
    "scheme": "scheme",
    "userInterfaceStyle": "automatic",
    "privacy": "public",
    "updates": {
      "enabled": true
    },
    "platforms": [
      "ios",
      "android",
      "web"
    ],
    "assetBundlePatterns": [
      "**/*"
    ],
    "ios": {
      "buildNumber": "143"
    },
    "android": {
      "versionCode": 143
    },
    "plugins": [
      "@logrocket/react-native",
      "./withReactNativeMaps",
      [
        "expo-build-properties",
        {
          "ios": {
            "useFrameworks": "static"
          }
        }
      ]
    ]
  }
}

app.config.ts:

const { prepareIntentFilters } = require('./app-config')

const tenant = 'taranis'

export default ({ config }) => {
  const intentFilters = prepareIntentFilters()

  return {
    ...config,
    version: process.env.TARANIS_CONNECT_APP_VERSION || config.version,
    orientation: config.orientation,
    icon: config.icon,
    name: config.name,
    slug: config.slug,
    extra: {
      tenant,
      enableOTA: config.updates?.enabled,
      enableOffline: process.env.ENABLE_OFFLINE,
      storybook: process.env.STORYBOOK_START === 'true',
      firebase_api_key: process.env.FIREBASE_API_KEY,
      firebase_auth_domain: process.env.FIREBASE_AUTH_DOMAIN,
      firebase_db_url: process.env.FIREBASE_DB_URL,
      firebase_project_id: process.env.FIREBASE_PROJECT_ID,
      firebase_storage_bucket: process.env.FIREBASE_STORAGE_BUCKET,
      firebase_messaging_sender_id: process.env.FIREBASE_MESSAGING_SENDER_ID,
      firebase_app_id: process.env.FIREBASE_APP_ID,
      mixpanel_token: process.env.MIXPANEL_TOKEN,
      sentry_dsn: process.env.SENTRY_DSN,
      logRocketAppID: process.env.LOG_ROCKET_APP_ID,
      eas: {
        projectId: process.env.EAS_PROJECT_ID,
      },
      track_analytics: process.env.TRACK_ANALYTICS,
      is_automations: process.env.IS_AUTOMATIONS,
      api_url: process.env.CONNECT_API_URL,
    },
    hooks: {
      postPublish: [
        {
          file: 'sentry-expo/upload-sourcemaps',
          config: {
            organization: 'taranis',
            project: 'taranis-connect-app',
            authToken: process.env.SENTRY_AUTH_TOKEN,
          },
        },
      ],
    },
    notification: {
      icon: './assets/images/notifIcon.png',
    },
    ios: {
      bundleIdentifier: 'ag.taranis.connect',
      googleServicesFile: './GoogleService-Info.plist',
      config: {
        googleMapsApiKey: process.env.GOOGLE_MAPS_API_KEY_IOS,
      },
      infoPlist: {
        LSApplicationQueriesSchemes: ['itms-beta'],
        UIStatusBarStyle: 'UIStatusBarStyleLightContent',
        CFBundleDisplayName: config.name,
        CFBundleName: config.name,
      },
      supportsTablet: true,
      buildNumber: config.ios.buildNumber,
      requireFullScreen: true,
      associatedDomains: ['applinks:dashboard.taranis.ag'],
    },

    web: {
      config: {
        firebase: {
          appId: process.env.FIREBASE_APP_ID,
          apiKey: process.env.FIREBASE_API_KEY,
          measurementId: process.env.FIREBASE_MEASURMENT_ID,
        },
      },
    },

    android: {
      softwareKeyboardLayoutMode: 'pan',
      package: 'ag.taranis.connect',
      googleServicesFile: './google-services.json',
      config: {
        googleMaps: {
          apiKey: process.env.GOOGLE_MAPS_API_KEY_ANDROID,
        },
      },
      versionCode: config.android.versionCode,
      intentFilters,
      permissions: [
        'NOTIFICATIONS',
        'READ_EXTERNAL_STORAGE',
        'WRITE_EXTERNAL_STORAGE',
        'ACCESS_COARSE_LOCATION',
        'ACCESS_FINE_LOCATION',
      ],
      adaptiveIcon: {
        foregroundImage: './assets/images/foregroundAndroid.png',
        backgroundColor: '#256E46',
      },
    },

    androidStatusBar: {
      barStyle: 'dark-content',
      backgroundColor: '#E0E0E0',
    },
    splash: {
      backgroundColor: '#E0E0E0',
      image: './assets/images/powered_by.png',
    },
  }
}

eas.json:

{
  "build": {
    "base": {
      "node": "18.16.1",
      "cache": {
        "disabled": true
      }
    },
    "production": {
      "extends": "base",
      "releaseChannel": "expo_release_channel",
      "android": {
        "image": "latest"
      },
      "ios": {
        "image": "latest"
      }
    },
    "simulator": {
      "extends": "base",
      "releaseChannel": "simulator-rc-47-1",
      "ios": {
        "simulator": true
      },
      "android": {
        "buildType": "apk"
      }
    },
    "e2e-simulator": {
      "extends": "base",
      "releaseChannel": "master-sanity-47-1",
      "ios": {
        "simulator": true
      },
      "android": {
        "buildType": "apk"
      }
    },
    "preview": {
      "extends": "base",
      "distribution": "internal",
      "releaseChannel": "preview-rc-47-10"
    },
    "dev": {
      "extends": "base",
      "developmentClient": true,
      "distribution": "internal",
      "releaseChannel": "dev-rc-47-1"
    }
  },
  "submit": {
    "production": {
      "android": {
        "serviceAccountKeyPath": "./service-account.json"
      },
      "ios": {
        "appleId": "apple_id",
        "ascAppId": "asc_app_id"
      }
    }
  }
}

package.json:

{
  "main": "node_modules/expo/AppEntry.js",
  "version": "1.3.2",
  "scripts": {
    "eas-build-pre-install": "yarn set version berry",
    "env": "cross-env npx env-cmd --silent --no-override",
    "start": "npm run env expo start",
    "android": "yarn run env expo start --android",
    "ios": "yarn run env expo start --ios",
    "ios:disableOffline": "npm run disable:offline -- expo start --ios",
    "web": "expo start --web",
    "eject": "expo eject",
    "test": "jest"
  },
  "jest": {
    "preset": "jest-expo",
    "testMatch": [
      "<rootDir>/src/**/*.test.*"
    ],
    "moduleNameMapper": {
      "^config$": "<rootDir>/__mocks__/config.js",
      "sentry-expo": "<rootDir>/__mocks__/sentry-expo.js",
      "services/logger": "<rootDir>/__mocks__/logger.js",
      "expo-constants": "<rootDir>/__mocks__/expo-constants.js",
      "services/analytics/analytics": "<rootDir>/__mocks__/analytics.js",
      "hooks/useCachedResources": "<rootDir>/__mocks__/useCachedResources.js"
    },
    "transformIgnorePatterns": [
      "/node_modules/@sentry/types"
    ],
    "testEnvironmentOptions": {
      "enzymeAdapter": "react16"
    },
    "moduleFileExtensions": [
      "ts",
      "tsx",
      "js"
    ],
    "setupFiles": [
      "<rootDir>/jest/setupTests.js"
    ],
    "testPathIgnorePatterns": [
      ".*__snapshots__/.*"
    ]
  },
  "dependencies": {
    "@babel/plugin-proposal-private-methods": "^7.18.6",
    "@expo/vector-icons": "^13.0.0",
    "@gorhom/bottom-sheet": "^4.3.2",
    "@logrocket/react-native": "^1.5.0",
    "@ptomasroos/react-native-multi-slider": "^2.2.2",
    "@react-native-async-storage/async-storage": "~1.17.3",
    "@react-native-community/masked-view": "0.1.10",
    "@react-native-community/netinfo": "9.3.5",
    "@react-navigation/drawer": "^6.6.3",
    "@react-navigation/native": "^6.1.7",
    "@react-navigation/native-stack": "^6.9.13",
    "@shopify/flash-list": "^1.4.3",
    "@turf/bbox": "^6.0.1",
    "@turf/center": "^6.5.0",
    "base64-arraybuffer": "^0.2.0",
    "chalk": "^4.1.0",
    "convert-units": "^2.3.4",
    "date-fns": "^2.16.1",
    "expo": "^47.0.0",
    "expo-asset": "~8.7.0",
    "expo-build-properties": "~0.4.1",
    "expo-constants": "~14.0.2",
    "expo-detox-cli": "^1.0.10",
    "expo-dev-client": "~2.0.1",
    "expo-device": "~5.0.0",
    "expo-file-system": "~15.1.1",
    "expo-firebase-analytics": "~8.0.0",
    "expo-font": "~11.0.1",
    "expo-linear-gradient": "~12.0.1",
    "expo-linking": "~3.3.1",
    "expo-localization": "~14.0.0",
    "expo-location": "~15.0.1",
    "expo-notifications": "~0.17.0",
    "expo-screen-orientation": "~5.0.1",
    "expo-sharing": "~11.0.1",
    "expo-splash-screen": "~0.17.5",
    "expo-status-bar": "~1.4.2",
    "expo-updates": "~0.15.6",
    "expo-web-browser": "~12.0.0",
    "firebase": "8.2.3",
    "formik": "^2.2.0",
    "geotiff": "git+https://github.com/taranisag/geotiffRN.git#afabef28bfd75a270b3a75a9641af3563e414e2f",
    "i18n-js": "^3.8.0",
    "immer": "^8.0.0",
    "lodash": "^4.17.20",
    "minimist": "^1.2.5",
    "minisearch": "^3.0.2",
    "native-base": "2.13.12",
    "normalizr": "^3.6.0",
    "pngjs": "^6.0.0",
    "query-string": "^6.13.7",
    "react": "18.1.0",
    "react-dom": "18.1.0",
    "react-error-boundary": "^3.1.0",
    "react-native": "0.70.5",
    "react-native-animatable": "^1.3.3",
    "react-native-calendars": "git+https://github.com/taranisag/react-native-calendars.git#e199a737e68cca1418cff0f04e87018e05c49dfc",
    "react-native-collapsible": "^1.6.0",
    "react-native-elements": "^3.2.0",
    "react-native-gesture-handler": "~2.8.0",
    "react-native-get-random-values": "~1.8.0",
    "react-native-image-pan-zoom": "^2.1.12",
    "react-native-iphone-x-helper": "^1.3.1",
    "react-native-keyboard-aware-scroll-view": "^0.9.3",
    "react-native-map-clustering": "git+https://github.com/taranisag/react-native-map-clustering#587594c12bf0c005161eff295a62559b1b41e019",
    "react-native-maps": "1.3.2",
    "react-native-masked-text": "^1.13.0",
    "react-native-popup-menu": "^0.15.9",
    "react-native-reanimated": "~2.12.0",
    "react-native-safe-area-context": "4.4.1",
    "react-native-screens": "~3.18.0",
    "react-native-snackbar-component": "git+https://github.com/taranisag/react-native-snackbar-component.git#8f6a0d0d08169585aa15d9646170a3f4a23f0ab6",
    "react-native-svg": "13.4.0",
    "react-native-svg-animated-linear-gradient": "^0.4.0",
    "react-native-walkthrough-tooltip": "^1.1.11",
    "react-native-web": "~0.18.7",
    "react-redux": "^7.2.1",
    "redux": "^4.0.5",
    "redux-persist": "^6.0.0",
    "redux-persist-expo-filesystem": "^2.0.0",
    "redux-saga": "^1.1.3",
    "redux-saga-thunk": "^0.7.3",
    "reselect": "^4.0.0",
    "sentry-expo": "~6.0.0",
    "taranis-feature-flags-ui-components": "^1.0.5",
    "text-encoding-polyfill": "^0.6.7",
    "utif": "^3.1.0",
    "uuid": "^8.3.1",
    "victory-area": "35.4.8",
    "victory-axis": "35.4.8",
    "victory-native": "35.3.1",
    "yup": "^0.32.8",
    "zoomable-svg": "^5.0.1"
  },
  "devDependencies": {
    "@babel/core": "^7.19.3",
    "@redux-saga/testing-utils": "^1.1.3",
    "@sentry/types": "^6.0.4",
    "@storybook/addon-actions": "^5.3",
    "@storybook/addon-knobs": "^5.3",
    "@storybook/addon-links": "^5.3",
    "@storybook/addon-ondevice-actions": "^5.3.23",
    "@storybook/addon-ondevice-knobs": "^5.3.23",
    "@storybook/react-native": "^5.3.23",
    "@storybook/react-native-server": "^5.3.23",
    "@testing-library/react-hooks": "^8.0.1",
    "@types/convert-units": "^2.3.2",
    "@types/detox": "^18.1.0",
    "@types/enzyme": "^3.10.8",
    "@types/geojson": "^7946.0.8",
    "@types/i18n-js": "^3.0.3",
    "@types/jasmine": "^3.6.4",
    "@types/jest": "^26.0.20",
    "@types/lodash": "^4.14.161",
    "@types/react": "~18.0.24",
    "@types/react-native": "~0.70.6",
    "@types/react-native-calendars": "^1.505.3",
    "@types/react-native-snackbar-component": "^1.1.0",
    "@types/react-redux": "^7.1.9",
    "@types/utif": "^3.0.1",
    "@types/uuid": "^8.3.0",
    "@typescript-eslint/eslint-plugin": "^4.8.1",
    "@typescript-eslint/parser": "^4.8.1",
    "@wdio/appium-service": "^7.16.3",
    "@wdio/cli": "^7.16.3",
    "@wdio/jasmine-framework": "^7.16.3",
    "@wdio/local-runner": "^7.16.3",
    "@wdio/spec-reporter": "^7.16.3",
    "babel-loader": "^8.1.0",
    "babel-preset-expo": "~9.2.1",
    "child-process-promise": "^2.2.1",
    "concurrently": "^5.3.0",
    "cross-env": "^7.0.3",
    "detox": "^20.9.1",
    "env-cmd": "^10.1.0",
    "enzyme": "^3.11.0",
    "enzyme-adapter-react-16": "^1.15.6",
    "enzyme-to-json": "^3.6.1",
    "eslint": "^7.13.0",
    "eslint-config-airbnb-typescript": "^12.0.0",
    "eslint-plugin-import": "^2.22.1",
    "eslint-plugin-jest": "^24.1.3",
    "eslint-plugin-jsx-a11y": "^6.4.1",
    "eslint-plugin-prettier": "^3.1.4",
    "eslint-plugin-react": "^7.21.5",
    "eslint-plugin-react-hooks": "^4.2.0",
    "eslint-plugin-react-native": "^3.10.0",
    "expect": "^26.6.2",
    "expo-detox-hook": "^1.0.10",
    "fbjs-scripts": "^3.0.1",
    "husky": "^4.3.8",
    "ip": "^1.1.5",
    "jest": "^26.6.3",
    "jest-circus": "^27.5.1",
    "jest-date-mock": "^1.0.8",
    "jest-expo": "^47.0.0",
    "jest-fetch-mock": "^3.0.3",
    "jest-runner": "^27.2.5",
    "jest-silent-reporter": "^0.5.0",
    "jest-summary-reporter": "^0.0.2",
    "json-server": "^0.16.1",
    "patch-package": "^6.4.7",
    "postinstall-postinstall": "^2.1.0",
    "prettier": "2.1.1",
    "react-native-testing-library": "^6.0.0",
    "react-test-renderer": "^18.2.0",
    "reactotron-react-native": "^5.0.0",
    "reactotron-redux": "^3.1.3",
    "redux-devtools-extension": "^2.13.8",
    "semver": "^5.6.0",
    "sleep": "^6.3.0",
    "standard-version": "^7.1.0",
    "standard-version-expo": "^1.0.3",
    "ts-jest": "^24.0.2",
    "typescript": "^4.6.3",
    "xdl": "^51.5.0"
  },
  "resolutions": {
    "d3-array": "2.3.3",
    "expo-modules-autolinking": "0.10.3"
  },
  "private": true,
  "husky": {
    "hooks": {
      "pre-commit": "yarn lint",
      "pre-push": "yarn test"
    }
  },
  "packageManager": "yarn@3.5.0"
}

Resolved

@taranis How did you resolve this?
I have been having this issue for days I can’t figure what is causing the issue.
Here is my package.json file:

{
  "name": "name",
  "version": "1.0.0",
  "keywords": [
    "react",
    "expo",
    "template",
    "nativebase"
  ],
  "license": "MIT",
  "scripts": {
    "start": "expo start --dev-client",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web",
    "eject": "expo eject"
  },
  "dependencies": {
    "@100mslive/react-native-hms": "^1.7.0",
    "@bothrs/expo-mixpanel-analytics": "^2.0.0",
    "@expo-google-fonts/inter": "^0.2.2",
    "@expo/vector-icons": "^13.0.0",
    "@flyerhq/react-native-chat-ui": "^1.4.3",
    "@gorhom/bottom-sheet": "4",
    "@react-native-async-storage/async-storage": "^1.17.11",
    "@react-native-clipboard/clipboard": "^1.11.1",
    "@react-native-community/datetimepicker": "^6.7.3",
    "@react-navigation/bottom-tabs": "^6.3.2",
    "@react-navigation/native": "^6.0.11",
    "@react-navigation/native-stack": "^6.7.0",
    "@react-navigation/stack": "^6.3.14",
    "@reduxjs/toolkit": "^1.8.4",
    "@twilio/conversations": "^2.2.1",
    "@voiceadventures/react-native-voice": "^3.3.1",
    "appmienviochat": "^0.2.9",
    "axios": "^0.27.2",
    "dayjs": "^1.11.5",
    "expo": "48.0.0",
    "expo-analytics-segment": "^11.2.1",
    "expo-av": "^13.2.1",
    "expo-background-fetch": "^11.1.1",
    "expo-dev-client": "~2.2.1",
    "expo-device": "^5.2.1",
    "expo-font": "^11.1.1",
    "expo-google-drive-api-wrapper": "^1.0.2",
    "expo-image-picker": "^14.1.1",
    "expo-linear-gradient": "^12.1.2",
    "expo-linking": "^4.0.1",
    "expo-notifications": "^0.18.1",
    "expo-splash-screen": "^0.18.2",
    "expo-sqlite": "^11.1.1",
    "expo-status-bar": "^1.4.4",
    "expo-task-manager": "^11.1.1",
    "expo-updates": "^0.16.4",
    "formik": "^2.2.9",
    "global": "^4.4.0",
    "moment": "^2.29.4",
    "native-base": "^3.4.25",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-native": "^0.71.8",
    "react-native-calendar-strip": "^2.2.6",
    "react-native-gesture-handler": "^2.9.0",
    "react-native-gifted-chat": "^1.1.0",
    "react-native-mmkv": "^2.4.3",
    "react-native-otp-inputs": "^7.4.0",
    "react-native-paystack-webview": "^4.0.3",
    "react-native-reanimated": "^2.14.4",
    "react-native-safe-area-context": "^4.5.0",
    "react-native-screens": "^3.20.0",
    "react-native-section-list-get-item-layout": "^2.2.3",
    "react-native-svg": "^13.4.0",
    "react-native-svg-charts": "^5.4.0",
    "react-native-web": "^0.18.10",
    "react-native-webview": "11.26.0",
    "react-redux": "^8.0.2",
    "redux-persist": "^6.0.0",
    "tmpl": "^1.0.5",
    "toggle-switch-react-native": "^3.3.0",
    "twilio-chat": "^6.0.0",
    "utf8": "^3.0.0",
    "yup": "^0.32.11"
  },
  "devDependencies": {
    "@babel/core": "^7.19.3",
    "babel-plugin-transform-remove-console": "^6.9.4",
    "eslint": "^8.28.0",
    "eslint-config-universe": "^11.1.1",
    "prettier": "^2.8.0",
    "react-native-svg-transformer": "^1.0.0"
  },
  "eslintConfig": {
    "extends": "universe/native"
  },
  "expo": {
    "autolinking": {
      "exclude": [
        "expo-file-system"
      ]
    }
  }
}

My app.json:

{
  "expo": {
    "name": "name",
    "slug": "slug",
    "version": "1.0.0",
    "orientation": "portrait",
    "icon": "./assets/logo.png",
    "splash": {
      "image": "./assets/splash-logo.png",
      "resizeMode": "contain",
      "backgroundColor": "#ffffff"
    },
    "updates": {
      "fallbackToCacheTimeout": 0
    },
    "assetBundlePatterns": [
      "**/*"
    ],
    "plugins": [
      [
        "expo-image-picker",
        {
          "photosPermission": "The app accesses your photos to let you share them with your friends."
        }
      ]
    ],
    "ios": {
      "supportsTablet": true,
      "bundleIdentifier": "identifier",
      "buildNumber": "15",
      "infoPlist": {
        "NSSpeechRecognitionUsageDescription": "This app uses the Speech Recognition to send audio"
      }
    },
    "android": {
      "allowBackup": true,
      "adaptiveIcon": {
        "foregroundImage": "./assets/logo-android.png",
        "backgroundColor": "#178570"
      },
      "package": "package.name",
      "permissions": [
        "android.permission.RECORD_AUDIO"
      ]
    },
    "web": {
      "favicon": "./assets/favicon.png"
    }
  }
}

My eas.json:

{
  "cli": {
    "version": ">= 1.2.0"
  },
  "build": {
    "development": {
      "developmentClient": true,
      "distribution": "internal"
    },
    "preview": {
      "android": {
        "buildType": "apk"
      }
    },
    "production": {}
  },
  "submit": {
    "production": {}
  }
}