App Linking (AGC) Hauwei 无法解析

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

我在 Typescript 上有 React Native 项目,并尝试添加应用程序链接功能。

我遵循了这里的官方指示:

  1. 登录AppGallery Connect,下载

    agconnect-services.json
    文件并添加到
    root\android\app
    文件夹中。

  2. 配置HMS Core SDK的Maven仓库地址:

  • 检查了我的gradle版本(

    npm gradle -v
    ),是10.8.3;

  • build.gradle
    目录中的
    root\android\
    文件中进入 buildscript > 依赖项,我添加了:

classpath("com.android.tools.build:gradle:10.8.3")
        classpath ("com.huawei.agconnect:agcp:1.9.1.300")
  • 在文件夹中
    root\android\
    在文件中
    settings.gradle
    我像这样改变了:
pluginManagement { repositories {
        gradlePluginPortal()
        google()
        mavenCentral()
        // Configure the Maven repository address for the HMS Core SDK.
        maven { url 'https://developer.huawei.com/repo/' }
    }
    includeBuild("../node_modules/@react-native/gradle-plugin") }
plugins { id("com.facebook.react.settings") }
extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }
rootProject.name = 'Awesome'
include ':app'
includeBuild('../node_modules/@react-native/gradle-plugin')

dependencyResolutionManagement {
    repositories {
        google()
        mavenCentral()
        // Configure the Maven repository address for the HMS Core SDK.
        maven { url 'https://developer.huawei.com/repo/' }
    }
}
  1. 添加了构建依赖项:在文件
    root\android\app
    文件夹中
    build.gradle
    我添加了:
apply plugin: 'com.huawei.agconnect'
  1. npm start
    ,选择Andriod并得到这个错误:
> Could not resolve all dependencies for configuration ':classpath'.
   > Could not find com.android.tools.build:gradle:10.8.3.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/10.8.3/gradle-10.8.3.pom
       - https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/10.8.3/gradle-10.8.3.pom
     Required by:
         project :
   > Could not find com.huawei.agconnect:agcp:1.9.1.300.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/huawei/agconnect/agcp/1.9.1.300/agcp-1.9.1.300.pom
       - https://repo.maven.apache.org/maven2/com/huawei/agconnect/agcp/1.9.1.300/agcp-1.9.1.300.pom
     Required by:
         project :
   > Could not find com.android.tools.build:gradle:10.8.3.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/10.8.3/gradle-10.8.3.pom
       - https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/10.8.3/gradle-10.8.3.pom
     Required by:
         project : > project :gradle-plugin:react-native-gradle-plugin

可能出现什么问题以及我需要更改什么?

react-native gradle huawei-mobile-services appgallery-connect
1个回答
0
投票

classpath
应该使用现有版本...

classpath("com.android.tools.build:gradle:8.7.1")
classpath ("com.huawei.agconnect:agcp:1.9.1.303")
© www.soinside.com 2019 - 2024. All rights reserved.