"Undefined methods for the type "error after importing Netbeans project to Eclipse Pulsar - java-me

I imported a netbeans project into eclipse ( Pulsar for Mobile Developers.Version: Helios Service Release 1, Build id: 20100917-0705).
I have two errors multiple times -
The method nextInt() in the type Random is not applicable for the arguments (int)
The method equalsIgnoreCase(String) is undefined for the type String
The project works fine in netbeans but I am unable to debug it due to OutOfMemoryError and hence the switch to eclipse.
I have seen this but it did not solve my problem.
Any other hint to solve this problem ?
Salil

This is a bug on the WTK/eclipse integration https://bugs.eclipse.org/bugs/show_bug.cgi?id=315209

1.The method nextInt() in the type Random is not applicable for the
arguments (int)
2.The method equalsIgnoreCase(String) is undefined for the type String
The above two problems were solved by compiling the code using the latest Nokia S40 SDK.
The project works fine in netbeans but
I am unable to debug it due to
OutOfMemoryError and hence the switch
to eclipse.
Java Me 3.0 SDK comes installed with NetBeans but it is missing the Java_Platform_ME_SDK.exe found in C:\Java_ME_platform_SDK_3.0\toolbar\bin. I had to remove the default J2ME platform ( C:\Program Files (x86)\NetBeans 6.9.1\mobility\Java_ME_platform_SDK_3.0 ) and add the platform installed here - C:\Java_ME_platform_SDK_3.0.
Using Java_Platform_ME_SDK.exe I increased the emulator heap size to maximum and now I am able to debug my application.
Salil

Related

worklight adapters and Groovy

