无法解析配置':classpath'

时间:2019-07-20 08:24:28

标签: angular maven build.gradle nativescript classpath

tns信息:

√ Getting NativeScript components versions information...
√ Component nativescript has 6.0.0 version and is up to date.
√ Component tns-core-modules has 6.0.1 version and is up to date.
√ Component tns-android has 6.0.0 version and is up to date.
‼ Update available for component tns-ios. Your current version is 6.0.0 and the latest available version is 6.0.1.

我试图将2017年编写的本机脚本项目更新为本机脚本的最新版本,也将本机脚本更新为版本6。但是当我尝试使用tns run android --device Pixel-2_API_29命令在模拟器上运行项目时,我收到此错误消息:

Searching for devices...
Starting Android emulator with image Pixel_2_API_29
Waiting for emulator device initialization...
Your application will be deployed only on the device specified by the provided index or identifier.
Preparing project...
File change detected. Starting incremental webpack compilation...

webpack is watching the files…

Hash: f2ba56167c5538fba945
Version: webpack 4.27.1
Time: 12115ms
Built at: 07/19/2019 5:02:07 PM
              Asset       Size   Chunks             Chunk Names
app/images/logo.png     21 KiB           [emitted]
          bundle.js    320 KiB   bundle  [emitted]  bundle
       package.json  112 bytes           [emitted]
         runtime.js   71.4 KiB  runtime  [emitted]  runtime
tns-java-classes.js    0 bytes           [emitted]
          vendor.js   14.8 MiB   vendor  [emitted]  vendor
Entrypoint bundle = runtime.js vendor.js bundle.js
[./app.css] 1.7 KiB {bundle} [built]
[./app/about/about.component.ts] 1.48 KiB {bundle} [built]
[./app/app.component.ts] 354 bytes {bundle} [built]
[./app/app.module.ts] 4.03 KiB {bundle} [built]
[./app/app.routing.ts] 1.47 KiB {bundle} [built]
[./app/comment/comment.component.ts] 1.92 KiB {bundle} [built]
[./app/contact/contact.component.ts] 1.97 KiB {bundle} [built]
[./app/dishdetail/dishdetail.component.ts] 8.2 KiB {bundle} [built]
[./app/favorites/favorites.component.ts] 4.54 KiB {bundle} [built]
[./app/home/home.component.ts] 8.82 KiB {bundle} [built]
[./app/menu/menu.component.ts] 1.45 KiB {bundle} [built]
[./app/reservation/reservation.component.ts] 5.15 KiB {bundle} [built]
[./app/reservationmodal/reservationmodal.component.ts] 2.44 KiB {bundle} [built]
[./app/services/couchbase.service.ts] 1.03 KiB {bundle} [built]
[./main.ts] 2.36 KiB {bundle} [built]
    + 490 hidden modules
Webpack compilation complete. Watching for file changes.
Webpack build done!

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'nativescript_phone'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not find gradle.jar (com.android.tools.build:gradle:3.4.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.4.1/gradle-3.4.1.jar
   > Could not find builder.jar (com.android.tools.build:builder:3.4.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/build/builder/3.4.1/builder-3.4.1.jar
   > Could not find tracker.jar (com.android.tools.analytics-library:tracker:26.4.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/tracker/26.4.1/tracker-26.4.1.jar
   > Could not find shared.jar (com.android.tools.analytics-library:shared:26.4.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/shared/26.4.1/shared-26.4.1.jar
   > Could not find crash.jar (com.android.tools.analytics-library:crash:26.4.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/crash/26.4.1/crash-26.4.1.jar
   > Could not find lint-gradle-api.jar (com.android.tools.lint:lint-gradle-api:26.4.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/lint/lint-gradle-api/26.4.1/lint-gradle-api-26.4.1.jar
   > Could not find gradle-api.jar (com.android.tools.build:gradle-api:3.4.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle-api/3.4.1/gradle-api-3.4.1.jar
   > Could not find databinding-compiler-common.jar (androidx.databinding:databinding-compiler-common:3.4.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/androidx/databinding/databinding-compiler-common/3.4.1/databinding-compiler-common-3.4.1.jar
   > Could not find manifest-merger.jar (com.android.tools.build:manifest-merger:26.4.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/build/manifest-merger/26.4.1/manifest-merger-26.4.1.jar
   > Could not find sdk-common.jar (com.android.tools:sdk-common:26.4.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/sdk-common/26.4.1/sdk-common-26.4.1.jar
   > Could not find builder-test-api.jar (com.android.tools.build:builder-test-api:3.4.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/build/builder-test-api/3.4.1/builder-test-api-3.4.1.jar
   > Could not find ddmlib.jar (com.android.tools.ddms:ddmlib:26.4.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/ddms/ddmlib/26.4.1/ddmlib-26.4.1.jar
   > Could not find sdklib.jar (com.android.tools:sdklib:26.4.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/sdklib/26.4.1/sdklib-26.4.1.jar
   > Could not find layoutlib-api.jar (com.android.tools.layoutlib:layoutlib-api:26.4.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/layoutlib/layoutlib-api/26.4.1/layoutlib-api-26.4.1.jar
   > Could not find dvlib.jar (com.android.tools:dvlib:26.4.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/dvlib/26.4.1/dvlib-26.4.1.jar
   > Could not find repository.jar (com.android.tools:repository:26.4.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/repository/26.4.1/repository-26.4.1.jar
   > Could not find common.jar (com.android.tools:common:26.4.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/common/26.4.1/common-26.4.1.jar
   > Could not find protos.jar (com.android.tools.analytics-library:protos:26.4.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/protos/26.4.1/protos-26.4.1.jar
   > Could not find builder-model.jar (com.android.tools.build:builder-model:3.4.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/build/builder-model/3.4.1/builder-model-3.4.1.jar
   > Could not find apkzlib.jar (com.android.tools.build:apkzlib:3.4.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/build/apkzlib/3.4.1/apkzlib-3.4.1.jar
   > Could not find apksig.jar (com.android.tools.build:apksig:3.4.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/build/apksig/3.4.1/apksig-3.4.1.jar
   > Could not find annotations.jar (com.android.tools:annotations:26.4.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/annotations/26.4.1/annotations-26.4.1.jar
   > Could not find databinding-common.jar (androidx.databinding:databinding-common:3.4.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/androidx/databinding/databinding-common/3.4.1/databinding-common-3.4.1.jar
   > Could not find baseLibrary.jar (com.android.databinding:baseLibrary:3.4.1).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/databinding/baseLibrary/3.4.1/baseLibrary-3.4.1.jar

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

问题出在哪里,我该如何解决?我在网上搜索,但找不到适合我的解决方案

您还可以在这里找到我的项目文件:https://github.com/bestazad/confusion

这是build.gradle文件的内容:


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

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.1'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

gradle-wrapper.jar的内容:

#Tue Apr 30 12:10:15 EEST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip

1 个答案:

答案 0 :(得分:0)

尝试在google()文件的存储库部分中首先添加nativescript-phone/android/build.gradle