I inherited someone else’s react-native project. When I run npx expo run:android
, I get the following errors:
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:mergeExtDexDebug'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Failed to transform play-services-measurement-api-22.1.0.aar (com.google.android.gms:play-services-measurement-api:22.1.0) to match attributes {artifactType=android-dex, asm-transformed-variant=debug, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=21, org.gradle.status=release, org.gradle.usage=java-runtime}.
> Execution failed for DexingWithClasspathTransform: C:\Users\laijo\.gradle\caches\transforms-3\e0ff7396f3443335a20765bf2fad5571\transformed\jetified-play-services-measurement-api-22.1.0-runtime.jar.
> Error while dexing.
* 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.
==============================================================================
However, I can make this error go away by deleting all code in my project that uses @react-native-firebase/analytics
and removing this line from my package.json
"@react-native-firebase/analytics": "^21.0.0",
Alternatively, I could keep "@react-native-firebase/analytics"
, but I’d have to go itno my app.json
file and downgrade the expo.plugins.expo-build-properties.android.*
from 34
to 33
. But downgrading from 34 to 33 causes Google Playstore to reject my app because they say the 33 SDK is no longer supported.
What am I doing wrong? How do I deploy/build a react-native app?
For reference, here is package.json
:
{
"name": "example",
"version": "0.0.7",
"scripts": {
"submit:ios": "npx eas submit --platform ios ",
"build": "npx eas build",
"start": "expo start --dev-client",
"android": "expo run:android",
"ios": "expo run:ios",
"web": "expo start --web",
"eject": "expo eject",
"lint": "eslint .",
"prettify": "yarn prettier --write .",
"test": "jest",
"build:tailwind": "tailwindcss --input input.css --output tailwind.css --no-autoprefixer && tailwind-rn",
"dev:tailwind": "concurrently \"tailwindcss --input input.css --output tailwind.css --no-autoprefixer --watch\" \"tailwind-rn --watch\""
},
"jest": {
"preset": "jest-expo",
"transformIgnorePatterns": [
"node_modules/(?!((jest-)?react-native|@react-native(-community)?)|expo(nent)?|@expo(nent)?/.*|@expo-google-fonts/.*|react-navigation|@react-navigation/.*|@unimodules/.*|unimodules|sentry-expo|native-base|react-native-svg)"
],
"setupFilesAfterEnv": [
"@testing-library/jest-native/extend-expect"
]
},
"dependencies": {
"@expo-google-fonts/open-sans": "^0.2.2",
"@expo/config-plugins": "~6.0.0",
"@react-native-async-storage/async-storage": "^2.0.0",
"@react-native-firebase/analytics": "^21.0.0",
"@react-native-firebase/app": "^21.0.0",
"@react-navigation/drawer": "^6.1.8",
"@react-navigation/material-top-tabs": "^6.0.6",
"@react-navigation/native": "^6.0.6",
"@react-navigation/native-stack": "^6.2.5",
"eslint-plugin-import": "^2.25.3",
"expo": "~48.0.21",
"expo-build-properties": "^0.12.5",
"expo-constants": "~14.2.1",
"expo-dev-client": "~2.2.1",
"expo-font": "~11.1.1",
"expo-linear-gradient": "~12.1.2",
"expo-linking": "~4.0.1",
"expo-splash-screen": "~0.18.2",
"expo-status-bar": "~1.4.4",
"firebase": "^9.6.5",
"postcss": "^8.4.5",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-native": "0.71.14",
"react-native-gesture-handler": "~2.9.0",
"react-native-modal": "^13.0.0",
"react-native-pager-view": "6.1.2",
"react-native-reanimated": "~2.14.4",
"react-native-safe-area-context": "4.5.0",
"react-native-screens": "^3.34.0",
"react-native-svg": "13.4.0",
"react-native-tab-view": "^3.1.1",
"react-native-web": "~0.18.10",
"tailwind-rn": "^4.0.0"
},
"devDependencies": {
"@babel/core": "^7.20.0",
"@babel/eslint-parser": "^7.16.5",
"@testing-library/jest-native": "^4.0.4",
"@testing-library/react-native": "^9.0.0",
"babel-eslint": "^10.1.0",
"concurrently": "^7.0.0",
"eslint": "^8.5.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-react-app": "^7.0.0",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-react": "^7.28.0",
"jest": "^29.2.1",
"jest-expo": "^48.0.0",
"prettier": "2.5.1",
"react-test-renderer": "17",
"tailwindcss": "^3.0.15"
},
"private": true
}
And here is my app.json
{
"expo": {
"name": "example",
"slug": "example",
"version": "1.4.14",
"orientation": "portrait",
"icon": "./assets/icons/appstore.png",
"owner": "example",
"plugins": [
"@react-native-firebase/app",
[
"expo-build-properties",
{
"android": {
"compileSdkVersion": 34,
"targetSdkVersion": 34,
"buildToolsVersion": "34.0.0"
},
"ios": {
"deploymentTarget": "13.4",
"useFrameworks": "static"
}
}
]
],
"assetBundlePatterns": ["**/*"],
"ios": {
"supportsTablet": false,
"bundleIdentifier": "com.example.app",
"googleServicesFile": "./GoogleService-Info.plist",
"buildNumber": "1.0.0"
},
"android": {
"versionCode": 24,
"googleServicesFile": "./google-services.json",
"package": "com.example.app",
"icon": "./assets/logo_big_square_2.png",
"adaptiveIcon": {
"foregroundImage": "./assets/circle_logo.png",
"backgroundColor": "#315564"
}
},
"web": {
"favicon": "./assets/favicon.png"
},
"extra": {
"eas": {
"projectId": "something"
}
}
}
}
You need to sign in to view this answers