Codename one builds failing - lwuit

I am trying to port my lwuit app to codenameone.
I have used a json package in the application. (org.json.me). This package is actually part of json jar and contains classes to manipulate json files.
The application was working fine when I used to make J2ME builds with LWUIT.
In the codename one emulator also, the application is working without any issues.
When I, try to send a J2ME build to the server by right clicking the project and selecting 'Send J2ME Build', my application's build process crashes with some warnings.
Executing: javac -source 1.2 -target 1.2 -classpath C:\Users\Shai\AppData\Local\Temp\build925171746515355215xxx\tmpclasses;C:\Users\Shai\Desktop\j2me\midpapis.jar -d C:\Users\Shai\AppData\Local\Temp\build925171746515355215xxx\tmpclasses C:\Users\Shai\AppData\Local\Temp\build925171746515355215xxx\tmpsrc\GREStub.java Executing: java -jar C:\Users\Shai\Desktop\j2me\proguard.jar -injars . -libraryjars C:\Users\Shai\Desktop\j2me\midpapis.jar -outjars C:\Users\Shai\AppData\Local\Temp\build925171746515355215xxx\result\GRE.jar -target 1.3 -keep public class ** extends javax.microedition.midlet.MIDlet { public *; } -defaultpackage '' -printmapping C:\Users\Shai\AppData\Local\Temp\build925171746515355215xxx\result\obfuscation_mapping.txt -overloadaggressively -dontusemixedcaseclassnames -useuniqueclassmembernames -dontoptimize ProGuard, version 4.7
Reading program directory [C:\Users\Shai\AppData\Local\Temp\build925171746515355215xxx\tmpclasses]
Reading library jar [C:\Users\Shai\Desktop\j2me\midpapis.jar]
Warning: com.mycompany.myapp.GRE: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.GRE: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.GRE: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.GRE: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.GRE: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.GRE$8: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.GRE$8: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal: can't find referenced class org.json.me.JSONException
Warning: com.mycompany.myapp.Verbal: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal$4: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal$4: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal$4: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal$4: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal$8: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal$8: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal$9: can't find referenced class org.json.me.JSONObject
Warning: com.mycompany.myapp.Verbal$9: can't find referenced class org.json.me.JSONObject
Note: com.codename1.impl.midp.GameCanvasImplementation: can't find dynamically referenced class com.siemens.mp.game.Light
Note: com.codename1.impl.midp.GameCanvasImplementation: can't find dynamically referenced class com.motorola.phonebook.PhoneBookRecord
Note: com.codename1.impl.midp.GameCanvasImplementation: can't find dynamically referenced class com.nokia.mid.ui.FullCanvas
Note: com.codename1.impl.midp.GameCanvasImplementation: can't find dynamically referenced class net.rim.device.api.system.Application
Note: com.codename1.impl.midp.GameCanvasImplementation: can't find dynamically referenced class com.mot.iden.util.Base64
Note: com.codename1.impl.midp.GameCanvasImplementation: can't find dynamically referenced class mmpp.media.MediaPlayer
Note: there were 6 unresolved dynamic references to classes or interfaces.
You should check if you need to specify additional program jars.
Warning: there were 26 unresolved references to classes or interfaces.
You may need to specify additional library jars (using '-libraryjars').
Error: Please correct the above warnings first.
Now, i feel that the server is not finding my json package. But i need this build to succeed. I have used the classes of this jar a lot in my app. ANd now i don't want to migrate to the inbuilt json parser as I'll have to change my code a lot which I wish to strictly avoid.
1)What can I do to resolve this?
2)Can we not use third party jars in codename one?

You can't change library classpath in Codename One. Everything must be part of the source directories in order to work properly.
Codename One has its own JSON parser please read about it in the Codename One developer guide.

Related

Nuget says packages are missing, Package Manager Restore says all packages are installed

