Error while creating a Java ME mobile application - java

Im new to java ME and netbeans and Im trying to create a new mobile application, I have installed Oracle ME 8.0 SDK and activated it. I've added the platform but when I try to create a new Mobile application in the step 4 I have both Emulator plataform and Device in blank and I cant chose any other option.
Though I can still keep going with the project when I finish it I get a bunch of weird errors in my project, first one is :
-Fatal error: unable to find package java.lang in classpath or bootclasspath
-Cannot find symbol, symbol: class MIDlet

Without more details is hard to tell but it might be related to the use of classes not available on JavaME.
Check the documentation to see which classes are available and which are not here.

Related

Phonegap CLI: Android Build NoClassDefFoundError

I'm trying to create a plugin for a java library (in .jar file) to Phonegap users.
Currently, my plugin connects two methods from my library: one that uses network operations and writing to device memory and one that runs a new activity.
The one that uses network works, no problem. However, the one that runs a new activity fails in run-time with the NoClassDef.. error.
Classically, this error comes from either not declaring an activity in the manifest or from the class actually not being there (i.e., problematic build, etc..)
Post compilation & build with phonegap, i can see two things:
1) my activity is defined in the final manifest (with correct path)
2) the class is present (inside the .jar) - also, the rest of the classes from my jar can be found to be running in the stack of the error.
I'm really lost as to what directions to explore, i'm running out of ideas. Any suggestions? If you need more info let me know i'll post it up here.
I'm running the latest phonegap through npm (downloaded two days ago)
Work is done on a macintosh
The jar i'm trying to translate is working 100% under any other circumstance.
The java code in the jar is accessible since method 1 works & method 2 starts running until it tries to start an activity.
Phonegap build produces no errors (i'm running on verbose)
I'm testing on a nexus 5 Lollipop
The jar is inside the final build
I believe the activity is declared in the final build's manifest (my apkTool doesn't smoothly show the manifest as it fails completing its process)
Any help would be welcome, hoping it's not a duplicate as i've done quite a research.
Ok, all through a terrible weekend of self hate and pitty I found the reason for the NoClassDefFoundError.
A dependency needed for the activity I was trying to open was not present. This error is usually known to Android developers as most commonly happening when an Activity is not defined in the manifest file.
However, returning this error because the class failed finding its dependencies is really poor. That's absolutely not an indicative output.
Anyway, thanks for those who tried to help, I hope this somehow helps somebody, someday.

Idea + Play Framework - cannot resolve method/symbol

