Software Archive
Read-only legacy content
17061 Discussions

Debug error on custom plugin library

Antonio_Za
Beginner
553 Views

I'm trying to develop my first plugin to communicate with an ethernet printer, on Android. I got the .jar library (customandroidapi.jar) from the constructor and the Android native samples too.

Now, I prepared a draft plugin and I'm trying to adding it into my XDK project but the debug module gives me this error:

//////////////////////////////////////////////////////////////////////////

************* Completed processing the main config.xml file (after_prepare)  *****************
Running command: .../cordova_project/platforms/android/cordova/build --debug --buildConfig=.../cordova_project/build.json
ANDROID_HOME=.../android-sdk
JAVA_HOME=/usr/lib/jvm/java-8-oracle-amd64
Reading build config file: .../cordova_project/build.json
cp: copyFileSync: could not write to dest file (code=ENOTDIR):.../cordova_project/platforms/android/cordova-plugin-printers-fusion/xwalk16-customandroidapi.jar/build.gradle

Running: .../cordova_project/platforms/android/gradlew cdvBuildDebug -b .../cordova_project/platforms/android/build.gradle --no-daemon
embedded
org.xwalk:xwalk_core_library:16+

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Cannot evaluate module customandroidapi.jar : Configuration with name 'debug' not found.

* 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: 12.619 secs

.../cordova_project/platforms/android/cordova/node_modules/q/q.js:126
                    throw e;
                    ^
Error code 1 for command: .../cordova_project/platforms/android/gradlew with args: cdvBuildDebug,-b,.../cordova_project/platforms/android/build.gradle,--no-daemon
Command finished with error code 1: .../cordova_project/platforms/android/cordova/build --debug,--buildConfig=.../cordova_project/build.json
ERROR building one of the platforms: Error: .../cordova_project/platforms/android/cordova/build: Command failed with exit code 1
You may not have the required environment or OS to build this project
Error: .../cordova_project/platforms/android/cordova/build: Command failed with exit code 1
    at ChildProcess.whenDone (.../cordova/cordova-cli/5.1.1/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:134:23)
    at emitTwo (events.js:87:13)
    at ChildProcess.emit (events.js:172:7)
    at maybeClose (internal/child_process.js:821:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)

//////////////////////////////////////////////////////////////////////////

Could someone please help me?
I'm using CLI 5.4.1 but I got errors even on CLI 5.1.1

 

0 Kudos
5 Replies
PaulF_IntelCorp
Employee
553 Views

Antonio -- usually the information that lead to the error is located above the point in the build log that you pasted into your post. Can you attach the entire detailed build log to your post (save it as a text file and attach it using the "Attach Files to Post" link below the forum edit window) so we can look more closely at the build problem.

0 Kudos
Antonio_Za
Beginner
553 Views

Thank you Paul, here is the complete debug log attached.

0 Kudos
PaulF_IntelCorp
Employee
553 Views

Antonio -- definitely appears to be something regarding your custom plugin. I'm not able to say precisely what is going wrong, I'm not an expert at building Cordova plugins, but these lines appear to be the critical element:

Running command: .../cordova_project/platforms/android/cordova/build --debug --buildConfig=.../cordova_project/build.json
ANDROID_HOME=.../android-sdk
JAVA_HOME=/usr/lib/jvm/java-8-oracle-amd64
Reading build config file: .../cordova_project/build.json
cp: copyFileSync: could not write to dest file (code=ENOTDIR):.../cordova_project/platforms/android/cordova-plugin-printers-fusion/xwalk16-customandroidapi.jar/build.gradle

Running: .../cordova_project/platforms/android/gradlew cdvBuildDebug -b .../cordova_project/platforms/android/build.gradle --no-daemon
embedded
org.xwalk:xwalk_core_library:16+

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Cannot evaluate module customandroidapi.jar : Configuration with name 'debug' not found.

In particular, the part about the 'debug' configuration (earlier you'll see that the build command is including a --debug option). My guess is there is some requirement to include a 'debug' configuration in your JAR file (probably a variant of the library that includes debug symbols) to make this step work.

It appears that you are trying to build for the Debug tab. Is this correct? What happens if you simply build with the Build tab? Do you get the same results? Try building with and without Crosswalk optimizations turned on.

0 Kudos
Antonio_Za
Beginner
553 Views

Here are the two logs, for the Build tab, with and without CW.

It seems to me that the bug is still the same.

Should I ask the lib developers to change something? Theirs Android native samples work under Eclipse but not under Android Studio, I dind't be able to use it in Android Studio for some gradle lack.

0 Kudos
PaulF_IntelCorp
Employee
553 Views

Antonio -- if their sample app cannot be built using Android Studio (which is what Cordova CLI utilizes) then the XDK will also not be able to build it, because our build system is standard CLI, which relies on Android Studio. I guess the acid test would be to install Cordova CLI and see if you can successfully build a project using that. This requires that you also install Android Studio on your system.

0 Kudos
Reply