Phonegap 构建 apk 失败并出现 FontFamilyFont 错误

Phonegap build apk fails with FontFamilyFont errors

我正在使用 https://build.phonegap.com 构建我的 apk 和 ipa 文件。

我创建 zip 包并更新它,然后我下载 apk/ipa。

从今天开始,我遇到了一个麻烦:apk 文件没有编译,我可以在日志中看到错误(生成 ipa 时)。

请注意,我没有对 Android 设置进行任何更改,我认为这是 Android 更新导致的。

Phonegap 日志说(这只是预告片):

BUILD FAILED

Total time: 4.069 secs

Error: /gradlew: Command failed with exit code 1 Error output: Note: Some input files use or override a deprecated API.

Note: Recompile with -Xlint:deprecation for details.

Note: Some input files use or override a deprecated API.

Note: Recompile with -Xlint:deprecation for details.

ERROR: In FontFamilyFont, unable to find attribute android:font

ERROR: In FontFamilyFont, unable to find attribute android:fontStyle

ERROR: In FontFamilyFont, unable to find attribute android:fontVariationSettings

ERROR: In FontFamilyFont, unable to find attribute android:fontWeight ERROR: In FontFamilyFont, unable to find attribute android:ttcIndex

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':processDebugResources'.

    com.android.ide.common.process.ProcessException: Failed to execute aapt

我使用 DevExtreme,一个基于 Phonegap 的平台,所以纯 Phonegap 的工作解决方案也应该适用于我的项目。

我的config.xml是

<widget id="com.devexpress.apptemplate" version="1.0" versionCode="1">
  <name>ApplicationTemplate</name>
  <description>Template</description>
  <author email="info@info.com" href="http://www.info.com/">Info</author>
  <preference name="permissions" value="none" />
  <preference name="prerendered-icon" value="true" />
  <preference name="phonegap-version" value="cli-7.0.1" />
  <icon src="icon/ios/icon.png" width="1024" height="1024" />
  <preference name="android-windowSoftInputMode" value="adjustPan" />
  <preference name="SplashScreenDelay" value="3000" />
  <preference name="AutoHideSplashScreen" value="true" />
  <preference name="SplashShowOnlyFirstTime" value="false" />
  <preference name="FadeSplashScreen" value="false" />
  <preference name="ShowSplashScreenSpinner" value="false" />
  <preference name="DisallowOverscroll" value="true" />
  <preference name="StatusBarOverlaysWebView" value="false" />
  <preference name="StatusBarStyle" value="default" />
  <feature name="StatusBar">
    <param name="ios-package" value="CDVStatusBar" onload="true" />
  </feature>
  <preference name="StatusBarBackgroundColor" value="#000000" />
  <preference name="android-minSdkVersion" value="15" />
  <preference name="android-targetSdkVersion" value="26" />
  <platform name="android">
    <resource-file src="google-services.json" target="google-services.json" />
  </platform>
  <platform name="ios">
    <resource-file src="GoogleService-Info.plist" />
  </platform>
  <plugin name="cordova-plugin-geolocation" spec="2.4.1" />
  <plugin name="cordova-plugin-inappbrowser" />
  <plugin name="cordova-plugin-splashscreen" onload="true" />
  <plugin name="cordova-plugin-whitelist" />
  <plugin name="cordova-plugin-ios-longpress-fix" />
  <!--<plugin name="cordova-plugin-statusbar" onload="true" />-->
  <plugin name="phonegap-plugin-push" spec="2.0.0" />
  <plugin spec="https://github.com/Telerik-Verified-Plugins/BarcodeScanner.git" source="git">
    <param name="CAMERA_USAGE_DESCRIPTION" value="To scan barcodes." />
  </plugin>
  <plugin name="cordova-plugin-camera" spec="^2.4.1" source="npm">
    <variable name="CAMERA_USAGE_DESCRIPTION" value="This app requires access to take picture and send them, if needed." />
    <variable name="PHOTOLIBRARY_USAGE_DESCRIPTION" value="This app requires access to the photo library to send them, if needed." />
  </plugin>
  <access origin="*" />
  <!--<engines>
    <engine name="android" spec="^6.3.0" />
  </engines>-->
</widget>

我找到了解决这个问题的妙招。

我在 config.xml 中添加了这个:

<plugin name="cordova-android-support-gradle-release">
     <variable name="ANDROID_SUPPORT_VERSION" value="26.0.0"/>
</plugin>

并将 targetSdkVersion 更改为 26:

<preference name="android-targetSdkVersion" value="26"/>