* What went wrong:
A problem occurred configuring root project 'android'.
> Could not find support-v4.jar (com.android.support:support-v4:28.0.0-alpha1).
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/support-v4/28.0.0-alpha1/support-v4-28.0.0-alpha1.jar
升级 api level 至 26 后,第二次 build
ERROR: In <declare-styleable> FontFamilyFont, unable to find attribute android:font FAILED
ERROR: In <declare-styleable> FontFamilyFont, unable to find attribute android:fontStyle
ERROR: In <declare-styleable> FontFamilyFont, unable to find attribute android:fontWeight
* What went wrong:
Execution failed for task ':processDebugResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt
https://cordova.apache.org/docs/en/latest/guide/platforms/android/
Q
Error: build 老项目时,提示
Gradle sync failed: Could not find support-compat.aar (com.android.support:support-compat:28.0.0-alpha1).
升级 api level 至 26 后,第一次 build
升级 api level 至 26 后,第二次 build
Error: failed to fetch platform android
解决办法
目的是需要保证插件对 android-support 版本依赖的一致性,所以有几个办法,
第一个办法是手动修改插件配置或者修改 android 项目配置, 修改 android 项目配置,位于 build.gradle 文件最后添加
第二个办法是新增 build.extra.gradle 文件,使用 hook 修改android 项目配置
第三个是使用 cordova-android-support-gradle-release 插件,
参考:https://stackoverflow.com/questions/49162538/running-cordova-build-android-unable-to-find-attribute-androidfontvariation/49226335
cordova-android vs android api level
gradle vs ant
由于 cordova-android@6.4.0 的缘故,必须使用 gradle 进行 build,并且需要配置好环境变量( 其实就是 android 环境变量 )。从 Android SDK Tools 25.3.0 开始,ant 被废弃了。
参考