Ionic打包报错"Could not resolve com.android.support:support-v4:26.+."的一种情况解决
kelvin 发布于 2021-08-11

Ionic项目打包过程容易出现一些错误,有时候是网络的原因,最近打包又报错了,如下

* What went wrong:
Could not determine the dependencies of task ':app:lintVitalRelease'.
> Could not resolve all artifacts for configuration ':app:debugCompileClasspath'.
   > Could not resolve com.android.support:support-v4:26.+.
     Required by:
         project :app
      > Failed to list versions for com.android.support:support-v4.
         > Unable to load Maven meta-data from https://maven.google.com/com/android/support/support-v4/maven-metadata.xml.
            > Could not get resource 'https://maven.google.com/com/android/support/support-v4/maven-metadata.xml'.
               > Could not GET 'https://maven.google.com/com/android/support/support-v4/maven-metadata.xml'.
                  > Connect to maven.google.com:443 [maven.google.com/216.58.200.238] failed: Connection timed out: connect

* 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 8m 3s
Command failed with exit code 1: F:\project\platforms\android\gradlew cdvBuildRelease -b F:\project\platforms\android\build.gradle
[ERROR] An error occurred while running subprocess cordova.

        cordova.cmd build android --release exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.

以为也是网络问题,不过之前的工程打包没问题,想到可能是安装了一些插件导致,检查一遍发现project.properties文件中的内容比之前的工程多了com.android.support:support-v4:27.+,如下,

cordova.system.library.2=com.android.support:support-v4:27.+

cordova.system.library.4=com.android.support:support-v4:26.+

后来把cordova.system.library.2=com.android.support:support-v4:27.+注释掉,再打包就可以了。

kelvin
关注 私信
文章
98
关注
0
粉丝
0