Expo 49 Gradle在本地运行eas build进行开发时出错

qq24tv8q  于 2024-01-08  发布在  其他
关注(0)|答案(1)|浏览(138)

我试图在本地构建一个Expo React Native应用程序,以便在Android模拟器上进行测试,因为我使用的react-native-auth 0不支持Expo Go。然而,当我尝试构建时,我得到了这个错误:

  1. [RUN_GRADLEW] FAILURE: Build failed with an exception.
  2. [RUN_GRADLEW] * What went wrong:
  3. [RUN_GRADLEW] A problem occurred configuring root project 'FIRST2'.
  4. [RUN_GRADLEW] > Could not determine the dependencies of null.
  5. [RUN_GRADLEW] > Could not resolve all task dependencies for configuration ':classpath'.
  6. [RUN_GRADLEW] > Could not resolve expo.modules:expo-dev-launcher-gradle-plugin.
  7. [RUN_GRADLEW] Required by:
  8. [RUN_GRADLEW] project :
  9. [RUN_GRADLEW] > No matching variant of project :expo-dev-launcher-gradle-plugin
  10. [RUN_GRADLEW] was found. The consumer was configured to find
  11. [RUN_GRADLEW] a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '7.4.2'
  12. [RUN_GRADLEW] but:
  13. [RUN_GRADLEW] - Variant 'apiElements' capability expo.modules:expo-dev-launcher-gradle-plugin:unspecified declares
  14. [RUN_GRADLEW] a library, packaged as a jar, and its dependencies declared externally:
  15. [RUN_GRADLEW] - Incompatible because this component declares an API of a component compatible with Java 11 and the consumer needed
  16. [RUN_GRADLEW] a runtime of a component compatible with Java 8
  17. [RUN_GRADLEW] - Other compatible attribute:
  18. [RUN_GRADLEW] - Doesn't say anything about
  19. [RUN_GRADLEW] org.gradle.plugin.api-version (required '7.4.2')
  20. [RUN_GRADLEW] - Variant 'mainSourceElements' capability expo.modules:expo-dev-launcher-gradle-plugin:unspecified declares a component, and its dependencies declared externally:
  21. [RUN_GRADLEW] - Incompatible because this component declares
  22. [RUN_GRADLEW] a component of category 'verification' and the consumer needed
  23. [RUN_GRADLEW] a library
  24. [RUN_GRADLEW] - Other compatible attributes:
  25. [RUN_GRADLEW] - Doesn't say anything about
  26. [RUN_GRADLEW] its target Java version (required compatibility with Java 8)
  27. [RUN_GRADLEW] - Doesn't say anything about
  28. [RUN_GRADLEW] its elements (required them packaged as a jar)
  29. [RUN_GRADLEW] - Doesn't say anything about org.gradle.plugin.api-version (required '7.4.2')
  30. [RUN_GRADLEW] - Doesn't say anything about its usage (required a runtime)
  31. [RUN_GRADLEW] - Variant 'runtimeElements' capability expo.modules:expo-dev-launcher-gradle-plugin:unspecified declares
  32. [RUN_GRADLEW] a runtime of a library, packaged as a jar, and its dependencies declared externally:
  33. [RUN_GRADLEW] - Incompatible because this component declares a component compatible with Java 11 and the consumer needed
  34. [RUN_GRADLEW] a component compatible with Java 8
  35. [RUN_GRADLEW] - Other compatible attribute:
  36. [RUN_GRADLEW] - Doesn't say anything about org.gradle.plugin.api-version (required '7.4.2')
  37. [RUN_GRADLEW] - Variant 'testResultsElementsForTest' capability expo.modules:expo-dev-launcher-gradle-plugin:unspecified:
  38. [RUN_GRADLEW] - Incompatible because this component declares a component of category 'verification' and the consumer needed a library
  39. [RUN_GRADLEW] - Other compatible attributes:
  40. [RUN_GRADLEW] - Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
  41. [RUN_GRADLEW] - Doesn't say anything about its target Java version (required compatibility with Java 8)
  42. [RUN_GRADLEW] - Doesn't say anything about its elements (required them packaged as a jar)
  43. [RUN_GRADLEW] - Doesn't say anything about org.gradle.plugin.api-version (required '7.4.2')
  44. [RUN_GRADLEW] - Doesn't say anything about its usage (required a runtime)
  45. [RUN_GRADLEW] > Could not resolve com.android.tools.build:gradle:7.4.2.
  46. [RUN_GRADLEW] Required by:
  47. [RUN_GRADLEW] project :
  48. [RUN_GRADLEW] > No matching variant of com.android.tools.build:gradle:7.4.2
  49. [RUN_GRADLEW] was found. The consumer was configured to find a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '7.4.2' but:
  50. [RUN_GRADLEW] - Variant 'apiElements' capability com.android.tools.build:gradle:7.4.2 declares a library, packaged as a jar, and its dependencies declared externally:
  51. [RUN_GRADLEW] - Incompatible because this component declares an API of a component compatible with Java 11 and the consumer needed a runtime of a component compatible with Java 8
  52. [RUN_GRADLEW] - Other compatible attribute:
  53. [RUN_GRADLEW] - Doesn't say anything about org.gradle.plugin.api-version (required '7.4.2')
  54. [RUN_GRADLEW] - Variant 'javadocElements' capability com.android.tools.build:gradle:7.4.2 declares a runtime of a component, and its dependencies declared externally:
  55. [RUN_GRADLEW] - Incompatible because this component declares documentation and the consumer needed a library
  56. [RUN_GRADLEW] - Other compatible attributes:
  57. [RUN_GRADLEW] - Doesn't say anything about its target Java version (required compatibility with Java 8)
  58. [RUN_GRADLEW] - Doesn't say anything about its elements (required them packaged as a jar)
  59. [RUN_GRADLEW] - Doesn't say anything about org.gradle.plugin.api-version (required '7.4.2')
  60. [RUN_GRADLEW] - Variant 'runtimeElements' capability com.android.tools.build:gradle:7.4.2 declares a runtime of a library, packaged as a jar, and its dependencies declared externally:
  61. [RUN_GRADLEW] - Incompatible because this component declares a component compatible with Java 11 and the consumer needed a component compatible with Java 8
  62. [RUN_GRADLEW] - Other compatible attribute:
  63. [RUN_GRADLEW] - Doesn't say anything about org.gradle.plugin.api-version (required '7.4.2')
  64. [RUN_GRADLEW] - Variant 'sourcesElements' capability com.android.tools.build:gradle:7.4.2 declares a runtime of a component, and its dependencies declared externally:
  65. [RUN_GRADLEW] - Incompatible because this component declares documentation and the consumer needed a library
  66. [RUN_GRADLEW] - Other compatible attributes:
  67. [RUN_GRADLEW] - Doesn't say anything about its target Java version (required compatibility with Java 8)
  68. [RUN_GRADLEW] - Doesn't say anything about its elements (required them packaged as a jar)
  69. [RUN_GRADLEW] - Doesn't say anything about org.gradle.plugin.api-version (required '7.4.2')
  70. [RUN_GRADLEW] > Could not resolve com.facebook.react:react-native-gradle-plugin.
  71. [RUN_GRADLEW] Required by:
  72. [RUN_GRADLEW] project :
  73. [RUN_GRADLEW] > No matching variant of project :gradle-plugin was found. The consumer was configured to find a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '7.4.2' but:
  74. [RUN_GRADLEW] - Variant 'apiElements' capability com.facebook.react:react-native-gradle-plugin:unspecified declares a library, packaged as a jar, and its dependencies declared externally:
  75. [RUN_GRADLEW] - Incompatible because this component declares an API of a component compatible with Java 11 and the consumer needed a runtime of a component compatible with Java 8
  76. [RUN_GRADLEW] - Other compatible attribute:
  77. [RUN_GRADLEW] - Doesn't say anything about org.gradle.plugin.api-version (required '7.4.2')
  78. [RUN_GRADLEW] - Variant 'mainSourceElements' capability com.facebook.react:react-native-gradle-plugin:unspecified declares a component, and its dependencies declared externally:
  79. [RUN_GRADLEW] - Incompatible because this component declares a component of category 'verification' and the consumer needed a library
  80. [RUN_GRADLEW] - Other compatible attributes:
  81. [RUN_GRADLEW] - Doesn't say anything about its target Java version (required compatibility with Java 8)
  82. [RUN_GRADLEW] - Doesn't say anything about its elements (required them packaged as a jar)
  83. [RUN_GRADLEW] - Doesn't say anything about org.gradle.plugin.api-version (required '7.4.2')
  84. [RUN_GRADLEW] - Doesn't say anything about its usage (required a runtime)
  85. [RUN_GRADLEW] - Variant 'runtimeElements' capability com.facebook.react:react-native-gradle-plugin:unspecified declares a runtime of a library, packaged as a jar, and its dependencies declared externally:
  86. [RUN_GRADLEW] - Incompatible because this component declares a component compatible with Java 11 and the consumer needed a component compatible with Java 8
  87. [RUN_GRADLEW] - Other compatible attribute:
  88. [RUN_GRADLEW] - Doesn't say anything about org.gradle.plugin.api-version (required '7.4.2')
  89. [RUN_GRADLEW] - Variant 'testResultsElementsForTest' capability com.facebook.react:react-native-gradle-plugin:unspecified:
  90. [RUN_GRADLEW] - Incompatible because this component declares a component of category 'verification' and the consumer needed a library
  91. [RUN_GRADLEW] - Other compatible attributes:
  92. [RUN_GRADLEW] - Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
  93. [RUN_GRADLEW] - Doesn't say anything about its target Java version (required compatibility with Java 8)
  94. [RUN_GRADLEW] - Doesn't say anything about its elements (required them packaged as a jar)
  95. [RUN_GRADLEW] - Doesn't say anything about org.gradle.plugin.api-version (required '7.4.2')
  96. [RUN_GRADLEW] - Doesn't say anything about its usage (required a runtime)
  97. [RUN_GRADLEW] * Try:
  98. [RUN_GRADLEW] > Run with --stacktrace option to get the stack trace.
  99. [RUN_GRADLEW] > Run with --info or --debug option to get more log output.
  100. [RUN_GRADLEW] > Run with --scan to get full insights.
  101. [RUN_GRADLEW] * Get more help at https://help.gradle.org
  102. [RUN_GRADLEW] BUILD FAILED in 4s
  103. [RUN_GRADLEW] Error: Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.
  104. Build failed
  105. Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.
  106. npx exited with non-zero code: 1

字符串
我试过更改JDK版本(使用OpenJDK 21),Gradle版本(尝试8.0.1,7.5.1和7.4.2)。我完全迷失在这里。
这是我的包。json:

  1. {
  2. "name": "first2-app",
  3. "version": "1.0.0",
  4. "main": "node_modules/expo/AppEntry.js",
  5. "scripts": {
  6. "start": "expo start",
  7. "android": "expo run:android",
  8. "ios": "expo run:ios",
  9. "web": "expo start --web",
  10. "start-clearcache": "expo start -c"
  11. },
  12. "dependencies": {
  13. "@react-navigation/native": "^6.1.9",
  14. "@react-navigation/native-stack": "^6.9.15",
  15. "@reduxjs/toolkit": "^1.9.7",
  16. "axios": "^1.5.1",
  17. "expo": "~49.0.15",
  18. "expo-dev-client": "~2.4.11",
  19. "expo-location": "~16.1.0",
  20. "expo-splash-screen": "~0.20.5",
  21. "expo-status-bar": "~1.6.0",
  22. "nativewind": "^2.0.11",
  23. "react": "18.2.0",
  24. "react-native": "0.72.6",
  25. "react-native-auth0": "^3.0.2",
  26. "react-native-maps": "1.7.1",
  27. "react-native-safe-area-context": "4.6.3",
  28. "react-native-screens": "~3.22.0",
  29. "react-redux": "^8.1.3"
  30. },
  31. "devDependencies": {
  32. "@babel/core": "^7.20.0",
  33. "@types/react": "~18.2.14",
  34. "tailwindcss": "^3.3.2",
  35. "typescript": "^5.1.3"
  36. },
  37. "private": true
  38. }


