Software Archive
Read-only legacy content
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
17060 Discussions

Cordova android build not working: problem with audio plug-in

Ian_I_
Beginner
1,387 Views

hi, I updated to the new Intel xdk this morning and try doing and android build (Cordova plain… Not using crosswalk). However, the build errors out with an unexpected error, and the log file seems to indicate there is a problem with compiling the audio plug-in. Below is the detailed blog.Please assist. Thanks

Ian Ippolito

-post-compile:

-obfuscate:

-dex:
     [echo] Library project: do not convert bytecode...

-crunch:
   [crunch] Crunching PNG Files in source dir: .../DollarCandy/platforms/android/CordovaLib/res
   [crunch] To destination dir: .../DollarCandy/platforms/android/CordovaLib/ant-build/res
   [crunch] Crunched 0 PNG files to update cache

-package-resources:
     [echo] Library project: do not package resources...

-package:
     [echo] Library project: do not package apk...

-post-package:

-release-prompt-for-password:

-release-nosign:
     [echo] 
[propertyfile] Creating new property file: .../DollarCandy/platforms/android/CordovaLib/ant-build/build.prop
[propertyfile] Updating property file: .../DollarCandy/platforms/android/CordovaLib/ant-build/build.prop
[propertyfile] Updating property file: .../DollarCandy/platforms/android/CordovaLib/ant-build/build.prop
[propertyfile] Updating property file: .../DollarCandy/platforms/android/CordovaLib/ant-build/build.prop

-release-sign:

-post-build:

release:

-code-gen:
[mergemanifest] Merging AndroidManifest files into one.
[mergemanifest] Manifest merger disabled. Using project manifest only.
     [echo] Handling aidl files...
     [aidl] No AIDL files to compile.
     [echo] ----------
     [echo] Handling RenderScript files...
     [echo] ----------
     [echo] Handling Resources...
     [aapt] Generating resource IDs...
     [echo] ----------
     [echo] Handling BuildConfig class...
[buildconfig] Generating BuildConfig class.

-pre-compile:
     [echo] Set jars path to: .../DollarCandy/platforms/android/CordovaLib/ant-build/classes.jar:.../DollarCandy/platforms/android/libs/com.google.zxing.client.android.captureactivity.jar:.../DollarCandy/platforms/android/libs/gcm.jar:.../DollarCandy/platforms/android/libs/android-support-v13.jar

-compile:
    [javac] Compiling 42 source files to .../DollarCandy/platforms/android/ant-build/classes
    [javac] .../DollarCandy/platforms/android/src/com/rjfun/cordova/plugin/nativeaudio/NativeAudioAssetComplex.java:19: duplicate class: com.rjfuin.cordova.plugin.nativeaudio.NativeAudioAssetComplex
    [javac] public class NativeAudioAssetComplex implements OnPreparedListener, OnCompletionListener {
    [javac]        ^
    [javac] .../DollarCandy/platforms/android/src/com/rjfun/cordova/plugin/nativeaudio/NativeAudioAsset.java:19: cannot access com.rjfun.cordova.plugin.nativeaudio.NativeAudioAssetComplex
    [javac] bad class file: .../DollarCandy/platforms/android/src/com/rjfun/cordova/plugin/nativeaudio/NativeAudioAssetComplex.java
    [javac] file does not contain class com.rjfun.cordova.plugin.nativeaudio.NativeAudioAssetComplex
    [javac] Please remove or make sure it appears in the correct subdirectory of the classpath.
    [javac]     private ArrayList<NativeAudioAssetComplex> voices;
    [javac]                       ^

BUILD FAILED
/Developer/android-sdk-linux/tools/ant/build.xml:720: The following error occurred while executing this line:
/Developer/android-sdk-linux/tools/ant/build.xml:734: Compile failed; see the compiler error output for details.

Total time: 6 seconds
Error code 1 for command: ant with args: release,-f,.../DollarCandy/platforms/android/build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-gen
Command finished with error code 2: .../DollarCandy/platforms/android/cordova/build --release
Error: .../DollarCandy/platforms/android/cordova/build: Command failed with exit code 2
    at ChildProcess.whenDone (/Developer/cordova/3.5.0-0.2.7/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:743:16)
    at Process.ChildProcess._handle.onexit (child_process.js:810:5)

0 Kudos
9 Replies
Ian_I_
Beginner
1,387 Views

PS,

2) I just confirmed that this problem also happens when compiling on Cordova android for crosswalk. The log file is attached.

3) I also tried compiling on Cordova iOS. While I did not get an error during compile time, when I launch the app it gives a runtime error which was not occurring on the last version of the Intel xdk. It is related to audio, and I suspect related to the same issue on the two android platform builds. The error on iOS is that JavaScript can't find the plug-in object: window.plugins.LowLatencyAudio

0 Kudos
PaulF_IntelCorp
Employee
1,387 Views

Which API are you trying to use? Plugins correspond to APIs. There were some issues in the prior release where the plugins selected were not being communicated properly. Perhaps there is something wrong with your plugin selection versus the APIs you are using? According to your build log (slightly edited) you are including the following plugins (you can see the list at the beginning of the log file):

Fetching plugin "org.apache.cordova.file@1.3.2" via plugin registry
Installing "org.apache.cordova.file" for android
Installing "com.intel.xdk.accelerometer" for android
Installing "com.intel.xdk.audio" for android
Installing "com.intel.xdk.base" for android
Installing "com.intel.xdk.cache" for android
Installing "com.intel.xdk.camera" for android
Installing "com.intel.xdk.contacts" for android
Installing "com.intel.xdk.device" for android
Installing "com.intel.xdk.display" for android
Installing "com.intel.xdk.geolocation" for android
Installing "org.apache.cordova.device" for android
Fetching plugin "org.apache.cordova.inappbrowser@0.6.0" via plugin registry
Installing "org.apache.cordova.inappbrowser" for android
Installing "org.apache.cordova.splashscreen" for android
Installing "org.apache.cordova.geolocation" for android
Fetching plugin "https://github.com/yoik/cordova-yoik-screenorientation" via git clone
Installing "net.yoik.cordova.plugins.screenorientation" for android
Installing "com.intel.xdk.player" for android
Fetching plugin "https://github.com/floatinghotpot/cordova-plugin-lowlatencyaudio" via git clone
Installing "com.rjfun.cordova.plugin.nativeaudio" for android
Fetching plugin "https://github.com/phonegap-build/PushPlugin" via git clone
Installing "com.phonegap.plugins.PushPlugin" for android
Installing "org.apache.cordova.dialogs" for android

I'm assuming the list above is what you expect? If not, please double-check your configuration on the Projects tab and/or in the additions file.

There may be a conflict between the Cordova Audio plugin and that low latency audio plugin you are including. I'm not familiar with the low-latency plugin, but if it is using the same API as the other (and/or the xdk player plugin) that could be part of the problem. The other thing that could be getting in the way is if one depends on the other (for example, the low-latency might depend on the Cordova audio plugin) and there may be a version mis-match.

Again, I am not familiar with the API of the low-latency plugin or it's requirements. I recommend you take a look at the repo docs for it to see what is going on. One thing that bugs me is that when I go to https://github.com/floatinghotpot/cordova-plugin-lowlatencyaudio it takes me to https://github.com/floatinghotpot/cordova-plugin-nativeaudio which appears to be using the namespace window.plugins.NativeAudio (per the plugins.xml file) rather than the window.plugins.LowLatencyAudio namespace that is shown in your error message, and which makes more sense according to the URL. It's possible there's been some significant changes made to that plugin that have broken your code... Unfortunately, there are no tagged versions in that repo, so you might have to look through it to see if that is what is going on.

We are making changes to the way the XDK handles plugins to help avoid this sort of a problem, but that is a major change to the way it handles plugins that won't be available for several releases, yet. In the meantime, if you specify a third-party plugin without a revision or refTag, this sort of thing is something you need to be watchful of -- the state of the individual plugin repos our outside of our control.

0 Kudos
Ian_I_
Beginner
1,387 Views

hi Paul, thanks for the reply. I tried four times to post a response, but kept getting blocked by the supposed spam filter, even after removing all URLs (so I'm not sure what it's complaining about). I filed a complaint using the link, but that just seem to send an automated form and who knows how long it will take to hear back. So I'm trying right now to post just this message and see if at least this will get there. If it does, then I'm going to post a very abbreviated version of what I wrote originally.

Ian

0 Kudos
Ian_I_
Beginner
1,387 Views

Okay that worked: hopefully this will too.

Hi Paul, thanks for the reply.

To answer your question, yes the code does use the low latency audio plug-in at: cordova-plugin-lowlatencyaudio.

You said:

>>one thing that bugs me is that when I go to (URL removed because spam filter is blocking my posting otherwise) it takes me to (URL removed because spam filters blocking me otherwise) which appears to be using the namespace window.plugins.NativeAudio (per the plugins.xml file) rather than the window.plugins.LowLatencyAudio namespace that is shown in your error message, and which makes more sense according to the URL. It's possible there's been some significant changes made to that plugin that have broken your code... Unfortunately, there are no tagged versions in that repo, so you might have to look through it to see if that is what is going o


 Yes I do see what you mean, and will check that out and see if that is what's going on.

You said:

>>The other thing that could be getting in the way is if one depends on the other (for example, the low-latency might depend on the Cordova audio plugin) and there may be a version mis-match.


I will check this out too. However, the one thing I'm confused about is why the Cordova audio plug-in is being pulled in the first place.

Under the plug-ins configuration section of the project, I double checked under "Standard Cordova Plug-Ins", and don't see it even listed; let alone being checked. Also, I double checked the third-party plug-ins and it's not being included there. One thought: maybe it's being auto included, because I have checked the Intel xdk plug-in for audio in the "Intel xdk plug-in" section?

Ian Ippolito

 

0 Kudos
Ian_I_
Beginner
1,387 Views

Paul, please ignore my last message as I now see the answer to my own question. (I was not realizing that the audio plug-in being referenced was actually the old name of the third party low latency plug-in).

After updating the project to point to the new location of the plug-in (rather than the old repository that was doing a redirect), it has improved things. The build no longer says "Duplicate Class". Instead, the new error is:

-compile:
    [javac] Compiling 42 source files to .../DollarCandy/platforms/android/ant-build/classes
    [javac] .../DollarCandy/platforms/android/src/com/rjfun/cordova/plugin/nativeaudio/NativeAudio.java:200: cannot find symbol
    [javac] symbol  : method setButtonPlumbedToJs(int,boolean)
    [javac] location: class org.apache.cordova.CordovaWebView
    [javac]         this.webView.setButtonPlumbedToJs(KeyEvent.KEYCODE_VOLUME_DOWN, false);
    [javac]                     ^
    [javac]     ^
    [javac] Note: Some input files use or override a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
    [javac] 3 errors

So basically it is not able to find this method: this.webView.setButtonPlumbedToJs.

I've never created a Cordova plug-in myself, but I believe this webView object is built into Cordova itself and does not having anything to do with the plug-in. I say this because:

1) The Cordova documentation says:"Cordova applications are ordinarily implemented as a browser-based WebView within the native mobile platform." 

 

2) The source code for the Cordova android application library contains a built-in webView object. Additionally, it also defines a method called: setButtonPlumbedToJs. https://github.com/apache/cordova-android/blob/master/framework/src/org/apache/cordova/CordovaWebView.java

If this is built into Cordova itself, then this does not seem to be a problem with the plug-in. Why is the method on this built-in Cordova object not available during a build?

 

0 Kudos
PaulF_IntelCorp
Employee
1,387 Views

Sorry, haven't had much time to look further into this. Based on the call parameters, I'm guessing there may be some dependency on the Cordova volume up and volume down events, but those are supposed to be built into the framework (as you have surmised in your comment). Here's a link to those events: http://cordova.apache.org/docs/en/5.0.0/cordova_events_events.md.html#Events

0 Kudos
Ian_I_
Beginner
1,387 Views

Hi Paul, yes I wouldn't be surprised if you're right and it's something to do with the volume buttons, since this is an audio plug-in.

So currently it looks most likely to me that the build performed by the Intel xdk is not providing one of the built-in Cordova objects that it should be (for whatever reason). Since the Intel build process is a black box from my point of view, I can't pursue this any further on my side, and can't build the app anymore until it's resolved. Since you're so busy right now, is it possible for someone else to take a look at it? (I don't know if you have a large team or if you are the only/main person doing all the heavy lifting).

By the way, I've run into another strange problem with plug-ins in the new release, but will post a separate issue about it, so as to keep the different problems separate.

 

 

 

0 Kudos
PaulF_IntelCorp
Employee
1,387 Views

Are you able to share a project that illustrates the build problem you are seeing? Be sure to include the <project-name>.xdk file as part of the project, plus, obviously the complete source directory (usually "www" inside your project directory). If I can reproduce the issue with such a project I can get engineering to take a deeper look.

0 Kudos
Ian_I_
Beginner
1,387 Views

Hi Paul, thanks and it's useful to know for next time. Thanks to your reply on the other issue I have open, I now have a workaround (using an older version of the plug-in that exists elsewhere, which doesn't have this compilation issue). So I think I don't need this resolved anymore. However, if for some reason that turns out to be a dead-end, then I will create a test project for you to duplicate it..

 

Ian

0 Kudos
Reply