iOS barcode scanning issue

77 views
Skip to first unread message

mcw

unread,
Oct 11, 2016, 7:45:39 PM10/11/16
to CodenameOne Discussions
If you are experiencing an issue please mention the full platform your issue applies to:
IDE: NetBeans
Device

I submitted a new iOS build today and found that scanning no longer works. When I click on my Scan button absolutely nothing happens. I presume you pulled the CodenameOne barcode scanning implementation.

So I am trying to switch to the cn1lib version. I went to https://github.com/codenameone/cn1-codescan  downloaded cn1-codescan.cn1lib  and put it in my libs folder. I then selected Codename One->Refresh cn1lib files.

The new file does not appear under Libraries in my project, should it?

The libs/impl folder seems to contain the scanner library.

I replaced the old includes with:

import  com.codename1.ext.codescan.CodeScanner;
import  com.codename1.ext.codescan.ScanResult;

Now my project won't compile:

R:\rware_mobile\cn1\RW\src\com\readerware\xware\readerware\RWMain.java:11: error: package com.codename1.ext.codescan does not exist
import  com.codename1.ext.codescan.CodeScanner;
R:\rware_mobile\cn1\RW\src\com\readerware\xware\readerware\RWMain.java:12: error: package com.codename1.ext.codescan does not exist
import  com.codename1.ext.codescan.ScanResult;

I think I am missing something obvious here but have no idea what.

Thanks



Shai Almog

unread,
Oct 11, 2016, 9:26:39 PM10/11/16
to CodenameOne Discussions
This was announced quite a while back (3.3 release if I remember correctly). We need to to do it to increase iOS portability as the scanning lib had bitcode issues.

Is it possible you downloaded the HTML link to the file and not the library binary?
Delete that file.
Make sure your plugin is updated.
Right click the project select "Codename One -> Codename One Settings -> Extensions" type scan and install.

mcw

unread,
Oct 12, 2016, 6:54:08 AM10/12/16
to CodenameOne Discussions


On Tuesday, October 11, 2016 at 6:26:39 PM UTC-7, Shai Almog wrote:
This was announced quite a while back (3.3 release if I remember correctly). We need to to do it to increase iOS portability as the scanning lib had bitcode issues.


I knew it was coming but as your implementation still worked...


Is it possible you downloaded the HTML link to the file and not the library binary?
Delete that file.

It looks like a binary file, 2,626,544 bytes long. libs/impl starts out as just empty folders and after the refresh has all the code including  lib\impl\cls\com\codename1\ext\codescan\ScanResult.class


Make sure your plugin is updated.

I have the latest, 3.5.5
 
Right click the project select "Codename One -> Codename One Settings -> Extensions" type scan and install.

I did this and Update was displayed next to the scanner library, I updated and refreshed but no difference.

I have three CodenameOne apps so far I had only added the scanner library to 1. I now added it to the other two by downloading from extensions and refreshing, same problem.

The compiler cannot find the includes, yet the class files are there under libs/impl with the correct package name. Is there some change I need to make to the build file
 
 

mcw

unread,
Oct 12, 2016, 8:17:06 AM10/12/16
to CodenameOne Discussions
My CodenameOne Netbeans projects date back to 2012 and I began to think that might be the problem.

I created a new CodenameOne project in Netbeans, just the basic Hello World. I used CodenameOne settings to install the scanner cn1lib and refreshed.

I added the imports to the MyApplication.java and the project compiled without a problem.

So it looks like it is something about my projects that is causing this. Any ideas?


The build is failing in the pre-compile target.. I added <echo>CP=${javac.classpath}</echo>  to the build.xml file and built my app:

CP=lib/CLDC11.jar:lib/CodenameOne.jar:lib/CodenameOne_SRC.zip:override

Made the same change to the new project build.xml:

CP=lib/CLDC11.jar:lib/CodenameOne.jar:lib/CodenameOne_SRC.zip:override:lib/impl/cls:lib/impl/stubs

So it looks like ${javac.classpath} is the problem, where is that getting set?

mcw

unread,
Oct 12, 2016, 8:50:04 AM10/12/16
to CodenameOne Discussions
OK, so ${javac.classpath} is defined in nbprojects/project.properties. Mine was last updated about a month ago. I manually changed the classpath settings and I can now compile.

However when I run my app in the simulator I get a class not found exception for the barcode scanner whereas the new application is able to find it.

So it is not just the class path that is messed up. I backed ot my changes and will wait until I hear from you.

Shai Almog

unread,
Oct 12, 2016, 9:48:58 PM10/12/16
to CodenameOne Discussions
We didn't have a choice to remove it once we came out with xcode 7.x support. It was problematic there.

Did you when you save in Codename One Settings does it prompt you to update the build.xml?
Did you update it?

If this is a really old project then just create a new project and look at the classpath in the project preferences for the new project. Make sure it matches the classpath of the old project.

mcw

unread,
Oct 14, 2016, 11:12:27 AM10/14/16
to CodenameOne Discussions


On Wednesday, October 12, 2016 at 6:48:58 PM UTC-7, Shai Almog wrote:
We didn't have a choice to remove it once we came out with xcode 7.x support. It was problematic there.

Did you when you save in Codename One Settings does it prompt you to update the build.xml?
Did you update it?

The only time I have ever been prompted to update build.xml is when updating the plugin. I always do it. I do not get prompted to update build.xml when installing an extension. My build.xml file was updated earlier this week when I updated to the latest plugin. My project.properties file was last updated an the end of September.

While I was looking in the nbproject folder I noticed that build-impl.xml was dated from 2012. It doesn't look like it was ever updated. Will this be a problem?

If this is a really old project then just create a new project and look at the classpath in the project preferences for the new project. Make sure it matches the classpath of the old project.

I did that, see above, I was able to fix the classpath problem but I still could not run the app in the simulator. I get class not found errors. I was hoping there was a way to force an update.  I will go back and compare the two and see if I can get everything working.

Shai Almog

unread,
Oct 14, 2016, 10:41:24 PM10/14/16
to CodenameOne Discussions
Sorry I misunderstood this as a change to the build.xml.

The impl file is an internal part of NetBeans so it's hard to tell what sort of effect this would have.
I'm a bit stumped with this as we changed a lot of things since 2012 but I can't think of anything that would impact this. Are you using any cn1libs?

After using refresh libs is the cn1lib expanded under the lib/impl hierarchy?
Is that hierarchy in the classpath for compilation?

mcw

unread,
Oct 15, 2016, 11:00:26 AM10/15/16
to CodenameOne Discussions


On Friday, October 14, 2016 at 7:41:24 PM UTC-7, Shai Almog wrote:
Sorry I misunderstood this as a change to the build.xml.

The impl file is an internal part of NetBeans so it's hard to tell what sort of effect this would have.
I'm a bit stumped with this as we changed a lot of things since 2012 but I can't think of anything that would impact this. Are you using any cn1libs?

No, this is my first cn1lib
 

After using refresh libs is the cn1lib expanded under the lib/impl hierarchy?

Yes
 
Is that hierarchy in the classpath for compilation?

No
 

mcw

unread,
Oct 15, 2016, 2:28:05 PM10/15/16
to CodenameOne Discussions

I was able to get this working. I had to update the javac.classpath and the run.classpath in project.properties. Then I was able to compile and test. Everything seems to be working as before.

Shai Almog

unread,
Oct 15, 2016, 10:42:14 PM10/15/16
to CodenameOne Discussions
Great!
Reply all
Reply to author
Forward
0 new messages