eas.json:

  1. {
  2. "cli": {
  3. "version": ">= 0.42.4"
  4. },
  5. "build": {
  6. "development": {
  7. "distribution": "internal",
  8. "android": {
  9. "gradleCommand": ":app:assembleDebug"
  10. },
  11. "ios": {
  12. "buildConfiguration": "Debug"
  13. }
  14. },
  15. "preview": {
  16. "distribution": "internal",
  17. "ios": {
  18. "simulator": true
  19. }
  20. },
  21. "production": {}
  22. },
  23. "submit": {
  24. "production": {}
  25. }
  26. }

l2osamch

l2osamch1#

这eas.json文件需要包括'通道'

  1. {
  2. "cli": {
  3. "version": ">= 0.42.4"
  4. },
  5. "build": {
  6. "development": {
  7. "distribution": "internal",
  8. "android": {
  9. "gradleCommand": ":app:assembleDebug"
  10. },
  11. "ios": {
  12. "buildConfiguration": "Debug"
  13. },
  14. "channel": "development"
  15. },
  16. "preview": {
  17. "distribution": "internal",
  18. "ios": {
  19. "simulator": true
  20. },
  21. "channel": "preview"
  22. },
  23. "production": {}
  24. },
  25. "submit": {
  26. "production": {}
  27. }
  28. }

字符串

展开查看全部

相关问题