dpa99c / cordova-diagnostic-plugin

Cordova/Phonegap plugin to manage device settings
538 stars 359 forks source link

Execution failed for task ':processArmv7ReleaseResources' #172

Closed matthewct closed 7 years ago

matthewct commented 7 years ago

I have built an Android App using Intel XDK version 3759 which uses the following plugins:

For some reason, my working app suddenly failed to build, and I am sure I had not made changes to it. The error in the log file is as follows:

* What went wrong:
Execution failed for task ':processArmv7ReleaseResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '.../android-sdk/build-tools/25.0.0/aapt'' finished with non-zero exit value 1

I have tried updating the plugins above to their latest versions, including "cordova.plugins.diagnostic" to 3.3.3 but the build still fails. I can only get the build to work if I roll back "cordova.plugins.diagnostic" to 3.1.1 , but then I lose functionality which I had previously (it fails with anything newer than 3.1.1).

The attached log file had the same failure message before I updated the plugins to the latest.

Any comments or help on this problem would be much appreciated, I have uploaded the log file below:

locaterate.build.201701220604.txt

Thank you.

dpa99c commented 7 years ago

Looking at your build log, the error causing the build to fail is:

Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.

This is the same as #168: the cause is that the Android SDK used for compilation is mismatched with the version of the Android Support Library. And in Cordova projects, the Android compile SDK is implicitly related to the version of the Cordova Android platform in your project:

`cordova-android@5.x` => Android SDK v23
`cordova-android@6.x` => Android SDK v24

Intel XDK must be defaulting to cordova-android@5.x hence compiling with SDK v23, but this plugin is pulling in the most recent version syndicated by Google - which is currently v24.

So, v23 compile SDK + v24 support library = your error

The reason v3.1.1 of this plugin works is that it pins the version of the support library to v23 which works with Android SDK v23 which is used by cordova-android@5. The problem with pinning the version of the support library is that if other plugins specify a different version, the build fails (see #105). Hence, since v3.1.2 of this plugin, the version of the support library is unpinned to use the most recent version syndicated by Google - which is currently v24.

If you were building locally, the solution would be simple: upgrade your Cordova Android platform to the latest version: cordova-android@6.1.1 which targets Android SDK v24:

cordova platform rm android && cordova platform add android@latest

I've no idea if you can specify the platform version using Intel XDK; I know that you can do it for Phonegap Build by specifying the phonegap-version preference - see here.

So you either need to figure out how to specify the Cordova Android platform version in Intel XDK and set it to cordova-android@6.x, or if that's not possible, fork the plugin and pin the support library version to v23 in the plugin.xml (as v3.1.1 does):

<framework src="com.android.support:support-v4:23.+" />
<framework src="com.android.support:appcompat-v7:23.+" />
matthewct commented 7 years ago

Thank you for your prompt reply.

I have had a look at Intel XDK which currently states "Using platform cordova-android 5.1.1" in the build log. I also checked on Cordova, and it seems that API-Level 23 is the latest as it states in the following link "Cordova's latest Android package supports up to Android API-Level 23":

https://cordova.apache.org/docs/en/latest/guide/platforms/android/

I have only started using Intel XDK and these tools recently so I will need to investigate how to proceed with this issue.

dpa99c commented 7 years ago

I also checked on Cordova, and it seems that API-Level 23 is the latest as it states in the following link "Cordova's latest Android package supports up to Android API-Level 23"

Unfortunately Cordova documentation is always somewhat out-of-date, including that page. The best place to looks for recent updates is their release notes:

https://github.com/apache/cordova-android/blob/master/RELEASENOTES.md

Full Support for Android Nougat (API 24)

matthewct commented 7 years ago

I asked a question on the Intel XDK forum and received the reply copied below:

https://software.intel.com/en-us/forums/intel-xdk/topic/709382

Our build system does not include a version of Cordova that support cordova-android@6.x, so that means you cannot use that plugin with our build system. You need to either build the app using PhoneGap Build or using Cordova CLI, locally.

I am now going to change to Adobe PhoneGap Build.

Thank you for your help and fast response, keep up the great work.

matthewct commented 7 years ago

I have now converted my application across to "Adobe PhoneGap Build" and this allowed me to use phonegap-version cli-6.4.0 as shown here:

https://build.phonegap.com/current-support

After being able to upgrade to cli-6.4.0 the problem was resolved.