What have I done to my Solution!? D:
I'm not able to install anything from nuget anymore. At first I kept getting an error saying:
An error occurred while trying to restore packages. A root element is missing.
So pursuant to this answer on another question, I renamed all my packages folders to packages-old, started VS again and attempted a restore. The error persists and I still can't install any nuget packages.
Error List:
Severity Code Description Project File Line Suppression State
Error This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ..\packages\Microsoft.Net.Compilers.1.3.2\build\Microsoft.Net.Compilers.props.
Package Manager Restore:
All packages are already installed and there is nothing to restore.
Time Elapsed: 00:00:00.0644890
========== Finished ==========
Additionally, there's a bunch of warnings most of which say the referenced component couldn't be found:
WarningIDE0006Error encountered while loading the project. Some project features, such as full solution analysis for the failed project and projects that depend on it, have been disabled.
Warning The referenced component 'System' could not be found.
Warning The referenced component 'Microsoft.Web.Infrastructure' could not be found.
Warning The referenced component 'System.Web.Services' could not be found.
Warning The referenced component 'System.Configuration' could not be found.
Warning The referenced component 'System.Web.ApplicationServices' could not be found.
Warning The referenced component 'Antlr3.Runtime' could not be found.
Warning The referenced component 'System.Web.WebPages.Razor' could not be found.
Warning The referenced component 'Microsoft.AI.Web' could not be found.
Warning The referenced component 'System.Web' could not be found.
Warning The referenced component 'Microsoft.CodeDom.Providers.DotNetCompilerPlatform' could not be found.
Warning The referenced component 'Microsoft.AI.DependencyCollector' could not be found.
Warning The referenced component 'Microsoft.AI.PerfCounterCollector' could not be found.
Warning The referenced component 'Microsoft.ApplicationInsights' could not be found.
Warning The referenced component 'System.ComponentModel.DataAnnotations' could not be found.
Warning The referenced component 'System.Web.DynamicData' could not be found.
Warning The referenced component 'Newtonsoft.Json' could not be found.
Warning The referenced component 'System.Web.Routing' could not be found.
Warning The referenced component 'System.EnterpriseServices' could not be found.
Warning The referenced component 'System.Xml' could not be found.
Warning The referenced component 'System.Web.Abstractions' could not be found.
Warning The referenced component 'System.Web.Mvc' could not be found.
Warning The referenced component 'System.Web.Optimization' could not be found.
Warning The referenced component 'System.Net.Http' could not be found.
Warning The referenced component 'System.Net.Http.WebRequest' could not be found.
Warning The referenced component 'System.Web.WebPages.Deployment' could not be found.
Warning The referenced component 'System.Web.Helpers' could not be found.
Warning The referenced component 'System.Web.Razor' could not be found.
Warning The referenced component 'Microsoft.AI.ServerTelemetryChannel' could not be found.
Warning The referenced component 'Microsoft.AI.Agent.Intercept' could not be found.
Warning The referenced component 'System.Xml.Linq' could not be found.
Warning The referenced component 'WebGrease' could not be found.
Warning The referenced component 'System.Drawing' could not be found.
Warning The referenced component 'System.Core' could not be found.
Warning The referenced component 'Microsoft.CSharp' could not be found.
Warning The referenced component 'System.Web.Extensions' could not be found.
Warning The referenced component 'Microsoft.AI.WindowsServer' could not be found.
Warning The referenced component 'System.Data.DataSetExtensions' could not be found.
Warning The referenced component 'System.Web.Entity' could not be found.
Warning The referenced component 'System.Web.WebPages' could not be found.
Warning The referenced component 'System.Data' could not be found.
An error occurred while trying to restore packages. A root element is missing.
When you get this error, you should make sure any XML file (or any file that would be interpreted as an XML file by visual studio, especially, nuget.config, .csproj. web.config,web.config.transform, and so on) has a correct XML structure - that is, one root element, for example, the <configuration> in the nuget.config file:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>
</configuration>
To detect the source of the error A root element is missing, you can create a new blank solution with a project. Then install any nuget package, if that error still exists, you should special inspect the file, nuget.config in the folder %appdata%\NuGet. If that error disappears, the error should more related to your project files, .csproj, web.config, web.config.transform and so on.
All packages are already installed and there is nothing to restore.
Typically this error appears when the project is not loaded, so make sure all your projects in the solution are loaded when you restore on the solution.
To deal with this error, enter the following command in the Nuget console window:
Update-Package -reinstall -ProjectName Your-Project-Name
This will update all missing files.

ProGuard - unexpectedly contains class

While I'm trying to obfuscate simple DataLoader.class file in ProGuard I get this error:
Reading program directory [C:\Users\uzytkownik\Documents\NetBeansProjects\ProTest\build\classes\Files\DataLoader.class]
Warning: class [DataLoader.class] unexpectedly contains class [Files.DataLoader]
Warning: there were 1 classes in incorrectly named files.
You should make sure all file names correspond to their class names.
The directory hierarchies must correspond to the package hierarchies.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unexpectedclass)
If you don't mind the mentioned classes not being written out,
you could try your luck using the '-ignorewarnings' option.
Please correct the above warnings first.
Here is the project:
http://www49.zippyshare.com/v/14668241/file.html
I will be grateful for your help.
Warning: class [META-INF/versions/9/module-info.class] unexpectedly contains class [module-info]
This is the issue I had and I tried few options mentioned below:
-keep class module-info
-keepattributes Module*
-dontwarn module-info
The option worked for me is 3.
Not sure why but it solves my problem and I am able to make the jar.
This issue comes when you upgrade something like I upgrade the spring-boot version and the project starts failing.
Please check the maven dependencies as well.
With the options -injars and -libraryjars, you should specify the proper base directory (or jar) of your classes, just like a classpath. In this case: classes, not classes\Files\DataLoader.class.
See the ProGuard manual > Troubleshooting > Warning: class file ... unexpectedly contains class ...

unresolved symbols after converting VS2012 Windows 8 Metro solution to VS2013 (on Windows 8.1)

I have a question, which I'm currently unable to tackle effectively since I'm still unfamiliar with Metro app development. So please bear with me :)
Long story short, I have a large, complex VS2012 Metro app managed+native solution (currently built on Windows 8) into VS2013 targeting Windows 8.1.
I imported the solution into VS2013 (hosted on Windows 8.1), and run the conversion for it and all the sub projects therein. Stuff compile, but it is with the linker that we run into problems. This is an example of the linker errors we get:
error LNK2019: unresolved external symbol __imp___beginthreadex referenced in function <blahblahblah>
error LNK2019: unresolved external symbol __imp___mbsrchr referenced in function <blahblahblah>
error LNK2019: unresolved external symbol _getenv referenced in function <blahblahblah>
error LNK2019: unresolved external symbol __imp___beginthreadex referenced in function <blahblahblah>
error LNK2019: unresolved external symbol __imp___endthreadex referenced in function <blahblahblah>
error LNK2019: unresolved external symbol __imp___mbsrchr referenced in function <blahblahblah>
error LNK2019: unresolved external symbol __imp___mbsnbicmp referenced in function <blahblahblah>
error LNK2019: unresolved external symbol __imp___dupenv_s referenced in function <blahblahblah>
The thing is that for every single symbol that is 'missing', we can see the that the declaration is present in the MS Windows header files supplied with VS2013. Inspecting the references in each sub-project shows that they are referencing the Windows 'core' libs.
Any ideas why this is happening? Thanks.
we can see the that the declaration is present in the MS Windows header files supplied with VS2013. Inspecting the references in each sub-project shows that they are referencing the Windows 'core' libs
It is going to be difficult to diagnose what went wrong with this little information, but it is pretty clear that you are looking in the completely wrong corner for this problem. The missing symbols are not Windows api functions, they are C runtime support functions. They are only used in a C++ project, you've been looking at .NET projects.
So you'll need to focus on the one project that generates these linker errors, it is a C++ project. The linker command that's issued to get it to link to the .lib that has these symbols is completely automagic so there isn't much that can go wrong. The very first thing to do is to force a complete rebuild so it won't use outdated .obj and .lib files that were left over from a previous build in VS2012. Right-click the project and choose Rebuild.
And it is worth taking a look at the .vcxproj file for this project with a text editor (like Notepad) and ensure that the conversion went properly and made the correct changes:
the ToolsVersion property must be changed from "4.0" to "12.0"
the MinimumVisualStudioVersion property must be changed from 11.0 to 12.0
two new properties are added, ApplicationType (Windows Store) and ApplicationTypeRevision (8.1)
every configuration's PlatformToolset property must be changed from v110 to v120
There is a log file in the Debug\projectname.tlog directory named link.read.1.tlog that contains diagnostics, it shows all the .lib files that the linker uses. It must contain this line:
C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 12.0\VC\LIB\STORE\VCCORLIBD.LIB
Which is the .lib file that contains these symbols.