Has anyone had success implementing IBM Worklight 5.0.6 Adapters using the Groovy language? Ie. Instead of calling a Java class from the JS adapter call a Groovy class. We have tried this and it seems to work most of the time but randomly we will get strange errors when invoking an adapter procedure. Ie.
Failed to create DGM method proxy : java.lang.NoSuchMethodException: org.codehaus.groovy.runtime.dgm$24.<init>(java.lang.String, org.codehaus.groovy.reflection.CachedClass, java.lang.Class, [Ljava.lang.Class;)
FWLSE0101E: Caused by: java.lang.NoSuchMethodException: org.codehaus.groovy.runtime.dgm$24.<init>(java.lang.String, org.codehaus.groovy.reflection.CachedClass, java.lang.Class, [Ljava.lang.Class;)
Unit tests executing the Groovy code run fine within Eclipse and the Groovy code seems to be compiling fine down to .class files and included in the adapter package. We're wondering if this is an issue with Groovy itself or invoking Groovy within the Worklight server container. I believe Worklight is using Rhino behind the scenes which may also be a culprit?
We are using Groovy 2.1.5 and the Eclipse plugin 2.8
did you open the .war and check if all compiled classes and libraries are actually in there?
We had the case quite often that the WL Eclipse Plugin/Build did not compile and package our Java Classes for the Adapter in the "server" folder ... they were missing in the .war file that we deployed and we got all sorts of Rhino, ClassNotFound etc. errors.
In addition to previous answer. You can always force a rebuild by selecting the project in the Enterprise Explorer or Navigator views, then select menu Project -> Clean -> Clean Projects Selected Below (the only choice should be your project).
This will clean the binaries, then rebuild your entire project.

Facebook iOS SDK: App crashes right after starting with "Symbol not found: _ACFacebookAppIdKey." only in iOS 5

Symptoms: app crashes right after starting:
OS Version: iPhone OS 5.1.1 (9B206)
Report Version: 104
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x00000001, 0xe7ffdefe
Crashed Thread: 0
Dyld Error Message:
Symbol not found: _ACFacebookAppIdKey
Referenced from: /var/mobile/Applications/C9CCEC42-DD12-40D1-91EE-965A8AC37AE4/MyApp.app/MyApp
Expected in: /System/Library/Frameworks/Accounts.framework/Accounts
in /var/mobile/Applications/1234EC42-0012-40D1-1234-965A8AC31234/MyApp.app/MyApp
Dyld Version: 199.6
This problem is specific to the MonoTouch binding for the Facebook iOS SDK, and it only happens for iOS 5.0 and 5.1. It can be reproduced by simply running the sample project on an iOS 5 device.
There's a related SO question (Facebook SDK 3.1 for iOS - runs on iOS6, but crashes on iOS 5.x) which suggests making the framework optional. As far as I know, this cannot be done from Xamarin.iOS, but the LinkWith assembly attribute in the binding already has WeakFrameworks = "Accounts AdSupport Social", which I assume is the equivalent of making those frameworks optional in XCode. So, no help there.
The problem seems to be a bug in the MonoTouch binding, Xamarin.iOS, or the Facebook iOS SDK itself. Any ideas?
It can be solved very easily..
Click on your project Targets.
then go to summary
Under Linked Frameworks and Libraries
Change Required Option into Optional of three Frameworks are :
Social.framework
AdSupport.framework
Accounts.framework
Now you can also run and check your code on iPAD or iPHONE simulator 5 or 5.1
This is a known bug which has been fixed (but the fix hasn't reached any stable version of Xamarin.iOS yet - the bug report says it'll be included in the 6.2.2 release, but that didn't happen).
Currently the only known workaround is to use an older version of the Facebook SDK.

strange InvalidCastExceptions from NSObject to NSBundle/NSUserDefaults with mono runtime 2.10.12

I seem to be having some problems after updating Xamarin/Monotouch this morning.
I updated MonoDevelop to 3.06 from whatever version was current and stable 10 days ago (sorry I can't be more specific), and Xamarin Studio to 4.0.2. I've been using MonoDevelop exclusively and have opened Xamarin Studio only now, wondering whether or not I was encountering a MonoDevelop bug.
My current MonoTouch version is:
Xamarin.iOS
Version: 6.2.1.201 (Enterprise Edition)
Hash: ed9807c
Branch:
Build date: 2013-19-03 13:42:59-0400
In either IDE, when running my app in either release or debug mode in the Simulator my app crashes with following InvalidCastExceptions:
System.InvalidCastException: Unable to cast object of type 'MonoTouch.Foundation.NSObject' to type 'MonoTouch.Foundation.NSUserDefaults'.
System.InvalidCastException: Unable to cast object of type 'MonoTouch.Foundation.NSObject' to type 'MonoTouch.Foundation.NSBundle'
These aren't the sort of casts that I'd expect to have fail on me :-)
In any case, the app compiles, transfers and runs correctly on an iPhone 4 with iOS 6.1.2 when built and installed from either Xamarin Studio or MonoDevelop
I've set the runtime target to 2.10.12, 2.10.11 and 2.10.9 (via this new Runtime Target menu option in the menus, even though it's meant to have no effect), and each time the app crashes in the same way.
This is all on code that was working correctly before the update (last week, before I went off to Iceland for a holiday and nobody touched anything while I was gone)
We don't use any third party assemblies; I've cleaned and rebuilt all assemblies but that hasn't helped. I'm about to try to narrow the problem down in a small test solution.
UPDATE 1:
Looking at the assemblies' version numbers in MonoDevelop, I see:
Assembly Version 2.0.5.0, found in /Developer/MonoTouch/usr/lib/mono/2.1
Monotouch has an Assemlby Version of 0.0.0.0.
I created a new MonoTouch project and added the first offending line to its main method:
public class Application
{
static void Main (string[] args)
{
// My real App crashes on this line with an InvalidCastException:
string s = NSUserDefaults.StandardUserDefaults.StringForKey("Login");
UIApplication.Main (args, null, "AppDelegate");
}
}
This ran fine.
UPDATE 2:
After changing the Build Options of the test app to match what we have in our real app, I get the same crash. The build options we have are:
iPhone Build -> General -> Linker Options -> Link All Assemblies
iPhone Build -> Advanced -> Use SGen generational garbage collector
iPhone Build -> Advanced -> Use SGen generational garbage collector -> Use reference counting extension.
Disabling ("Use reference counting extension") allows both the test app and my real app to run without crashing. So the problem seems to lie there.
I've updated to Xamarin Studio 4.0.2 and MonoDevelop 3.0.6
So you updated MonoDevelop 3.0.6 to Xamarin Studio 4.0.2, right ? Sadly that does not tell us exactly which version of MonoTouch/Xamarin.iOS was used before/now.
The easiest way to get exact version information is to use the "Xamarin Studio" menu, "About Xamarin Studio" item, "Show Details" button and copy/paste the version informations (you can use the "Copy Information" button).
Could you edit your question to add this ?
my app crashes with following InvalidCastExceptions:
Do you use pre-built assemblies ? If some were against MonoTouch 6.0.x (or earlier) then the strongname change (in 6.2.x) could result in two different monotouch.dll being loaded - and you won't be able to cast instances between them.
If everything is rebuilt from source (no 3rd party .dll that can't be re-compiled) could you try to make a small sample (e.g. by reducing/commenting parts of your app) to show exactly where this happens ? (if possible edit your question with the source or file a bug report).
I've set the runtime target to 2.10.12, 2.10.11 and 2.10.9
The installed system mono is a requirement to run Xamarin Studio and some tools. However application built by Xamarin.iOS does not depend on the system installed Mono. IOW Xamarin.iOS ships with it's own runtime and SDK libraries (e.g. assemblies).

Problems in Using QML Desktop Components in Release Mode

I wanted to write c++ desktop application with fine UI, so I did it in QT Creator.
Then I decided to add some UI features, and I moved to QML(QT Quick Application).
I installed QML Desktop Components according to here instructions, used import Qt.labs.components 0.1 and it worked well.but now I have to deploy my application, and I noticed that the application runs only on Debug mode, and not on Release mode. I checked, and saw that I have just the styleplugind.dll, and not the styleplugin.dll. Shortly, I have only the debug dll, and not the release one. I installed the components again,for release, and I really got the styleplugin.dll. but when I'm running my application(I remembered adding CONFIG+=release to my .pro file),I'm getting this error:
loaded for module "Qt.labs.components": The plugin 'C:/QtSDK/Desktop/Qt/4.7.4/mingw/imports/Qt/labs/components/plugin/styleplugin.dll' uses incompatible Qt library. Expected build key "Windows mingw release full-config", got "Windows mingw debug full-config"
import Qt.labs.components 0.1
^
I don't understand why I'm getting that: I have the right .dll file, and everything seems okay.
(BTW, I'm on Windows7)
What should I do??
The problem is, as the error output states, that your styleplugin.dll is still build against an incompatible Qt build (debug, expected is release).

Problems creating a Java Mobile Application project

I have installed the Netbeans 6.7 IDE with Java ME included, but cannot create a Mobile Application project from the Java ME category. When I select the project type the wizard stops at "Finding Feature" with the message:
Not all requested modules can be enabled:
[StandardModule:org.netbeans.modules.mobility.end2end.kig jarFile:C:\Program Files\NetBeans 6.7\mobility8\modules\org-netbeans-modules-mobility-end2end-kit.jar.
I am attempting to run this on Vista Home Premium. I have tried to run the IDE as Administrator with no luck.
I am at a loss for where to go next as I cannot seem to find any information regarding this issue. Even if you don't have the solution any insight into this error message would be helpful.
I am unable so far to get the project running via the Netbeans IDE install. I have, for the time being, installed the Java ME SDK which includes a very stripped down version of the Netbeans IDE for mobile development.
I originally had some issues starting the SDK as well on Vista. The IDE reported that it could not connect to the device manager on localhost. After some searching I found this link: Java ME SDK Startup Problem which suggests changing the hosts file localhost entry from IPv6 to IPv4. The fix worked perfectly and I can now compile and run code in the emulator.
This is not an optimal solution as the SDK does not include the visual design tools, however I am able to get a basic project going in the mean time.
I have given up on the 6.7 version and have instead located and installed 6.5.1. This previous version has been working just fine and seems to do everything I need.
I ran into the exact same error today while installing NB 6.8 beta. To resolve it we need to install two plugins:
Java Web Applications (as mentioned by Ali above) and
Sun Java System Web Server 7.0
Note that these two are part of the Category called "Java Web and EE" hence the confusion that we need to install Glassfish App Server. But we need these two plugins because they are required for debugging using breakpoints in emulator. Netbeans runs a web server when we do breakpoint based debugging.
Also note that the Java Web applications needs SOAP Web Services and JavaScript Debugger plugins to run and so these plugins are also installed when you try to install it.
You also need to install "Java Web Applications" plugin.
Tools->Plugins->Available Plugins
If the module is present, you should try unzipping it to check its content makes sense.
You should also be able to rebuild it from Netbeans sources.
You can also try to figure out why this happens by debugging the module loader inside Netbeans from its sources, using another IDE, presumably the latest version of Netbeans you can find without the issue.
If the module is missing, you might want to get the missing jar file from an installation of a previous version of Netbeans, see if it is compatible.
6.5.1 isn't missing any module.
back in version 5.5, the mobility module had to be downloaded and installed separately from the main IDE.
If you want to consider using Eclipse for developing your J2ME app...I've written a post related to that some time ago: here.

Resources