invertase / react-native-google-mobile-ads

React Native Google Mobile Ads enables you to monetize your app with AdMob.
https://docs.page/invertase/react-native-google-mobile-ads
Other
625 stars 121 forks source link

[🐛] `13.2.1` is causing `react-native-version` to fail with a syntax error #571

Closed PatrickMilroy closed 1 week ago

PatrickMilroy commented 1 month ago

What happened?

Similar to https://github.com/invertase/react-native-google-mobile-ads/issues/368, after upgrading to react-native-google-mobile-ads@13.2.1 (latest at time of writing), running react-native-version results in the below error when attempting to update the version number for iOS

$ react-native-version
[RNV] Versioning Android...
[RNV] Android updated
[RNV] Versioning iOS...
[RNV] SyntaxError: Expected "\"", "\\'", "\\\"", "\\n", or [^\\"] but "\\" found.
Usage: react-native-version [options] [projectPath]

Either:

Allows the react-native-version process to complete normally.

At this time I haven't tried iterating through indivdual release to pinpoint which exact release this stopped working Edit: issue seems to have been introduced with release 12.9.0, versions 12.8.0 and earlier do not experience this issue

Platforms

Only on iOS

React Native Info

info Fetching system and libraries information...
System:
  OS: macOS 14.4.1
  CPU: (10) arm64 Apple M1 Max
  Memory: 64.64 MB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.16.0
    path: /var/folders/w8/lh28lbz17416zbx4b_byc2nm0000gn/T/yarn--1715224993114-0.587831004985885/node
  Yarn:
    version: 1.22.19
    path: /var/folders/w8/lh28lbz17416zbx4b_byc2nm0000gn/T/yarn--1715224993114-0.587831004985885/yarn
  npm:
    version: 9.5.1
    path: ~/.nvm/versions/node/v18.16.0/bin/npm
  Watchman:
    version: 2023.12.04.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /Users/patrick/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.2
      - iOS 17.2
      - macOS 14.2
      - tvOS 17.2
      - watchOS 10.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2022.1 AI-221.6008.13.2211.9619390
  Xcode:
    version: 15.1/15C65
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.10
    path: /Users/patrick/.jenv/shims/javac
  Ruby:
    version: 2.7.5
    path: /Users/patrick/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.73.6
    wanted: ^0.73.6
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

info React Native v0.74.1 is now available (your project is running on v0.73.6).
info Changelog: https://github.com/facebook/react-native/releases/tag/v0.74.1
info Diff: https://react-native-community.github.io/upgrade-helper/?from=0.74.1
info For more info, check out "https://reactnative.dev/docs/upgrading?os=macos".
✨  Done in 2.83s.

Are your using Typescript?

package.json

{
  "name": "the-game-react-native",
  "version": "1.1.45",
  "private": true,
  "typings": "./index.d.ts",
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "TZ=UTC jest",
    "lint": "eslint . --ext .js,.jsx,.ts,.tsx",
    "tsc": "tsc",
    "version": "react-native-version",
    "postversion": "react-native-version --amend"
  },
  "dependencies": {
    "@babel/preset-env": "^7.20.2",
    "@bam.tech/react-native-image-resizer": "^3.0.4",
    "@datadog/mobile-react-native": "^2.2.0",
    "@datadog/mobile-react-navigation": "^2.2.0",
    "@jsamr/counter-style": "^2.0.2",
    "@notifee/react-native": "^7.5.0",
    "@react-native-async-storage/async-storage": "^1.21.0",
    "@react-native-clipboard/clipboard": "^1.11.1",
    "@react-native-community/datetimepicker": "^7.6.2",
    "@react-native-community/netinfo": "^11.3.1",
    "@react-native-firebase/analytics": "^18.3.0",
    "@react-native-firebase/app": "^18.3.0",
    "@react-native-firebase/dynamic-links": "^18.3.0",
    "@react-native-firebase/messaging": "^18.3.0",
    "@react-native-firebase/remote-config": "^18.3.0",
    "@react-navigation/bottom-tabs": "^6.4.0",
    "@react-navigation/native": "^6.1.17",
    "@react-navigation/native-stack": "^6.9.26",
    "@react-navigation/stack": "^6.3.29",
    "@tanstack/react-query": "^4.16.1",
    "appcenter": "4.4.5",
    "appcenter-analytics": "4.4.5",
    "appcenter-crashes": "4.4.5",
    "axios": "^0.27.2",
    "date-fns": "^2.29.3",
    "date-fns-tz": "^1.3.7",
    "jwt-decode": "^3.1.2",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-native": "^0.73.6",
    "react-native-app-auth": "^6.4.3",
    "react-native-component-inview": "^1.0.2",
    "react-native-config": "^1.4.11",
    "react-native-document-picker": "^8.1.3",
    "react-native-encrypted-storage": "^4.0.3",
    "react-native-fs": "^2.20.0",
    "react-native-gesture-handler": "^2.14.0",
    "react-native-get-random-values": "^1.8.0",
    "react-native-google-mobile-ads": "13.2.1",
    "react-native-image-picker": "^5.0.2",
    "react-native-input-spinner": "^1.7.12",
    "react-native-linear-gradient": "^2.6.2",
    "react-native-popup-menu": "^0.16.1",
    "react-native-reanimated": "^3.6.0",
    "react-native-reanimated-skeleton": "^1.5.1",
    "react-native-recaptcha-that-works": "^1.3.2",
    "react-native-render-html": "^6.3.4",
    "react-native-responsive-linechart": "^5.7.1",
    "react-native-safe-area-context": "^4.8.2",
    "react-native-screens": "^3.28.0",
    "react-native-share": "^8.1.0",
    "react-native-shimmer-placeholder": "^2.0.9",
    "react-native-svg": "^15.1.0",
    "react-native-switch-with-icons": "^3.0.1",
    "react-native-table-component": "^1.2.2",
    "react-native-triangle": "^0.0.9",
    "react-native-ui-lib": "^6.23.2",
    "react-native-view-shot": "^3.5.0",
    "react-native-vision-camera": "^3.9.2",
    "react-native-webview": "^13.6.1",
    "react-string-replace": "^1.1.0",
    "styled-components": "^6.1.8",
    "stylis": "^4.0.0",
    "uuid": "^9.0.0",
    "validator": "^13.7.0"
  },
  "devDependencies": {
    "@babel/core": "^7.20.2",
    "@babel/preset-env": "^7.20.2",
    "@babel/runtime": "^7.20.1",
    "@react-native/babel-preset": "0.73.21",
    "@react-native/eslint-config": "0.73.2",
    "@react-native/metro-config": "0.73.5",
    "@react-native/typescript-config": "0.73.1",
    "@testing-library/react-native": "12.5.0",
    "@tsconfig/react-native": "^2.0.2",
    "@types/jest": "^29.2.3",
    "@types/react": "18.2.72",
    "@types/react-native": "^0.70.8",
    "@types/react-native-table-component": "^1.2.4",
    "@types/react-native-version-check": "^3.4.5",
    "@types/react-test-renderer": "^18.0.0",
    "@types/url-parse": "^1.4.8",
    "@types/uuid": "^8.3.4",
    "@types/validator": "^13.7.10",
    "@typescript-eslint/eslint-plugin": "^5.43.0",
    "@typescript-eslint/parser": "^5.43.0",
    "axios-mock-adapter": "^1.21.2",
    "babel-jest": "^29.3.1",
    "babel-plugin-module-resolver": "^5.0.0",
    "eslint": "^8.27.0",
    "jest": "^29.7.0",
    "jest-transform-stub": "^2.0.0",
    "prettier": "2.8.8",
    "react-native-version": "^4.0.0",
    "react-test-renderer": "18.2.0",
    "typescript": "5.0.4"
  },
  "engines": {
    "node": ">=18"
  }
}

app.json

{
  "name": "thegameapp",
  "displayName": "The Game",
  "react-native-google-mobile-ads": {
    "android_app_id": "ca-app-pub-....",
    "ios_app_id": "ca-app-pub-..."
  }
}

ios/Podfile

No response

android/build.gradle

No response

android/app/build.gradle

No response

android/settings.gradle

No response

AndroidManifest.xml

No response

PatrickMilroy commented 1 month ago

At a guess, it would be this line here

https://github.com/invertase/react-native-google-mobile-ads/blob/cbbffcaf66a961e78588f9b6136dc1d65c8f8eea/ios_config.sh#L96

Not entirely sure if \ before the parentheses is correct here as it results in \\ in project.pbxproj:

... -maxdepth 2 \\( -name ${_JSON_FILE_NAME} -o -name ${_JS_APP_CONFIG_FILE_NAME} \\) -print | /usr/bin/head -n 1)\n\n ...

Maybe needs to be wrapped in single quotes instead?

github-actions[bot] commented 3 weeks ago

Hello 👋, to help manage issues we automatically close stale issues.

This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?

This issue will be closed in 15 days if no further activity occurs.

Thank you for your contributions.