React Native 在项目“:app”中找不到任务“installDebug”,生成失败

6mw9ycah  于 2022-12-19  发布在  React
关注(0)|答案(2)|浏览(166)

这是我面临的一个错误x1c 0d1x
包.json

"dependencies": {
    "@react-native-async-storage/async-storage": "^1.16.0",
    "@react-native-community/clipboard": "^1.5.1",
    "@react-native-community/masked-view": "^0.1.11",
    "@react-native-community/netinfo": "^7.1.5",
    "@react-native-firebase/app": "^14.12.0",
    "@react-native-firebase/messaging": "^14.2.2",
    "@react-navigation/drawer": "^6.1.8",
    "@react-navigation/native": "^6.0.6",
    "@react-navigation/stack": "^6.0.11",
    "android": "^0.0.8",
    "axios": "^0.24.0",
    "linkify-html": "^3.0.5",
    "moment": "^2.29.1",
    "react": "17.0.2",
    "react-native": "0.66.4",
    "react-native-barcode-builder": "^2.0.0",
    "react-native-camera": "^4.2.1",
    "react-native-collapsible": "^1.6.0",
    "react-native-config": "^1.4.11",
    "react-native-dots-pagination": "^0.2.0",
    "react-native-flash-message": "^0.2.0",
    "react-native-floating-action": "^1.22.0",
    "react-native-geolocation-service": "^5.3.0-beta.4",
    "react-native-gesture-handler": "^2.0.0",
    "react-native-gradient-buttons": "^2.0.2",
    "react-native-html-to-pdf": "^0.12.0",
    "react-native-hyperlink": "^0.0.19",
    "react-native-image-pan-zoom": "^2.1.12",
    "react-native-linear-gradient": "^2.5.6",
    "react-native-marquee": "^0.3.2",
    "react-native-material-menu": "^2.0.0",
    "react-native-modal": "^13.0.1",
    "react-native-open-maps": "^0.4.0",
    "react-native-pager-view": "^5.4.9",
    "react-native-permissions": "^3.2.0",
    "react-native-phone-number-input": "^2.1.0",
    "react-native-qrcode-scanner": "^1.5.4",
    "react-native-qrcode-svg": "^6.1.2",
    "react-native-reanimated": "^2.2.4",
    "react-native-render-html": "^6.3.1",
    "react-native-safe-area-context": "^3.3.2",
    "react-native-screens": "^3.10.0",
    "react-native-share": "^7.3.5",
    "react-native-splash-screen": "^3.3.0",
    "react-native-sqlite-storage": "^6.0.1",
    "react-native-svg": "^12.1.1",
    "react-native-unimodules": "^0.14.10",
    "react-native-uuid": "^2.0.1",
    "react-native-viewpager": "^0.2.13",
    "react-native-wallet": "^1.0.8",
    "react-native-webview": "^11.15.0",
    "rn-fetch-blob": "^0.12.0"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/runtime": "^7.12.5",
    "@react-native-community/eslint-config": "^2.0.0",
    "babel-jest": "^26.6.3",
    "eslint": "7.14.0",
    "jest": "^26.6.3",
    "metro-react-native-babel-preset": "^0.66.2",
    "react-test-renderer": "17.0.2"
  },
  "jest": {
    "preset": "react-native"
  }
}

安卓系统/内部版本.gradle

buildscript {
    ext {
        buildToolsVersion = "30.0.2"
        minSdkVersion = 21
        compileSdkVersion = 29
        targetSdkVersion = 31
        ndkVersion = "21.4.7075529"
       
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:4.2.2")
        classpath 'com.google.gms:google-services:4.3.10'
       

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
     configurations.all {
          resolutionStrategy {
            force "com.facebook.react:react-native:" + "0.66.5"
          }
    }

    repositories {

        mavenCentral()
        mavenLocal()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }

        google()
        maven { url 'https://www.jitpack.io' }
         maven { url "https://maven.google.com" } 
    

    }
}

安卓/应用程序/构建版本.gradle

dependencies {
    implementation project(':react-native-html-to-pdf')
    implementation project(':react-native-share')

    implementation project(':react-native-sqlite-storage')
    implementation 'com.android.support:multidex:2.0.1'  

    implementation project(':react-native-art')
    implementation fileTree(dir: "libs", include: ["*.jar"])

    implementation "com.facebook.react:react-native:+"
    implementation project(':react-native-pager-view')

    implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"

    debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
        exclude group:'com.facebook.fbjni'
    }

    debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
        exclude group:'com.facebook.flipper'
        exclude group:'com.squareup.okhttp3', module:'okhttp'
    }

    debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
        exclude group:'com.facebook.flipper'
    }

    if (enableHermes) {
        def hermesPath = "../../node_modules/hermes-engine/android/";
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }
}

task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.implementation
    into 'libs'
}

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

我所尝试的...
1.我认为解决我几乎试图解决的错误所必需的命令...
1.而且我已经非常正确地设置了环境设置,就像react原生设置文档所说的那样...
1.我更新了gradle版本,Kotlin版本,react原生版本,npm版本,节点版本等...
1.我还更新了Firebase应用程序,Firebase消息和Firebase..其中Firebase应用程序和消息版本应该相同...
1.我还设置了SDK工具,Android SDK在Android工作室...
1.我已经卸载了节点,vs代码,并再次重新安装它,但再次面临同样的问题,即构建失败...。

yhived7q

yhived7q1#

解决此错误的方法:
1.在android studio中打开项目的android文件夹,然后同步gradle,然后从android studio运行
1.运行
./gradlew任务
然后运行
npxReact-原生运行-安卓
3).在代码下运行
./gradlew安装开发调试
然后运行项目

s1ag04yj

s1ag04yj2#

您可以尝试多种选择。
1.您的应用程序可能没有足够的空间安装在模拟器上。请在验证配置下的中创建新的模拟器,单击显示高级设置并修改内存和存储块,如下所示,现在尝试在新创建的模拟器中运行您的应用程序。

1.打开您的项目到android studio,并尝试运行应用程序从android studio和不使用命令行
让我知道这对你有帮助还是没有。

相关问题