Adding Reachability class fails when I am trying to build

I have added the SystemConfiguration framework. I am deploying against targets from 3.2 and higher. Have I forgotten to add something?
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_Reachability", referenced from:
objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Okay, the clues are all in the error report you have posted.
While linking (the message is from the linker ld) which occurs after compilation of all the symbols across your project, the message is saying
"In AppDelegate, you have referenced a class object called Reachability"
"_OBJC_CLASS_$_Reachability"
and as far as the linker is concerned Reachability is undefined.
So, check that Reachability is being compiled in your project. The are a couple of ways to do this. Perhaps the most clear way is to
1 select the project file in the navigation pane
2 select the target
3 select Build Phases
4 Expand the Compile Sources section
*Now check the list of sources that will be compiled for your missing class, in your case Reachability.m
If it is missing, use the + button to add the file to the target.
Another way is to
1 select the file you think is not being compiled
2 open the utilities panel
3 select the file inspector tab
There will be a checkbox for each target in your project and you can easily see if your .m file is being compiled for each/all targets or not.
You might have forgotten to include the Reachability classes in your project!
I had a similar problem when I upgraded to the newest version of Mixpanel. The error read:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_CTTelephonyNetworkInfo", referenced from:
objc-class-ref in Mixpanel.o
You can follow Damo's solution until the last step, and then instead of expanding the Compile Sources section, you have to expand the Link Binary With Libraries section instead, and add the CoreTelephony.framework source which contains CTTelephonyNetworkInfo.
You can read more about the CTTelephonyNetworkInfo class reference on Apple's official website here: http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Reference/CTTelephonyNetworkInfo/Reference/Reference.html

Undefined symbols for architecture armv7? What does this error mean?

I just marked all of my CocoaAsyncSocket code as non-ARC code, and it's given me these 3 errors:
Undefined symbols for architecture armv7:
"_kCFStreamNetworkServiceTypeVoIP", referenced from:
-[GCDAsyncSocket enableBackgroundingOnSocketWithCaveat:] in GCDAsyncSocket.o
"_kCFStreamNetworkServiceType", referenced from:
-[GCDAsyncSocket enableBackgroundingOnSocketWithCaveat:] in GCDAsyncSocket.o
"_kCFStreamPropertySSLSettings", referenced from:
-[GCDAsyncSocket maybeStartTLS] in GCDAsyncSocket.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Does anybody know what this means and how to fix it?
I think I found the solution to this, by looking in the code comments, but I now see that it's also what Mark Adams suggested above. I had the errors until I added the CFNetwork.framework under Targets->Build Phases->Link Binary With Libraries->Select CFNetwork.framework
It means that some code you are compiling is referencing the constants "kCFStreamNetworkServiceTypeVoIP", "kCFStreamNetworkServiceType", and "kCFStreamPropertySSLSettings", but that those constants weren't found when it tried to link your code with the libraries it uses.
Unfortunately there's a bunch of reasons this could be:
You could have misspelled them
They could be #ifdef'd out for that architecture
You might not be linking the correct librar(y, ies)
They could be marked as having 'hidden' visibility so that they can only be used in the declaring library
Probably other reasons
You can use 'nm' to poke at the exported symbols from the binary of a library, and 'otool -L' to check which libraries your binary is linking.
I had this same error when integrating LineaPro API into an app.
The fix i implemented was adding ExternalAccessory.framework to General -> Linked Framework and Libraries.
I already had CFNetwork.framework included.