Nativescript Angular 项目构建失败

Nativescript Angular project Build failed

我只是创建了一个简单的 Nativescript-angular 项目:

ns create example-app --ng

当我 运行 时:

ns run android

我收到这个错误:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'core'.
> Could not resolve all files for configuration ':classpath'.
   > Could not resolve com.android.tools.build:gradle:7.1.2.
     Required by:
         project :
      > Could not resolve com.android.tools.build:gradle:7.1.2.
         > Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/7.1.2/gradle-7.1.2.pom'.
            > Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/7.1.2/gradle-7.1.2.pom'. Received status code 403 from server: Forbidden
   > Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.0.
     Required by:
         project :
      > Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.0.
         > Could not get resource 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/1.6.0/kotlin-gradle-plugin-1.6.0.pom'.
            > Could not GET 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/1.6.0/kotlin-gradle-plugin-1.6.0.pom'. Received status code 403 from server: Forbidden

* 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 2s
Failed to build plugin @nativescript/core :
Error: Command gradlew.bat failed with exit code 1

我该如何解决这个问题?

问候'

终于找到原因了。 google 和 gradle 将一些国家列入禁止名单,所以他们的一些文件和包在没有 VPN 的情况下无法下载。 我通过购买一个 VPN 帐户解决了这个问题。