簡體   English   中英

離子構建android在Ubuntu上拋出``無法解析com.android.tools.build:gradle:2.1.0''

[英]Ionic build android throws `Could not resolve com.android.tools.build:gradle:2.1.0` on Ubuntu

這是在ionic build android之后的我的stacktrace,經過三個簡單的步驟即可開始使用ionic

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':classpath'.
   > Could not resolve com.android.tools.build:gradle:2.1.0.
     Required by:
         :android:unspecified
      > Could not resolve com.android.tools.build:gradle:2.1.0.
         > Could not get resource 'https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.1.0/gradle-2.1.0.pom'.
            > Could not GET 'https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.1.0/gradle-2.1.0.pom'.
               > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
      > Could not resolve com.android.tools.build:gradle:2.1.0.
         > Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/2.1.0/gradle-2.1.0.pom'.
            > Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/2.1.0/gradle-2.1.0.pom'.
               > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

所有代碼都是$ ionic start myApp tabs附帶的默認代碼。

我試圖更改gradle版本,更新cordova。 我也嘗試在build.gradle中添加以下行:

repositories {
        maven { url 'http://repo1.maven.org/maven2' }
    }

我也這樣做,以防萬一: 運行“ Cordova build android”時,出現以下異常

我有同樣的問題,我解決了手動安裝gradle的問題。

https://gradle.org/gradle-download/

我做了以下命令:

curl -s https://get.sdkman.io | bash

sdk install gradle 2.1 # Changing 3.1 version to 2.1

我必須重新啟動計算機才能正確配置路徑。 以前我檢查過它和java及其路徑的配置是否正確,但是我認為解決它並不重要。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM