cordovaphonegap-pluginsphonegap-buildcoldfusionbuilder

PhoneGap Android Build Error: Old Versions and Plugins


I found a solution to the following issue and I would just like to document the solution for any people who have the same problem.

In the PhoneGap Android build log I have the following error:

Installing "cordova-plugin-file-opener2" at "2.0.7" for android
 Using this version of Cordova with older version of cordova-android is being deprecated. Consider upgrading to cordova-android@5.0.0 or newer.
--------------------------------------------------------------------------------
COMPILE OUTPUT
--------------------------------------------------------------------------------
Buildfile: /project/build.xml

-set-mode-check:

-set-debug-files:

-check-env:
 [checkenv] Android SDK Tools Revision 25.2.5

-setup:
     [echo] Project Name: appname
  [gettype] Project Type: Application

-set-debug-mode:

-debug-obfuscation-check:

-pre-build:

-build-setup:
[getbuildtools] Using latest Build Tools: 24.0.1
     [echo] Resolving Build Target for appname...
[gettarget] Project Target:   Android 5.0.1
[gettarget] API level:        21
     [echo] ----------
     [echo] Creating output directories if needed...
    [mkdir] Created dir: /project/bin
    [mkdir] Created dir: /project/bin/res
    [mkdir] Created dir: /project/bin/rsObj
    [mkdir] Created dir: /project/bin/rsLibs
    [mkdir] Created dir: /project/gen
    [mkdir] Created dir: /project/bin/classes
    [mkdir] Created dir: /project/bin/dexedLibs
     [echo] ----------
     [echo] Resolving Dependencies for appname...

BUILD FAILED
/android-sdk/tools/ant/build.xml:573: ../../../../../../android-sdk/com.android.support:support-v4:+ resolve to a path with no project.properties file for project /project

My project's config.xml:

...
<preference  name="phonegap-version"  value="3.7.0"  />
...
<plugin name="cordova-plugin-file-opener2" source="npm" />
...

Solution

  • Now in the error you will note that the installation attempts

    Installing "cordova-plugin-file-opener2" at "2.0.7" for android
    

    as the same plugin in config.xml has no set version it will automatically attempt to use the latest version.

    Following the steps in my previous answer you will find the latest version of this plugin to work with PhoneGap version 3.7.0 is File Opener Plugin 1.0.11 and not the install's attempted 2.0.7 so adding spec="1.0.11" to the plugin to look like:

    <plugin name="cordova-plugin-file-opener2" spec="1.0.11" source="npm" />
    

    will force it to use the compatible version. I assume this will translate to any old plugin not being built.