Open CodFrm opened 1 year ago
android相关环境:
@zhiqingchen 依旧是这一个错误:
yarn run v1.22.17
$ react-native run-android
info Starting JS server...
* daemon not running; starting now at tcp:5037
* daemon started successfully
info Launching emulator...
info Successfully launched emulator.
info Installing the app...
Starting a Gradle Daemon (subsequent builds will be faster)
> Task :react-native-gradle-plugin:compileKotlin
w: /Users/codfrm/Code/caco/taro-test/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt: (10, 37): 'BaseVariant' is deprecated. Deprecated in Java
w: /Users/codfrm/Code/caco/taro-test/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt: (119, 30): 'BaseVariant' is deprecated. Deprecated in Java
w: /Users/codfrm/Code/caco/taro-test/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt: (135, 26): 'BaseVariant' is deprecated. Deprecated in Java
w: /Users/codfrm/Code/caco/taro-test/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt: (157, 32): 'BaseVariant' is deprecated. Deprecated in Java
w: /Users/codfrm/Code/caco/taro-test/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt: (163, 31): 'BaseVariant' is deprecated. Deprecated in Java
w: /Users/codfrm/Code/caco/taro-test/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt: (171, 36): 'BaseVariant' is deprecated. Deprecated in Java
w: /Users/codfrm/Code/caco/taro-test/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt: (114, 48): 'reactRoot: DirectoryProperty' is deprecated. reactRoot was confusing and has been replace with root to point to your root project and reactNativeDir to point to the folder of the react-native NPM package
w: /Users/codfrm/Code/caco/taro-test/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (10, 37): 'ApplicationVariant' is deprecated. Deprecated in Java
w: /Users/codfrm/Code/caco/taro-test/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (11, 37): 'BaseVariant' is deprecated. Deprecated in Java
w: /Users/codfrm/Code/caco/taro-test/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (12, 37): 'LibraryVariant' is deprecated. Deprecated in Java
w: /Users/codfrm/Code/caco/taro-test/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (27, 51): 'BaseVariant' is deprecated. Deprecated in Java
w: /Users/codfrm/Code/caco/taro-test/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (130, 12): 'ApplicationVariant' is deprecated. Deprecated in Java
w: /Users/codfrm/Code/caco/taro-test/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (131, 12): 'LibraryVariant' is deprecated. Deprecated in Java
w: /Users/codfrm/Code/caco/taro-test/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (251, 14): 'BaseVariant' is deprecated. Deprecated in Java
> Configure project :expo-application
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.
> Configure project :expo-av
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.
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
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* Where:
Script '/Users/codfrm/Code/caco/taro-test/node_modules/expo-modules-autolinking/scripts/android/autolinking_implementation.gradle' line: 272
* What went wrong:
A problem occurred evaluating project ':expo'.
> A problem occurred configuring project ':expo-av'.
> Failed to notify project evaluation listener.
> java.lang.NullPointerException: Cannot invoke "String.startsWith(String)" because "versionOutput" is null
> Could not get unknown property 'release' for SoftwareComponentInternal set of type org.gradle.api.internal.component.DefaultSoftwareComponentContainer.
* 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.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':expo'.
> com.android.builder.errors.EvalIssueException: compileSdkVersion is not specified. Please add it to build.gradle
* 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.
==============================================================================
* Get more help at https://help.gradle.org
BUILD FAILED in 18s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* Where:
Script '/Users/codfrm/Code/caco/taro-test/node_modules/expo-modules-autolinking/scripts/android/autolinking_implementation.gradle' line: 272
* What went wrong:
A problem occurred evaluating project ':expo'.
> A problem occurred configuring project ':expo-av'.
> Failed to notify project evaluation listener.
> java.lang.NullPointerException: Cannot invoke "String.startsWith(String)" because "versionOutput" is null
> Could not get unknown property 'release' for SoftwareComponentInternal set of type org.gradle.api.internal.component.DefaultSoftwareComponentContainer.
* 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.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':expo'.
> com.android.builder.errors.EvalIssueException: compileSdkVersion is not specified. Please add it to build.gradle
* 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.
==============================================================================
* Get more help at https://help.gradle.org
BUILD FAILED in 18s
at makeError (/Users/codfrm/Code/caco/taro-test/node_modules/execa/index.js:174:9)
at /Users/codfrm/Code/caco/taro-test/node_modules/execa/index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (/Users/codfrm/Code/caco/taro-test/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:109:5)
at async Command.handleAction (/Users/codfrm/Code/caco/taro-test/node_modules/@react-native-community/cli/build/index.js:142:9)
info Run CLI with --verbose flag for more details.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
建议检查开发环境,以及对比正常编译过程
https://github.com/zhiqingchen/taro-test/actions/runs/4161455307
mac m1 环境 官方react native创建的可正常运行,taro创建的报如上错误
编译过程,是参考官方文档,根据上述github action命令,也错误
项目提交到git上,我看看
@zhiqingchen 就是此项目:https://github.com/zhiqingchen/taro-test/tree/tests/3.6.1,全新创建的模板也不行
执行yarn build:rn --platform android
成功,但是yarn android
失败
codfrm@192 ~/Code/caco/taro-test master yarn build:rn --platform android
yarn run v1.22.17
$ taro build --type rn --platform android
👽 Taro v3.6.1
Welcome to Metro v0.72.3
Fast - Scalable - Integrated
watchman warning: Recrawled this watch 21 times, most recently because:
MustScanSubDirs UserDroppedTo resolve, please review the information on
https://facebook.github.io/watchman/docs/troubleshooting.html#recrawl
To clear this warning, run:
`watchman watch-del '/Users/codfrm/Code/caco/taro-test' ; watchman watch-project '/Users/codfrm/Code/caco/taro-test'`
Recrawled this watch 21 times, most recently because:
MustScanSubDirs UserDroppedTo resolve, please review the information on
https://facebook.github.io/watchman/docs/troubleshooting.html#recrawl
To clear this warning, run:
`watchman watch-del '/Users/codfrm/Code/caco/taro-test' ; watchman watch-project '/Users/codfrm/Code/caco/taro-test'`
info Writing bundle output to:, ./android/app/src/main/assets/index.android.bundle
info Writing sourcemap output to:, ./android/app/src/main/assets/index.android.map
info Done writing bundle output
info Done writing sourcemap output
info Copying 6 asset files
info Done copying assets
✨ Done in 4.58s.
codfrm@192 ~/Code/caco/taro-test master yarn android
yarn run v1.22.17
$ react-native run-android
info Starting JS server...
info Launching emulator...
info Successfully launched emulator.
info Installing the app...
> Task :react-native-gradle-plugin:compileKotlin
w: /Users/codfrm/Code/caco/taro-test/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt: (10, 37): 'BaseVariant' is deprecated. Deprecated in Java
w: /Users/codfrm/Code/caco/taro-test/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt: (119, 30): 'BaseVariant' is deprecated. Deprecated in Java
w: /Users/codfrm/Code/caco/taro-test/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt: (135, 26): 'BaseVariant' is deprecated. Deprecated in Java
w: /Users/codfrm/Code/caco/taro-test/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt: (157, 32): 'BaseVariant' is deprecated. Deprecated in Java
w: /Users/codfrm/Code/caco/taro-test/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt: (163, 31): 'BaseVariant' is deprecated. Deprecated in Java
w: /Users/codfrm/Code/caco/taro-test/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt: (171, 36): 'BaseVariant' is deprecated. Deprecated in Java
w: /Users/codfrm/Code/caco/taro-test/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt: (114, 48): 'reactRoot: DirectoryProperty' is deprecated. reactRoot was confusing and has been replace with root to point to your root project and reactNativeDir to point to the folder of the react-native NPM package
w: /Users/codfrm/Code/caco/taro-test/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (10, 37): 'ApplicationVariant' is deprecated. Deprecated in Java
w: /Users/codfrm/Code/caco/taro-test/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (11, 37): 'BaseVariant' is deprecated. Deprecated in Java
w: /Users/codfrm/Code/caco/taro-test/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (12, 37): 'LibraryVariant' is deprecated. Deprecated in Java
w: /Users/codfrm/Code/caco/taro-test/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (27, 51): 'BaseVariant' is deprecated. Deprecated in Java
w: /Users/codfrm/Code/caco/taro-test/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (130, 12): 'ApplicationVariant' is deprecated. Deprecated in Java
w: /Users/codfrm/Code/caco/taro-test/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (131, 12): 'LibraryVariant' is deprecated. Deprecated in Java
w: /Users/codfrm/Code/caco/taro-test/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (251, 14): 'BaseVariant' is deprecated. Deprecated in Java
> Configure project :expo-application
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.
> Configure project :expo-av
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.
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
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* Where:
Script '/Users/codfrm/Code/caco/taro-test/node_modules/expo-modules-autolinking/scripts/android/autolinking_implementation.gradle' line: 272
* What went wrong:
A problem occurred evaluating project ':expo'.
> A problem occurred configuring project ':expo-av'.
> Failed to notify project evaluation listener.
> java.lang.NullPointerException: Cannot invoke "String.startsWith(String)" because "versionOutput" is null
> Could not get unknown property 'release' for SoftwareComponentInternal set of type org.gradle.api.internal.component.DefaultSoftwareComponentContainer.
* 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.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':expo'.
> com.android.builder.errors.EvalIssueException: compileSdkVersion is not specified. Please add it to build.gradle
* 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.
==============================================================================
* Get more help at https://help.gradle.org
BUILD FAILED in 8s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* Where:
Script '/Users/codfrm/Code/caco/taro-test/node_modules/expo-modules-autolinking/scripts/android/autolinking_implementation.gradle' line: 272
* What went wrong:
A problem occurred evaluating project ':expo'.
> A problem occurred configuring project ':expo-av'.
> Failed to notify project evaluation listener.
> java.lang.NullPointerException: Cannot invoke "String.startsWith(String)" because "versionOutput" is null
> Could not get unknown property 'release' for SoftwareComponentInternal set of type org.gradle.api.internal.component.DefaultSoftwareComponentContainer.
* 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.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':expo'.
> com.android.builder.errors.EvalIssueException: compileSdkVersion is not specified. Please add it to build.gradle
* 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.
==============================================================================
* Get more help at https://help.gradle.org
BUILD FAILED in 8s
at makeError (/Users/codfrm/Code/caco/taro-test/node_modules/execa/index.js:174:9)
at /Users/codfrm/Code/caco/taro-test/node_modules/execa/index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (/Users/codfrm/Code/caco/taro-test/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:109:5)
at async Command.handleAction (/Users/codfrm/Code/caco/taro-test/node_modules/@react-native-community/cli/build/index.js:142:9)
info Run CLI with --verbose flag for more details.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
https://github.com/zhiqingchen/taro-test/actions/runs/4248901606 https://github.com/zhiqingchen/taro-test/actions/runs/4248902499
重跑的也是正常的,可以尝试使用 Android studio 试一下,以及搜索相关问题,https://github.com/expo/expo/issues/18129
使用Android studio build也是类似的错误:相关问题的解决方案,好像并不适合我
一样的问题,不知道怎么解决
使用npm 作为包管理工具,提示如下问题:
codfrm@wangyizhideMacBook-Pro ~/Code/caco/caco-mobile master npm i
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: caco-mobile@1.0.0
npm ERR! Found: react@18.2.0
npm ERR! node_modules/react
npm ERR! react@"^18.1.0" from the root project
npm ERR! peerOptional react@">=17" from @tarojs/plugin-framework-react@3.6.1
npm ERR! node_modules/@tarojs/plugin-framework-react
npm ERR! @tarojs/plugin-framework-react@"3.6.1" from the root project
npm ERR! 1 more (react-dom)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! react-native@"^0.70.1" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: react@18.1.0
npm ERR! node_modules/react
npm ERR! peer react@"18.1.0" from react-native@0.70.7
npm ERR! node_modules/react-native
npm ERR! react-native@"^0.70.1" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /Users/codfrm/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/codfrm/.npm/_logs/2023-02-24T08_06_50_545Z-debug-0.log
找了台机器复现了这个问题(原因是ndk没有设置好),用 as 可以编译成功,以上配置供参考
android 11?我看官方的文档说是12,所以我就没有安装11,我再试试,谢谢大佬
还是没有成功,Android studio也重新安装了,同样的内容找朋友的电脑试了一下,可以,大概率是我自己环境问题了,但是不知道出在哪里
codfrm@192 ~ taro -v
👽 Taro v3.6.1
3.6.1
codfrm@192 ~ node -v
v16.19.0
codfrm@192 ~ npm -v
8.19.3
codfrm@192 ~ yarn -v
1.22.19
codfrm@192 ~ java --version
openjdk 11.0.18 2023-01-17 LTS
OpenJDK Runtime Environment Zulu11.62+17-CA (build 11.0.18+10-LTS)
OpenJDK 64-Bit Server VM Zulu11.62+17-CA (build 11.0.18+10-LTS, mixed mode)
codfrm@192 ~ echo $ANDROID_HOME
/Users/codfrm/Library/Android/sdk
使用Android studio build也是类似的错误:相关问题的解决方案,好像并不适合我
这个报错信息给的方向排除一下呢?
@yoyo837 什么意思呢?不太懂
有这么一个错误,不知道有没有影响,看配置看不太出来,感觉没问题
老哥,我也是mac m1 ,官方搭建的脚手架可以,taro模板运行不了。研究了一下解决了,把官方脚手架那个build.gradle文件的buildscript配置替换到taro模板对应配置,然后使用 ./gradlew clean清下缓存再执行命令就可以了
@disappointao 感谢老哥,不过我好像还是一样报错,很久都没弄了,官方的脚手架好像也跑不了了,到时候需要开发android的时候我再来看看
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
兄弟我也是拉到taro社区模板也报错 就是编译成安卓应用不通过,是不是社区模板的配置有问题呀。毕竟咱们的环境跑rn自己的社区模板是没问题的但是跑taro的就会编译报错
感觉主要是这个包的问题但是不知道怎么解决啊
相关平台
React Native
使用框架: React
复现步骤
taro init 创建完成项目
taro upgradePeerdeps
taro podInstall
taro android
期望结果
能够运行android环境
实际结果
产生如下错误:
环境信息