首页 > 解决方案 > 安装应用程序失败。-PreactNativeDevServerPort=8081

问题描述

我在 android studio 中使用 react-native

当我下载名为 @react-native-seoul/kakao-login 的库后运行 Android 模拟器时会发生此错误。

    * Where:
    Build file 'C:\Users\nan84\cooking2-master\front\node_modules\react-native-reanimated\android\build.gradle' line: 90

    * What went wrong:
    A problem occurred configuring project ':react-native-reanimated'.
    > You must specify a URL for a Maven repository.

    * 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 21s

    error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

这是我的安卓文件

(bundle.gradle)

    // Top-level build file where you can add configuration options common to all sub-projects/modules.

    buildscript {
      ext {
          buildToolsVersion = "29.0.2"
          minSdkVersion = 16
          compileSdkVersion = 29
          targetSdkVersion = 29
      }
      repositories {
          google()
          jcenter()
      }
      dependencies {
      
          classpath ('com.android.tools.build:gradle:4.1.3')

          classpath 'com.google.gms:google-services:4.3.5'



      }
    }

    allprojects {
      repositories {
          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()
          jcenter()
          maven { url 'https://www.jitpack.io' }
        
        //카카오
        maven { url >'http://devrepo.kakao.com:8088/nexus/content/groups/public/' }
      }
    }

(gradle-wrapper.properties)

    distributionBase=GRADLE_USER_HOME
    distributionPath=wrapper/dists
    distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
    zipStoreBase=GRADLE_USER_HOME
    zipStorePath=wrapper/dists

(local.properties)

          sdk.dir=C\:\\Users\\nan84\\AppData\\Local\\Android\\Sdk

我试图改变(gradle-wrapper.properties)中的distributionUrl

gradle-6.5-all.zip -> gradle-6.3-all.zip 但它不起作用

我该如何解决这个错误?

标签: androidreact-nativeandroid-studio

解决方案


推荐阅读