Barcode scanner android build error: compileSdkVersion is not specified


Hey All,

In my project I want to add the native barcode scanner plugin.
After adding the plugin my project android build stops working.

I am running this on macOS Sierra

It throws the following error when running: ionic cordova build android

java.lang.IllegalStateException: compileSdkVersion is not specified.



The result of ionic info

cli packages: (/usr/local/lib/node_modules)

    @ionic/cli-utils  : 1.19.0
    ionic (Ionic CLI) : 3.19.0

global packages:

    cordova (Cordova CLI) : 8.0.0

local packages:

    @ionic/app-scripts : 3.1.6
    Cordova Platforms  : android 7.0.0
    Ionic Framework    : ionic-angular 3.9.2


    Android SDK Tools : 26.1.1
    ios-deploy        : 1.9.2
    Node              : v6.11.4
    npm               : 3.10.10
    OS                : macOS Sierra
    Xcode             : Xcode 9.2 Build version 9C40b

Environment Variables:

    ANDROID_HOME : /Users/username/Library/Android/sdk


    backend : pro

My JAVA_HOME is set to

In android studio I installed the following SDK

And tools

When removing the plugin, the project builds succesfully.

I tried to set the defaultCompileSdkVersion to 27 in file build.gradle and search throughout the platform folder to set the CompileSdkVersion.

I do not fully understand why this error is thrown.

Can you point me in the right direction to solve this problem.

Your help is greatly appreciated.


Exact the same issue for me…
Only removing usage of this plugin can help.
Will set you notify, when will find some solution…


It seems to be a problem with Cordova 7. Downgrading my project to 6.4.0 did the trick for me:

cordova platform rm android
cordova platform add android@6.4.0

Hope the plugin will be fixed to be runnable at cordova 7.


I downgraded my project as well. This also did the trick for me. Thank you


This fixed the issue, thanks!


This allowed me to build on android:

ionic cordova platform rm android
ionic cordova platform add android@6.3.0