Closed tip2000 closed 5 years ago
Hi! Thank you for using my plugin. By the way, it seems that gradle can't find the rel.aar that is needed to start the Sunmi service. I don't exactly know how Monaca handles project's file, could you send me the file-tree? With that, I may do a little bit of investigation. The first thing you can do is to ask them if their app supports plugins that need any aar files.
Thank you for your reply.
I send the file-tree as an image. Can you check it?
I contacted the Monaca support team and suggested a method to specify an external file with the gradle file, so it seems possible to install the aar file.
I described external URLs in gradle's repositories as follows. I do not understand how to describe the part beginning with "file:" and it takes time.
repositories { jcenter () google () flatDir { dirs 'src / main / libs' } }
Thank you.
Hi
I edited the Gradle file and the plugin.xml file and no longer got an error when built. (Gradle file edited repositories and dependencies.plugin.xml added two lines of resource-file.) However, window.SunmiCardReader.startReadCard () can not operate properly when actually running the application. (I am writing a process to read Mifare.) I am wondering if there is a problem with how to describe it, but I set the array as 8 in the argument, but I do not know what is wrong.
First of all, we will send a Gradle file and a plugin.xml file, considering the possibility that the description at the time of the built-in is wrong, so if you have an incorrect place in the description, can you tell me?
Also, is there a description for reading Mifare below? I want to read Mifare's UID (IDm).
var cardtype_list = new Array (8); window.SunmiCardReader.startReadCard (cardtype_list) .then (
window.SunmiCardReader.authMifare ("", 0, 0) .then (function (payload) {
window.SunmiCardReader.readBlockMifare (5) .then (function (payload) {
// // omitted //
}). catch (function (error) { alert (error); });
}). catch (function (error) { alert (error); });
). catch ( function (error) { alert (error); } );
Thank you for your help. gradle_and_plugin.zip
Hi
From the monaca build error, it seems almost certain that it is a matter of writing Gradle files and plugin.xml files. However, no matter how many times you rewrite it, the error will not go away.
https://jcenter.bintray.com//rel//rel-.pom https://jcenter.bintray.com//rel//rel-.aar https://maven.google.com//rel//rel-.pom https://maven.google.com//rel//rel-.aar
How do I write these settings in Gradle file and plugin.xml?
---------- Build log from here ------------
Discovered plugin "sunmi-card-reader" in config.xml. Adding it to the project Installing "sunmi-card-reader" for android Error during processing of action! Attempting to revert ... Failed to install 'sunmi-card-reader': CordovaError: Uh oh! "/private/tmp/monaca/5bcf3ee0e788851c6dfc3c0f/project/plugins/sunmi-card-reader/https:/jcenter.bintray.com" not found! at copyFile (/private/tmp/monaca/5bcf3ee0e788851c6dfc3c0f/project/platforms/android/cordova/lib/pluginHandlers.js:219:36) at install (/private/tmp/monaca/5bcf3ee0e788851c6dfc3c0f/project/platforms/android/cordova/lib/pluginHandlers.js:74:13) at ActionStack.process (/private/tmp/monaca/5bcf3ee0e788851c6dfc3c0f/project/platforms/android/cordova/node_modules/cordova-common/src/ActionStack.js:56: 25) at PluginManager.doOperation (/private/tmp/monaca/5bcf3ee0e788851c6dfc3c0f/project/platforms/android/cordova/node_modules/cordova-common/src/PluginManager.js:114: 20) at PluginManager.addPlugin (/private/tmp/monaca/5bcf3ee0e788851c6dfc3c0f/project/platforms/android/cordova/node_modules/cordova-common/src/PluginManager.js: 144: 17) at /private/tmp/monaca/5bcf3ee0e788851c6dfc3c0f/project/platforms/android/cordova/Api.js:243:74 at _fulfilled (/private/tmp/monaca/5bcf3ee0e788851c6dfc3c0f/project/platforms/android/cordova/node_modules/q/q.js:854:54) at self.promiseDispatch.done (/private/tmp/monaca/5bcf3ee0e788851c6dfc3c0f/project/platforms/android/cordova/node_modules/q/q.js:883:30) at Promise.promise.promiseDispatch (/private/tmp/monaca/5bcf3ee0e788851c6dfc3c0f/project/platforms/android/cordova/node_modules/q/q.js:816:13) at /private/tmp/monaca/5bcf3ee0e788851c6dfc3c0f/project/platforms/android/cordova/node_modules/q/q.js:570:49 Failed to restore plugin "sunmi-card-reader" from config.xml. You may need need to try adding it again. Error: Uh oh! "/private/tmp/monaca/5bcf3ee0e788851c6dfc3c0f/project/plugins/sunmi-card-reader/https:/jcenter.bintray.com" not found!
Discovered plugin "sunmi-card-reader" in config.xml. Adding it to the project Installing "sunmi-card-reader" for android Error during processing of action! Attempting to revert ... Failed to install 'sunmi-card-reader': CordovaError: Uh oh! "/private/tmp/monaca/5bcf41f4e788859a4bb32b7d/project/plugins/sunmi-card-reader/https:/maven.google.com" not found! at copyFile (/private/tmp/monaca/5bcf41f4e788859a4bb32b7d/project/platforms/android/cordova/lib/pluginHandlers.js:219:36) at install (/private/tmp/monaca/5bcf41f4e788859a4bb32b7d/project/platforms/android/cordova/lib/pluginHandlers.js:74:13) at ActionStack.process (/private/tmp/monaca/5bcf41f4e788859a4bb32b7d/project/platforms/android/cordova/node_modules/cordova-common/src/ActionStack.js:56: 25) at PluginManager.doOperation (/private/tmp/monaca/5bcf41f4e788859a4bb32b7d/project/platforms/android/cordova/node_modules/cordova-common/src/PluginManager.js:114: 20) at PluginManager.addPlugin (/private/tmp/monaca/5bcf41f4e788859a4bb32b7d/project/platforms/android/cordova/node_modules/cordova-common/src/PluginManager.js: 144: 17) at /private/tmp/monaca/5bcf41f4e788859a4bb32b7d/project/platforms/android/cordova/Api.js:243:74 at _fulfilled (/private/tmp/monaca/5bcf41f4e788859a4bb32b7d/project/platforms/android/cordova/node_modules/q/q.js:854:54) at self.promiseDispatch.done (/private/tmp/monaca/5bcf41f4e788859a4bb32b7d/project/platforms/android/cordova/node_modules/q/q.js:883:30) at Promise.promise.promiseDispatch (/private/tmp/monaca/5bcf41f4e788859a4bb32b7d/project/platforms/android/cordova/node_modules/q/q.js:816:13) at /private/tmp/monaca/5bcf41f4e788859a4bb32b7d/project/platforms/android/cordova/node_modules/q/q.js:570:49 Failed to restore plugin "sunmi-card-reader" from config.xml. You may need need to try adding it again. Error: Uh oh! "/private/tmp/monaca/5bcf41f4e788859a4bb32b7d/project/plugins/sunmi-card-reader/https:/maven.google.com" not found!
Thank you for your help.
Hi! I'm terribly sorry for the delay but I was recently hospitalized. By the way I analyzed the problem and I think you should in the first place remove lines 53,54 from plugin.xml. `
` Take a look at the plugin.xml from the repo for any reference on what should be there.
About reading mifare, I recently lost the official doc (If you want I'll try to recover it somehow) and I can't help you, but you may try with small numbers (0 to 8), since this number should be the sum of multiple Cardtypes.
Sorry for the delay, I hope I've been helpful. Thanks for using my Lib.
Thank you. Please take care of yourself.
The application can now be built. It was confirmed that even if I looked at the contents of the apk file, plugins were added.
However, this time, a runtime error appeared at the time of launching the application, so that the application fell down.
When I asked Monaca's support, I was asked to confirm the corresponding Cordova version and Android platform version. They said that because the folder structure is different depending on the version, it is necessary to confirm consistency.
Could you tell me which Cordova version and Android platform version this plugin supports?
I would like to use the Android platform at 6.4.0.
Thank you for your help.
I've developed this plugin using a P1 with Android 5.1 on it. So I never tried with other versions, but I saw that the Sunmi SDK(rel.aar file) has BuildTarget = 22 (so Android API 22). About the Cordova version, I think it supports even the latest version.
Hi
Thank you for telling me about version information.
Since I could not solve the problem by monaca by all means, I am preparing cordova's environment right now and reworking the application.
Plugins could also be installed and built. However, window.SunmiCardReader ... is not working.
$ cordova requirements
You have been opted out of telemetry. To change this, run: cordova telemetry on.
I attached my project file. Please let me know if there are strange points as to how to use window.SunmiCardReader.
Thank you for your help. MyApp.zip
Hi
window.SunmiCardReader no longer becomes undefined. Thank you very much for helping me.
Now I am writing a process to read the UID of Mifare card, I can not confirm that window.SunmiCardReader.startReadCard is working properly.
window.SunmiCardReader.authMifare ("", 1,5) -20001 returns as return value.
Do you have a sample source that you have proven to work with?
Thank you for your Help. index.html.txt
Hi! sorry for may lateness.
I've checked your HTML JS code and I see that you try to auth subsequently to the reading.
You should actually see how Promises in JS works, here's a good starting point
(If you want to overlook that link here is how it should be used)
There you should use this library as if it were a step by step process. Let me explain.
Do in this order:
But each of these step should be done only AFTER the previous one has finished, so the code should be like this:
window.SunmiCardReader.startReadCard([8])
.then(function(payload){
alert("ok:" + JSON.stringify(payload));
return window.SunmiCardReader.authMifare("",0,1)
})
.then(function(payload){
alert("ok1:" + JSON.stringify(payload));
return window.SunmiCardReader.readBlockMifare(5)
})
.then(function(payload){
alert("ok2:" + JSON.stringify(payload));
})
.catch(function (error) {
alert("ng:" + error);
});
Using the functions like this (with promises) you are sure that the correct flow is being followed.
Actually is not really explicit how it should be used, thanks for your support! Hope it helps you
Hi need help! I have same problem, not could build my app. thanks
Hello Thank you for a wonderful plugin.
I had my app developed by monaca use a plugin, but I get an error at the built-in and I can not move forward from here. Could you tell me what is the cause?
---------- The following is the log. ----------
postBuild - Build Error: Error: Sandbox Exec Error: [ FAILURE: Build failed with an exception.
What went wrong: Could not resolve all files for configuration ':debugCompileClasspath'.
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Get more help at https://help.gradle.org
BUILD FAILED in 6s Error: /private/tmp/monaca/5bc85de0e78885187e92059d/project/platforms/android/gradlew: Command failed with exit code 1 Error output: FAILURE: Build failed with an exception.
What went wrong: Could not resolve all files for configuration ':debugCompileClasspath'.
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Get more help at https://help.gradle.org
BUILD FAILED in 6s ]
Thank you.