When I upgraded my LG Nexus 4 phone from Android 4.4.4 to 5.0.1, my App stopped working (connecting to a Arduino Adafruit EZ-Link Bluetooth shield). The only hint/idea I have right now is that the cordova build is using API 19 (Android 4.4.2) instead of API 21 (5.0.1).
I've rebuilt the App and everything else to know about API 21 (5.0.1) but I cannot get cordova to use it. It insists upon using API target 19.
Many people say do NOT change platforms/android/AndroidManifest.xml. Even if you do, it still will not work. Based on what I seen in How do I specify the Android API Level in PhoneGap? I updated my config.xml to include:
<preference name="android-targetSdkVersion" value="21" />
<preference name="android-minSdkVersion" value="14" />
but that doesn't work either. I blew away the old Android virtual device in AVD (Android Virtual Device) manager, and created a new one that uses API 21 and the API 21 stuff is installed from the Android SDK Manager. But when I do a cordova build, I still get:
[gettarget] Project Target: Android 4.4.2
[gettarget] API level: 19
If I specify using the --target option, it explodes with:
server5> cordova build --target="android-21"
Running command: /usr/local/GrayAndWhite/cordova/wounds/platforms/android/cordova/build --target=android-21
/usr/local/GrayAndWhite/cordova/wounds/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
TypeError: Cannot call method 'prepEnv' of undefined
API 21 is known about. It I do a cordova info, I will get a
...
id: 3 or "android-21"
Name: Android 5.0.1
Type: Platform
API level: 21
Revision: 2
...
I know the Arduino side of things is still ok, because the phone can pair to the device, the App can see the device, get it's MAC address, but cannot connect to it any more.
I have not tried removing the API 19 stuff from the SDK. I'd rather not do that since I'll probably want to be able to install this on other phones as well.