0

I've been building an app for months on PhoneGap Build using cli-5.2.0, now due to plugins and Android M permissions I was forced to move to cli-6.1.0 and gradle build.

Suddenly it's not respecting android-minSdkVersion anymore, I usually build 2 APKs, one for sdk 15-19 and another for 21+, but now it ignores the config-file preference and any APK is built for SDK 15+

I think it could be related with gradle build but couldn't find out how to configure the min sdk version for gradle to read, and where to put the gradle config file, I'm using just a text editor and grunt to run the build on phonegap build.

gcampos
  • 19
  • 6

2 Answers2

3

You could use cordova hooks to copy custom gradle file into the platform.

I set up a pre-build hook script to copy my build-extra.gradle into my android platform.

In my config.xml I added

<platform name="android">
  <hook type="before_build" src="hooks/build-extras-gradle.sh"/>
</platform>

Which is a bash script:

#!/usr/bin/env bash

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

cd "$DIR/.."

echo '=== Copy Gradle build extras to android'
cp -Rf build-extras.gradle platforms/android

My build-extras.gradle file:

ext.cdvMinSdkVersion = 21
android.lintOptions.abortOnError = false
android.lintOptions.checkReleaseBuilds = false
  • Ernesto thank you for your answer. I tried it without success, as far as I've been searching, Adobe PhoneGap Build doesn't support Cordova Hooks, have you been able to do this on Adobe's build service? – gcampos Jun 30 '16 at 20:10
0

I've just found out that the latest versions of phonegap-plugin-barcodescanner are enforcing sdk version 15+ through its gradle build script.

Rolling back to 4.x versions solved the issue (besides bringing other issues like camera upside down on newer phones, etc, etc).

gcampos
  • 19
  • 6