Android Gradle构建错误-配置':classpath'的工件

时间:2019-03-21 10:20:54

标签: android gradle android-gradle nativescript

运行命令tns run androidtns debug android时出现以下错误。在此之前,我无法从.gradle/gradle.properties删除C:\Users\yash\.gradle\gradle.properties文件夹,但现在无法撤消它。

我得到的50个错误中有1个是

Could not resolve all artifacts for configuration ':classpath'.
Could not resolve org.ow2.asm:asm:6.0.
     Required by:
         project : > com.android.tools.build:gradle:3.3.1
         project : > com.android.tools.build:gradle:3.3.1 > com.android.tools.build:builder:3.3.1
         project : > com.android.tools.build:gradle:3.3.1 > com.android.tools.build.jetifier:jetifier-processor:1.0.0-beta02

NS版本

 "nativescript": {
    "id": "org.nativescript.chennaivolunteers",
    "tns-ios": {
      "version": "5.0.0"
    },
    "tns-android": {
      "version": "5.2.1"
    }
}

app.gradle

...

buildscript {
    repositories {
        google()
        jcenter()
        maven {
            url 'https://dl.google.com/dl/android/maven2'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0'
    }
}

android {
  defaultConfig {  
    generatedDensities = []
    applicationId = "org.nativescript.chennaivolunteers"  
  }  
  signingConfigs {
    config {
      // You need to specify either an absolute path or include the
      // keystore file in the same directory as the build.gradle file.
      storeFile file("<store-filename>.jks")
      storePassword "<store-password>"
      keyAlias "<store-alias>"
      keyPassword "<store-password>"
    }
  }
  aaptOptions {  
    additionalParameters "--no-version-vectors"  
  }  
} 
project.ext {
    googlePlayServicesVersion = "+"
}
dependencies {
  compile 'com.facebook.android:facebook-android-sdk:4.6.0'
}
...

2 个答案:

答案 0 :(得分:3)

我通过更改app.gradle中的很多内容来解决此问题 我添加了mavenCentral(),并将版本号从3.3.1 3.3.0更改为classpath 'com.android.tools.build:gradle:3.3.1'

buildscript {
    repositories {
        mavenCentral()
        google()
        jcenter()
        maven {
            url 'https://dl.google.com/dl/android/maven2'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.1'
    }
}

答案 1 :(得分:0)

bintray是其网络https://status.bintray.com/上的下载问题 enter image description here