Gradle 不寻找自定义 Maven 存储库

问题描述 投票:0回答:1

我有一个名为react-native-expofp的反应本机库,我正在尝试在那里添加CrowdConnected模块,根据这个docs我需要将

implementation 'com.expofp:crowdconnected:4.2.12'
添加到依赖项 和
maven { url "https://maven2.crowdconnected.net/" }
到存储库。 我这样做了,但是当我尝试构建它时,它说:

* What went wrong:
Could not determine the dependencies of task ':app:processDebugResources'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
   > Could not find net.crowdconnected.android.core:android-core:1.3.6.
     Searched in the following locations:
       - https://oss.sonatype.org/content/repositories/snapshots/net/crowdconnected/android/core/android-core/1.3.6/android-core-1.3.6.pom
       - https://repo.maven.apache.org/maven2/net/crowdconnected/android/core/android-core/1.3.6/android-core-1.3.6.pom
       - file:/Users/arystankaliakparov/code/amego/mobile/node_modules/jsc-android/dist/net/crowdconnected/android/core/android-core/1.3.6/android-core-1.3.6.pom
       - https://dl.google.com/dl/android/maven2/net/crowdconnected/android/core/android-core/1.3.6/android-core-1.3.6.pom
       - https://www.jitpack.io/net/crowdconnected/android/core/android-core/1.3.6/android-core-1.3.6.pom
     Required by:
         project :app > project :react-native-expofp > com.expofp:crowdconnected:4.2.12
   > Could not find net.crowdconnected.android.ips:android-ips:1.3.6.
     Searched in the following locations:
       - https://oss.sonatype.org/content/repositories/snapshots/net/crowdconnected/android/ips/android-ips/1.3.6/android-ips-1.3.6.pom
       - https://repo.maven.apache.org/maven2/net/crowdconnected/android/ips/android-ips/1.3.6/android-ips-1.3.6.pom
       - file:/Users/arystankaliakparov/code/amego/mobile/node_modules/jsc-android/dist/net/crowdconnected/android/ips/android-ips/1.3.6/android-ips-1.3.6.pom
       - https://dl.google.com/dl/android/maven2/net/crowdconnected/android/ips/android-ips/1.3.6/android-ips-1.3.6.pom
       - https://www.jitpack.io/net/crowdconnected/android/ips/android-ips/1.3.6/android-ips-1.3.6.pom
     Required by:
         project :app > project :react-native-expofp > com.expofp:crowdconnected:4.2.12
   > Could not find net.crowdconnected.android.geo:android-geo:1.3.6.
     Searched in the following locations:
       - https://oss.sonatype.org/content/repositories/snapshots/net/crowdconnected/android/geo/android-geo/1.3.6/android-geo-1.3.6.pom
       - https://repo.maven.apache.org/maven2/net/crowdconnected/android/geo/android-geo/1.3.6/android-geo-1.3.6.pom
       - file:/Users/arystankaliakparov/code/amego/mobile/node_modules/jsc-android/dist/net/crowdconnected/android/geo/android-geo/1.3.6/android-geo-1.3.6.pom
       - https://dl.google.com/dl/android/maven2/net/crowdconnected/android/geo/android-geo/1.3.6/android-geo-1.3.6.pom
       - https://www.jitpack.io/net/crowdconnected/android/geo/android-geo/1.3.6/android-geo-1.3.6.pom
     Required by:
         project :app > project :react-native-expofp > com.expofp:crowdconnected:4.2.12

所以根据日志,它甚至没有看https://maven2.crowdconnected.net/,这很奇怪。

感谢您的帮助!

构建.gradle:

buildscript {
  // Buildscript is evaluated before everything else so we can't use getExtOrDefault
  def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["Expofp_kotlinVersion"]

  repositories {
    google()
    mavenCentral()
  }

  dependencies {
    classpath "com.android.tools.build:gradle:7.2.1"
    // noinspection DifferentKotlinGradleVersion
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
  }
}

def isNewArchitectureEnabled() {
  return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
}

apply plugin: "com.android.library"
apply plugin: "kotlin-android"

if (isNewArchitectureEnabled()) {
  apply plugin: "com.facebook.react"
}

def getExtOrDefault(name) {
  return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["Expofp_" + name]
}

def getExtOrIntegerDefault(name) {
  return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["Expofp_" + name]).toInteger()
}

def supportsNamespace() {
  def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
  def major = parsed[0].toInteger()
  def minor = parsed[1].toInteger()

  // Namespace support was added in 7.3.0
  return (major == 7 && minor >= 3) || major >= 8
}

android {
  if (supportsNamespace()) {
    namespace "com.expofp"

    sourceSets {
      main {
        manifest.srcFile "src/main/AndroidManifestNew.xml"
      }
    }
  }

  compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")

  defaultConfig {
    minSdkVersion getExtOrIntegerDefault("minSdkVersion")
    targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")

  }

  buildTypes {
    release {
      minifyEnabled false
    }
  }

  lintOptions {
    disable "GradleCompatible"
  }

  compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
  }
}

repositories {
  maven { url "https://maven2.crowdconnected.net" }
  google()
  mavenCentral()
}

allprojects {
  repositories {
    maven { url "https://maven2.crowdconnected.net" }
  }
}

def kotlin_version = getExtOrDefault("kotlinVersion")

dependencies {
  // For < 0.71, this will be from the local maven repo
  // For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
  //noinspection GradleDynamicVersion
  implementation "com.facebook.react:react-native:+"
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"

  implementation 'com.expofp:common:4.2.12'
  implementation 'com.expofp:fplan:4.2.12'

  implementation 'com.expofp:crowdconnected:4.2.12'
}
react-native maven gradle
1个回答
0
投票

根据您提供的文档,您需要添加另一个依赖项,例如

dependencies {
  // all other dependencies
  implementation 'net.crowdconnected.android.core:android-core:1.3.4'
  implementation 'net.crowdconnected.android.ips:android-ips:1.3.4'
  implementation 'net.crowdconnected.android.geo:android-geo:1.3.4'
}

前往

dependencies
部分

© www.soinside.com 2019 - 2024. All rights reserved.