突然打不了包了, 很奇怪. 错误信息:
A problem occurred configuring root project 'android'. > Could not find common.jar (android.arch.core:common:1.1.0). Searched in the following locations: https://jcenter.bintray.com/android/arch/core/common/1.1.0/common-1.1.0.jar
上网查了下, 说是build.gradle中的依赖不能有"+", 通过查看build.gradle, 抱着试试看的态度, 我将plugin中的插件搜了一遍, 将所有的:
compile 'com.android.support:support-v4:24.1.1+'
compile 'com.android.support:support-v4:+'
改成了:
compile 'com.android.support:support-v4:24.1.1'
compile 'com.android.support:support-v4:'
重新添加平台再次打包果然成功了, 高兴不过三秒发现在安装了crosswalk的情况下, 依然打不了包, 错误信息如下:
Execution failed for task ':processArmv7ReleaseResources'. > com.android.ide.common.process.ProcessException: Failed to execute aapt
ERROR: In <declare-styleable> FontFamilyFont, unable to find attribute android:font
继续调查,尝试,解决方式如下:
在添加完android平台后, 在build.gradle中最外层添加:
configurations.all {
resolutionStrategy {
force 'com.android.support:support-v4:24+'
}
}
这个版本与我的项目使用的android sdk版本有关. 可是新的问题出现了, 这样修改无法做到自动化构建,打包. 因为每次添加完平台后, 都要手动修改配置文件.
最后还是从crosswalk入手, 找到了另一种解决方案:
添加插件:
cordova plugin add cordova-android-support-gradle-release --variable ANDROID_SUPPORT_VERSION=25.+
重新添加平台后打包成功.