Ionic android build fails, no matches found

2019-09-08 17:03发布

问题:

I'm trying to build android using ionic, but I get the following error:

/Users/xxx/dev/workspace/project/platforms/android/build/intermediates/res/merged/armv7/debug/values-v24/values-v24.xml:3: AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.

For what I've researched, this has something to do with a mismatching android SDK version, but I do have all the versions aligned:

Android SDK: 23
Android Build-tools: 23.0.3 (also got 23.0.2 and 23.0.1)
Android Platform-tools: 23.1.0

Also, in my config.xml:

<preference name="android-minSdkVersion" value="16" />
<preference name="android-targetSdkVersion" value="23" />

Ionic build the platform using cordova add platform android@5.2.2

What I've done

  1. Downgrading the API version, just got errors
  2. Upgrading the API version and creating the platform using ionic platform android@6.0.0. It did compile, but got new errors (like deviceready not beign fired and the icon and splash not beign loaded).
  3. Reinstall ionic and cordova at different versions. Nothing changed.

At this point I really don't what is happening, since all the others post about this errors get solved by getting the correct android versions. And by the way, I can build and run iOs app with no errors.

Plugin list

com.shoety.cordova.plugin.inappbrowserxwalk 0.3.3 "InAppBrowser Crosswalk"
cordova-plugin-actionsheet 2.3.3 "ActionSheet"
cordova-plugin-app-version 0.1.9 "AppVersion"
cordova-plugin-compat 1.1.0 "Compat"
cordova-plugin-console 1.0.6 "Console"
cordova-plugin-crosswalk-webview 2.1.0 "Crosswalk WebView Engine"
cordova-plugin-device 1.1.5 "Device"
cordova-plugin-file 4.3.2 "File"
cordova-plugin-geolocation 2.4.2 "Geolocation"
cordova-plugin-inappbrowser 1.6.0-dev "InAppBrowser"
cordova-plugin-media 2.4.1 "Media"
cordova-plugin-network-information 1.3.2 "Network Information"
cordova-plugin-splashscreen 4.0.2 "Splashscreen"
cordova-plugin-statusbar 2.2.2 "StatusBar"
cordova-plugin-whitelist 1.3.2 "Whitelist"
cordova-sqlite-storage 1.5.3 "Cordova sqlite storage plugin"
cordova.plugins.diagnostic 3.3.3 "Diagnostic"
ionic-plugin-keyboard 2.2.1 "Keyboard"
phonegap-plugin-barcodescanner 6.0.5 "BarcodeScanner"
uk.co.workingedge.phonegap.plugin.launchnavigator 3.2.1 "Launch Navigator"

EDIT: The problem is the version of Diagnostic. If I downgrade it to 3.0.0, the build works for Android, but Fails for iOs, since the source code was made using that version. I don't know why It doesn't work for me.

回答1:

The build problem is due to compatibility issue with Cordova diagnostic plugin.

As per my analysis, I came across this issue in the official issue tracking section of the plugin page. There are two possible solutions to resolve the build issue as follows:

  1. Downgrading the diagnostic plugin to version 3.0.0 as suggested by the users
  2. Upgrading Cordova android version to the latest compatible version of the plugin as suggested by the plugin author.

Hope it helps. Cheers.



回答2:

This worked for me, as of 6/16/2017

In the plugin.xml for diagnostic

Change these 2 lines:

<framework src="com.android.support:support-v4:25.+" />
<framework src="com.android.support:appcompat-v7:25.+" />

to

<framework src="com.android.support:support-v13:23+"/>
<framework src="com.android.support:appcompat-v7:23+" />