Page 1 of 1

cordova-plugin-ble

Posted: 23:32, 18 May 2016
by 2016djain
When I add the cordova-plugin-ble to my Cordova project (through CLI), the android build stops working. This is the log output:

Albus-Severus-Potter:BTBouncer diyarocker$ cordova build android
ANDROID_HOME=/Applications/Android Studio.app/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home
:preBuild UP-TO-DATE
:preDebugBuild UP-TO-DATE
:checkDebugManifest
:CordovaLib:preBuild UP-TO-DATE
:CordovaLib:preDebugBuild UP-TO-DATE
:CordovaLib:compileDebugNdk UP-TO-DATE
:CordovaLib:compileLint
:CordovaLib:copyDebugLint UP-TO-DATE
:CordovaLib:mergeDebugProguardFiles UP-TO-DATE
:CordovaLib:packageDebugRenderscript UP-TO-DATE
:CordovaLib:checkDebugManifest
:CordovaLib:prepareDebugDependencies
:CordovaLib:compileDebugRenderscript UP-TO-DATE
:CordovaLib:generateDebugResValues UP-TO-DATE
:CordovaLib:generateDebugResources UP-TO-DATE
:CordovaLib:packageDebugResources UP-TO-DATE
:CordovaLib:compileDebugAidl UP-TO-DATE
:CordovaLib:generateDebugBuildConfig UP-TO-DATE
:CordovaLib:generateDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugAssets UP-TO-DATE
:CordovaLib:processDebugManifest UP-TO-DATE
:CordovaLib:processDebugResources UP-TO-DATE
:CordovaLib:generateDebugSources UP-TO-DATE
:CordovaLib:compileDebugJavaWithJavac UP-TO-DATE
:CordovaLib:processDebugJavaRes UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForDebug UP-TO-DATE
:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForDebug UP-TO-DATE
:CordovaLib:mergeDebugJniLibFolders UP-TO-DATE
:CordovaLib:transformNative_libsWithMergeJniLibsForDebug UP-TO-DATE
:CordovaLib:transformNative_libsWithSyncJniLibsForDebug UP-TO-DATE
:CordovaLib:bundleDebug UP-TO-DATE
:prepareAndroidCordovaLibUnspecifiedDebugLibrary UP-TO-DATE
:preReleaseBuild UP-TO-DATE
:CordovaLib:preReleaseBuild UP-TO-DATE
:CordovaLib:compileReleaseNdk UP-TO-DATE
:CordovaLib:copyReleaseLint UP-TO-DATE
:CordovaLib:mergeReleaseProguardFiles UP-TO-DATE
:CordovaLib:packageReleaseRenderscript UP-TO-DATE
:CordovaLib:checkReleaseManifest
:CordovaLib:prepareReleaseDependencies
:CordovaLib:compileReleaseRenderscript UP-TO-DATE
:CordovaLib:generateReleaseResValues UP-TO-DATE
:CordovaLib:generateReleaseResources UP-TO-DATE
:CordovaLib:packageReleaseResources UP-TO-DATE
:CordovaLib:compileReleaseAidl UP-TO-DATE
:CordovaLib:generateReleaseBuildConfig UP-TO-DATE
:CordovaLib:generateReleaseAssets UP-TO-DATE
:CordovaLib:mergeReleaseAssets UP-TO-DATE
:CordovaLib:processReleaseManifest UP-TO-DATE
:CordovaLib:processReleaseResources UP-TO-DATE
:CordovaLib:generateReleaseSources UP-TO-DATE
:CordovaLib:compileReleaseJavaWithJavac UP-TO-DATE
:CordovaLib:processReleaseJavaRes UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForRelease UP-TO-DATE
:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForRelease UP-TO-DATE
:CordovaLib:mergeReleaseJniLibFolders UP-TO-DATE
:CordovaLib:transformNative_libsWithMergeJniLibsForRelease UP-TO-DATE
:CordovaLib:transformNative_libsWithSyncJniLibsForRelease UP-TO-DATE
:CordovaLib:bundleRelease UP-TO-DATE
:prepareComAndroidSupportSupportV42102Library UP-TO-DATE
:prepareDebugDependencies
:compileDebugAidl UP-TO-DATE
:compileDebugRenderscript UP-TO-DATE
:generateDebugBuildConfig UP-TO-DATE
:generateDebugAssets UP-TO-DATE
:mergeDebugAssets UP-TO-DATE
:generateDebugResValues UP-TO-DATE
:generateDebugResources UP-TO-DATE
:mergeDebugResources UP-TO-DATE
:processDebugManifest UP-TO-DATE
:processDebugResources UP-TO-DATE
:generateDebugSources UP-TO-DATE
:compileDebugJavaWithJavac/Users/diyarocker/GitHub/Bouncer/BTBouncer/platforms/android/src/com/evothings/BLE.java:40: error: cannot find symbol
import android.support.v4.app.ActivityCompat.OnRequestPermissionsResultCallback.*;
^
symbol: class OnRequestPermissionsResultCallback
location: class ActivityCompat
/Users/diyarocker/GitHub/Bouncer/BTBouncer/platforms/android/src/com/evothings/BLE.java:49: error: cannot find symbol
OnRequestPermissionsResultCallback
^
symbol: class OnRequestPermissionsResultCallback
/Users/diyarocker/GitHub/Bouncer/BTBouncer/platforms/android/src/com/evothings/BLE.java:237: error: method does not override or implement a method from a supertype
@Override
^
/Users/diyarocker/GitHub/Bouncer/BTBouncer/platforms/android/src/com/evothings/BLE.java:277: error: cannot find symbol
if (ContextCompat.checkSelfPermission(mContext, Manifest.permission.ACCESS_COARSE_LOCATION) !=
^
symbol: variable ContextCompat
location: class BLE
/Users/diyarocker/GitHub/Bouncer/BTBouncer/platforms/android/src/com/evothings/BLE.java:283: error: cannot find symbol
ActivityCompat.requestPermissions(
^
symbol: variable ActivityCompat
location: class BLE
Note: /Users/diyarocker/GitHub/Bouncer/BTBouncer/platforms/android/src/com/evothings/BLE.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
5 errors
FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 8.485 secs
Error: Error code 1 for command: /Users/diyarocker/GitHub/Bouncer/BTBouncer/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/diyarocker/GitHub/Bouncer/BTBouncer/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true

I have added the android support v4 plugin to my project, tried removing and adding npm, node, cordova, and even the android platform. Does anyone know what could be wrong?

Re: cordova-plugin-ble

Posted: 12:43, 30 Jun 2016
by Fredrik
I, too, have had build problems. To fix them, I made some changes to my branch. Try this:

Code: Select all

cordova plugin remove cordova-plugin-ble
cordova plugin add https://github.com/fredrikeldh/cordova-ble