Ionic 3 Android Build错误(找不到support-v4.jar) [英] Ionic 3 Android Build Error (could not find support-v4.jar)

查看:114
本文介绍了Ionic 3 Android Build错误(找不到support-v4.jar)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Ionic 3应用程序,已经在开发机器上构建了相当长的一段时间.今天,我们尝试了一台新机器,但它并没有在那里建造.它使用的是较旧的cordova-android版本(6.1.2),但我认为它仍会构建.我看到的错误如下:

I have an Ionic 3 app that has built fine on dev machines for quite a while. Today we tried a new machine and it doesn't build there. It is using an older cordova-android version (6.1.2), but I would think it would still build. The error I'm seeing is below:

> ionic cordova build android
...
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not find support-v4.jar (com.android.support:support-v4:26.1.0).
  Searched in the following locations:
      https://jcenter.bintray.com/com/android/support/support-v4/26.1.0/support-v4-26.1.0.jar

另一段背景信息.该项目存在多个插件的android支持版本要求相互冲突的问题,这要求我们使用build-extras.gradle文件将所有内容强制为com.android.support:support-v4:26+.那是几个月前的事,所以它不应该被关联,但是我认为我应该添加它,以防万一.

One other piece of background info. This project had an issue with conflicting android support version requirements from multiple plugins, which required us to use a build-extras.gradle file to force everything to com.android.support:support-v4:26+. That was many months ago so it shouldn't be related, but I thought I should add it in case it helps.

推荐答案

我确定我可以调整Cordova生成的build.gradle文件来解决此问题.但是,这会在每台Dev机器上被Cordova所踩.我找到了另一种解决方法.

I'm sure I could adjust the build.gradle file that Cordova generates to fix this. However, that would get stepped on by Cordova on every Dev machine. I found a different work-around.

我以前不得不弄乱com.android.support库,因为不同的插件需要不同的版本,并且它们彼此之间不能很好地配合使用.我的方法是添加一个build-extras.gradle文件(通过钩子,请参见此处(选项2),该文件最终会导致到此处),内容如下.那行得通(直到最近).

I previously had to mess with the com.android.support library because different plugins required different versions, and they didn't play well with each other. My approach was to add a build-extras.gradle file (via a hook, see here (option 2) which eventually leads to here) with the contents below. That worked (until fairly recently).

configurations.all {
    resolutionStrategy {
       force 'com.android.support:support-v4:26+'
    }
}

据我所知,该库的26.1.0版本有所不同.似乎在同一存储库中不可用或其他什么?无论如何,都可以切换到早期版本(如下).请注意,真正的变化是从26+26.0+(应拉入26.0.2).再次构建良好.

From what I can tell, something is different about the 26.1.0 version of this library. It seems like it's not available in the same repository or something? Regardless, swapping to an earlier version (below) works. Notice the real change is from 26+ to 26.0+ (which should pull in 26.0.2). This builds fine again.

configurations.all {
    resolutionStrategy {
        force 'com.android.support:support-v4:26.0+'
    }
}

这篇关于Ionic 3 Android Build错误(找不到support-v4.jar)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