Cordova

Cordova android平台开发"cordova

2018-04-02  本文已影响69人  西瓜皮TWO
FAILURE: Build failed with an exception.

* What went wrong:
Error:Execution failed for task ':processArmv7DebugResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt
Error:In <declare-styleable> FontFamilyFont, unable to find attribute android:fontVariationSettings
cordova plugin add cordova-android-support-gradle-release --fetch

`方法二:在android平台下的build.gradle中添加代码段

/** 
IMPORTANT - Manually added
Problem: 8 March 2018 - Google released version support-v4:28.0.0-alpha1 
which breaks the project with following error: unable to find attribute 
android:fontVariationSettings and android:ttcIndex

Effect: Force a specific version of the library
*/
configurations.all {  
    resolutionStrategy {  
        force 'com.android.support:support-v4:27.1.0'  //兼容包的版本要跟compileSdkVersion配置相同
    }  
}  

警告:如果你进行remove/add android平台后在build.gradle中添加的代码将被覆盖。如果你不想因为某些原因而使用方法一的插件,或者这种方式对你不起作用,那么你可以每次创建一个钩子并覆盖文件。

如果问题还是存在,你可以试试:

cordova platform rm android
cordova platform add android

另外:
`确保你的手机上没有安装之前版本的APP,因为当你试图降低现有版本时,将收到一个模糊的错误:"INSTALL_FAILED_VERSION_DOWNGRADE" 和"UnhandledPromiseRejectionWarning: Unhandled promise rejection"

参考方案:https://stackoverflow.com/questions/49162538/running-cordova-build-android-unable-to-find-attribute-androidfontvariation/49174659#49174659

上一篇 下一篇

猜你喜欢

热点阅读