I use IntelliJ IDEA 12, Play 2.2.0, I have Scala plugin installed, Play 2.0 support plugin installed.
I created java play application via termina (play new). Andas you can see in this pictures I always get this error: "cannot resolve method ok()" or "cannot resolve symbol at"
http://sluchatka.kvalitne.cz/pics/1.png
http://sluchatka.kvalitne.cz/pics/2.png
I searched the web for this problem the whole day, but I didn't find solution.
Can you please help me?
The first problem (unable to resolve reference to template) is because your template probably has not been compiled by the moment (and thus IDEA does not see compiled template and can't resolve reference to it).
I usually develop Play apps having ~run command launched in Play console. So that any changes to templates are immediately compiled and changes detected by IDEA.
As for the second one it seems like a deficiency in Play IDEA plugin. It does not work seamlessly within templates I should say. Lots of glitches. The best way I found is to have ~run launched so that small problems are detected immediately.
According to intelliJ support it is better to import the command line created play 2 project using the IDE import project wizard instead.
File -> Import Project
Select play2 project location
Import as SBT project
This was due to the "play idea" command being outdated or not fully compatible with the current play 2 and scala plugins for intelliJ.
A bonus is that errors start to appear properly, we had trouble with that earlier.
I was having a similar issue with Play 2.4.2 and Intellij 14.1.4. I could run the basic "play-java" example/starter app in Intellij, even though the editor showed errors like "cannot resolve method ok()".
Here's what solves the problem for me:
Before starting, make sure your project is not open in Intellij.
Delete the ".idea" folder from your existing app, OR just create a new app using "activator new".
On the command line, cd to the app's folder and compile using "activator compile".
In Intellij, File -> Open, and select your app's folder. For the SBT import options, I left the boxes unchecked (e.g. "Use auto-import", "Create directories for empty content roots automatically", etc.) but I don't think it matters.
Once everything finishes loading, you shouldn't see the errors any more.
This click in the Project Structure is your answer.

I'm unable to get WiEngine skeleton project to run

So I'm trying to port some cocos2d iOS apps over to Android and it looks like WiEngine is the most fully featured port of cocos2d to android ( http://www.wiyun.com/web/wiengine ), however I'm having issues getting the skeleton project to run. The latest problem I'm running into is I get a "Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lcom/wiyun/engine/skeleton/Skeleton" error in the ADB. I'm trying to run it in the emulator which also may be an issue. I'm kind of stuck because i need to see if I can get certain things to work (particle effects etc) before i can justify a hardware purchase.
Originally I tried to import the Skeleton project into eclipse but ran into too many errors so i created a blank android project with the same package name as the skeleton project and added the libraries to the build path through properties>libraries>add external Jars
the project compiles but it crashes as soon as it tries to initialize the Skeleton class here is the console stuff:
http://pastebin.com/XAc0XYiA
Appreciate any help on this.
Thanks,
Nick
You have to include JNI accessible precompiled libraries to you project. You can find them on the SDK archive.
For running your WiEngine Projects you have to add the WiEngine Library which is available when you download it from Github.
https://github.com/stubma/WiEngine
You can add library:
Right click on your Project-> Properties->Android->Library->Add WiEngine

Debugging in JavaMe (Midlet or JAD)

I can debug my application as "Emulated Java Me Midlet" or as "Emulated Java Me Jad". What is the difference between those types? Right now my app is only working in debug as emulated java me jad.
When I run it as midlet I get the following error:
Cannot create PortForwarder with
necessary parameters: Failed to get
device id for "null"! Syntax:
emulator [arguments]
In order to get commands supported by
given device run: emulator.exe
-Xdevice: -Xquery
Does someone know how to solve this?
The "null" device ID suggests that there probably is a configuration issue at play here. I'd suggest checking Debug Configurations->Emulation tab and checking that all's well there.
It's also possible that this you've encountered this known issue: https://blogs.oracle.com/javamesdk/entry/eclipse_java_me_sdk_issue:
If you have had issues with running your MIDlet in Eclipse + MTJ (Eclipse ME), then this article is relevant to you.
We found out that "Run as emulated MIDlet" option is not supported by Java ME SDK 3.0.5. "Run as emulated MIDlet" means that you are executing a specific MIDlet in the jar file, where jar file contains more than one MIDlet.
Please use "Run as emulated Java ME JAD" option instead...
JAD = Java Application Descriptor. JADs are used for over-the-air (OTA) deployment. A JAD specifies one or more MIDlets to install on a device.
You've probably not configured the MIDlet deployment option correctly for the emulator. Read through the docs here.

Conversion to Dalvik format failed error for Android Grid View

I'm on the android bandwagon and started going through google's "view" tutorials. Here is what I'm using:
Eclipse Galileo
Android SDK 2.1
Java SDK 6.Something I think.
Everything was hunky-dory until I hit the grid view tutorial. I got errors all over the place when I started editing the "HelloGridview.java" File. I thought I'd fix it by following through with the next part of the tutorial, creating the ImageAdapter class, but it created more. I realized alot of my issues could be resolved by importing widgets which were not mentioned in the tutorial (i.e. android.widget.GridView, .ImageView, .BaseAdapter etc.) However, after all the reconciliation suggested by eclipse the files were finally showing no errors. I go to run it as an android app and bam, "Your project contains error(s)." window comes up. There are no errors showing on the files I've created. I cleared the error log and shut down eclipse and started again the error log now reads: Conversion to Dalvik format failed with error 1. I'm a little lost at this point. I think I've included the required information. If you need to know more let me know.
Any help is appreciated.
I had the same problem. Eclipse imported a jar in the java build path and this somehow caused the error.
Right Click o the project -> Java Build Path and make sure you have only once imported android.jar.
Some of those examples on the Android developer site are a trifle out of date, and so it may be that the one giving you grief is no longer a great example to work from.
Try this GridView sample for something that definitely works on current versions of Android.

Categories

Resources