React Native 在根项目中未找到任务“TickleReleaseJsAndAssets”

oewdyzsn  于 2023-11-21  发布在  React
关注(0)|答案(3)|浏览(249)

我无法在Jenkins中成功构建React Native项目。我得到这个错误:
14:41:59失败:生成失败,出现异常。14:41:59 14:41:59 * 出错原因:14:41:59任务“:app:AppleDevReleaseJsAndAssets”执行失败。14:41:59 >进程“命令”节点“完成,退出值为非零1 14:41:59
我在这里找到了答案:
任务“:app:React-Native ReleaseJsAndAssets”的React-Native ReleaseRelease失败
问题是什么时候建设,第二步:
第一个月
我得到这个错误:

FAILURE: Build failed with an exception.

* What went wrong:
Task 'bundleReleaseJsAndAssets' not found in root project 'engage-application.mobile'.

* Try:
Run gradlew tasks to get a list of available tasks. 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

字符串
运行gradlew tasks并没有给我提供任何见解:

✗ gradle tasks

> Task :tasks

------------------------------------------------------------
Tasks runnable from root project
------------------------------------------------------------

Build Setup tasks
-----------------
init - Initializes a new Gradle build.
wrapper - Generates Gradle wrapper files.

Help tasks
----------
buildEnvironment - Displays all buildscript dependencies declared in root project 'engage-application.mobile'.
components - Displays the components produced by root project 'engage-application.mobile'. [incubating]
dependencies - Displays all dependencies declared in root project 'engage-application.mobile'.
dependencyInsight - Displays the insight into a specific dependency in root project 'engage-application.mobile'.
dependentComponents - Displays the dependent components of components in root project 'engage-application.mobile'. [incubating]
help - Displays a help message.
model - Displays the configuration model of root project 'engage-application.mobile'. [incubating]
projects - Displays the sub-projects of root project 'engage-application.mobile'.
properties - Displays the properties of root project 'engage-application.mobile'.
tasks - Displays the tasks runnable from root project 'engage-application.mobile'.

To see all tasks and more detail, run gradle tasks --all

To see more detail about a task, run gradle help --task <task>

BUILD SUCCESSFUL in 0s
1 actionable task: 1 executed


另外,请注意,我必须运行gradle tasks
关于SO的几篇相关文章要么是3到5年前的,要么是关于

buildscript {
    ext {
        buildToolsVersion = "27.0.3"
        minSdkVersion = 16
        compileSdkVersion = 27
        targetSdkVersion = 26
        supportLibVersion = "27.1.1"
    }


build.gradle中不适合我的RN版本的内容:

System:
  OS: macOS High Sierra 10.13.6
  CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
  Memory: 609.73 MB / 16.00 GB
  Shell: 5.3 - /bin/zsh
Binaries:
  Node: 11.10.1 - /usr/local/bin/node
  Yarn: 1.10.1 - /usr/local/bin/yarn
  npm: 6.7.0 - /usr/local/bin/npm
  Watchman: 4.7.0 - /usr/local/bin/watchman
SDKs:
  iOS SDK:
    Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
  Android SDK:
    API Levels: 23, 25, 26, 27, 28
    Build Tools: 23.0.1, 26.0.2, 27.0.3, 28.0.3
    System Images: android-28 | Google Play Intel x86 Atom
IDEs:
  Android Studio: 3.4 AI-183.5429.30.34.5452501
  Xcode: 10.1/10B61 - /usr/bin/xcodebuild
npmPackages:
  react: 16.6.3 => 16.6.3
  react-native: 0.57.8 => 0.57.8
npmGlobalPackages:
  react-native-cli: 2.0.1
  react-native-git-upgrade: 0.2.7


我最近升级到0.57.8版本,并遵循此指南:https://reactnative.thenativebits.com/courses/upgrading-react-native/upgrade-to-react-native-0.57/
有人向我解释说我需要跑步:
✗ ./gradlew assembleRelease -x bundleDevReleaseJsAndAssets
我做了,我继续得到错误。

FAILURE: Build failed with an exception.

* What went wrong:
Task 'bundleDevReleaseJsAndAssets' not found in root project 'engage-application.mobile'.

* Try:
Run gradlew tasks to get a list of available tasks. 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


如果我然后尝试按照Kartik Shah的步骤:React-Native ReleRelease fails for task ':app:ReleRelease JsAndAssets'
我得到这个错误:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-sentry:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* 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 7s
208 actionable tasks: 195 executed, 13 up-to-date


我三天前遇到了这个问题,我以为升级后会解决:
https://github.com/getsentry/react-native-sentry/issues/610
所以我升级了React Native Sentry,现在得到的错误如下:

The TaskInternal.executer property has been deprecated and is scheduled to be removed in Gradle 5.0. There are better ways to re-use task logic, see https://docs.gradle.org/4.4/userguide/custom_tasks.html#sec:reusing_task_logic.
        at sentry_c79fxbhuascug468f001tukcq$_run_closure1$_closure6.doCall(/Users/danale/Projects/engage-application.mobile/node_modules/react-native-sentry/sentry.gradle:19)
        (Run with --stacktrace to get the full stack trace of this deprecation warning.)
error: resource android:style/TextAppearance.Material.Widget.Button.Borderless.Colored not found.
error: resource android:style/TextAppearance.Material.Widget.Button.Colored not found.
/Users/danale/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar/478ea8d2caa80bc12b39e3960167e1f6/res/values/values.xml:251:5-69: AAPT: error: resource android:attr/fontStyle not found.

/Users/danale/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar/478ea8d2caa80bc12b39e3960167e1f6/res/values/values.xml:251:5-69: AAPT: error: resource android:attr/font not found.

/Users/danale/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar/478ea8d2caa80bc12b39e3960167e1f6/res/values/values.xml:251:5-69: AAPT: error: resource android:attr/fontWeight not found.

error: failed linking references.


看起来令人反感的代码就在这里:

def bundleTasks = tasks.findAll { task -> task.name.startsWith("bundle") && task.name.endsWith("JsAndAssets") && !task.name.contains("Debug")}
    bundleTasks.each { bundleTask ->
        def shouldCleanUp
        def sourcemapOutput
        def bundleOutput
        def props = bundleTask.getProperties()
        def reactRoot = props.get("workingDir")


有没有人对React Native Sentry有任何变通方法或经验?

uxh89sit

uxh89sit1#

我看到的唯一区别是,你最初的错误是针对任务bundleDevReleaseJsAndAssets,而不是在你链接的另一篇文章中失败的bundleReleaseJsAndAssets任务。所以可以尝试运行以下命令:

./gradlew assembleRelease -x bundleDevReleaseJsAndAssets

字符串
基本上,你告诉它排除一个可能不是你项目一部分的任务,你必须指定正确的任务。

klr1opcd

klr1opcd2#

下面的工作解决了我的问题。

android/app/build.gradle

请确认是否添加了以下内容。

apply from: "../../node_modules/react-native/react.gradle"  
 
apply from:"../../node_modules/react-native-code-push/android/codepush.gradle"

字符串
确保您的启用:

android{ defaultConfig{
 
    multiDexEnabled true } }
 
implementation 'androidx.multidex:multidex:2.0.1'


从android文件夹中删除**.gradle**文件夹
运行:

react-native run-android

62lalag4

62lalag43#

因为问题是我的一个导入被错误地改变了。导入的是这样的。

import interstialsAdCustomHook from '../Hooks/InterstialsAdCustomHook';

字符串
文件定义如下

interstialsAdCustomHook.js


区别是大写字母和小写字母。

相关问题