【Ionic2】Ionic2 Android 打包 Crosswalk报错问题的解决方案

本文介绍了解决在使用Ionic构建Android应用过程中遇到的Crosswalk依赖问题的方法。通过修改特定Gradle配置文件并指定Crosswalk库的确切版本,可以避免因远程服务器不可达导致的构建失败。

问题描述:

使用

ionic build android

打包编译时,遇到报错说crosswalk的有个文件访问不到了,具体如下

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_armv7DebugApkCopy'.
   > Could not resolve org.xwalk:xwalk_core_library:22+.
     Required by:
         :android:unspecified
      > Could not resolve org.xwalk:xwalk_core_library:22+.
         > Failed to list versions for org.xwalk:xwalk_core_library.
            > Unable to load Maven meta-data from https://download.01.org/crosswalk/releases/crosswa
lk/android/maven2/org/xwalk/xwalk_core_library/maven-metadata.xml.
               > Could not GET 'https://download.01.org/crosswalk/releases/crosswalk/android/maven2/
org/xwalk/xwalk_core_library/maven-metadata.xml'. Received status code 503 from server: Service Unav
ailable

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more l
og output.


解决方案:

修改android平台下的文件配置,具体为

{project_path}/platforms/android/cordova-plugin-crosswalk-webview/

下的文件,文件名应该是xxx-xwalk.gradle

找到下面这一段

dependencies {
compile xwalkSpec
}

替换为

dependencies {
compile 'org.xwalk:xwalk_core_library:23.53.589.4' //xwalkSpec
}

其中冒号之后的数字为Google上的cache的地址(可能会变化,如果需要参考下面的xml缓存的文件链接做替换)


Note to anyone else: if you are not on the latest version, you need to use the version of xwalk you are using (e.g. 15.44.384.13) You can get this from the cached version of the .xml page:


如果你不需要最新的版本,你需要使用你使用的xwalk的版本。你可以从缓存的xml文件中获取到:

http://webcache.googleusercontent.com/search?q=cache:c5JSA2watLkJ:https://download.01.org/crosswalk/releases/crosswalk/android/maven2/org/xwalk/xwalk_core_library/maven-metadata.xml&num=1&hl=en&gl=uk&strip=0&vwsrc=0

(此地址需要翻墙,google地址你懂的)


原文问答地址:

https://stackoverflow.com/questions/41931585/android-build-error-in-crosswalk?answertab=votes#tab-top

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值