Hello dear Codename One Community,
I've written a class in which is use the package javafx.util.Pair.
When I want to build the application I get no Errors.
But sending an Android build to the server fails. In the Error Log file i found following line:
"Warning: com.mycompany.myapp.Main: can't find referenced class
javafx.util.Pair"
Does this straight up mean that the javafx.util.Pair class is not available for the use in Codename One ?
Thanks in advance & kind regards
Codename One doesn't support the full Java API and doesn't support JavaFX. I'm guessing you changed the classpath of the project, that won't work and would trigger errors when you try to actually build the project.
You need to adapt your project to work with the Codename One API's and JDK subset. The logic for this is explained in this article.
Related
I just started Android Development yesterday and just finished with my first Activity. On running it, I'm getting errors like
**Error:(4, 37) error: package android.support.design.widget does not exist**
As I never post without it, I've already done plenty of searching on this. Basically, what I've understood is that it couldn't find that Widget Package on my PC. So, do I have to download it? If yes, then how?
People on internet had similar problem with Packages and almost every post has different answer to this. Some say change your Gradle File others say Update your Studio (have done it).
Any kind of explanation or bit of knowledge with the solution would be highly appreciated. I'm a kind of geek who want to get concepts and basics clear. So, it would be great if you include the reason and technicality behind this too with your answer. Thanks. :)
It's a design library for Android apps development and as #Dominique pointed have a look at that page and copy paste that compile 'com.android.support:design:22.2.0' line in your project gradle file and press the sync button. Your project will sync in a few moments and the design library will be downloaded. Now you can use this library and there won't be any errors.
No, in Java "package" is not a "library" or a "piece of software" (like it is in some other languages). Package is what classes belong to - you might think of packages as directories containing Java files (it is a simplification, but it works). In Java libraries are packaged into (usually) "jars" (those jars usually contain classes divided into packages), so what you need to download is "jar".
So, first thing you need to check is: what library contains the package, and configure your IDE accordingly. The package in question belongs, I think to the so called android support library, which you can install using the SDK tool.
I'm working on a NetBeans project and can't seem to get my website to run properly because my internal Apache Tomcat server keeps returning an error that it cannot load the FacesServlet class. Which available library contains this? Currently I have the Java EE Web 7 API and Java DB libraries loaded on.
You use service like findjar to find jars that contain some class:
http://www.findjar.com/class/javax/faces/webapp/FacesServlet.html
Oh, just now found out it was under the JSF 2.2 library! Sometimes it just pays to ask to think more about it! :)
I made a small project using Scala (SBT + IntellijIDEA) that provides me a set of classes and other functions that I want to use in Android. I will call this project $core.
So, keeping that in mind I tried to first only use scala. I tried to create an Android Project using android-plugin and I got it.
But what I really want is to use my $core in an Android Project AND expand the $core classes using Java. $core provides an API that I would like more people to use and they probably don't know Scala so Java would be perfect. Besides, I need to go into a safe route with Android. I saw some info that scala takes a lot of time to compile into Android and has some limitations (like with parceblles).
I already tried to use the classes in eclipse with the import class folder option. I even tried to generate a jar so at least I would have a way to run it and no success. Always the NoClassDef error when I try to use one class from the $core. I have tried to import also the scala compiler library, but didn't work out aswell...
Core isn't finished yet and I would like to develop on a single environment that allowed me to debug on the android device. How can I setup all of this?
PS: Changing to eclipse now maybe is better? Never tried android on intellijIDEA and In scala I can't debug over there, at least using ScalaCheck...
Is it possible that you are getting an noclassdeffound error when working with Scala code from java because you didn't add the Scala library to the java project or at least included the party of it that it's used in the Scala code in the jar?
Could you post the rest of the error?
You could package the core to .jar together with Scala library, use Proguard to remove all unused Scala library classes from it, and then use that jar as a regular library.
I am trying to add a new framework in Android Source code and call my applications using that framework.
I have included my framework files and called the functions. Makefile for the application includes the new framework. Everything compiles. But when I run my app it force closes. All the Xml layouts and java classes are fine. Manifest file includes
<user-library android:name="frameworkName">
My question is where to have the mapping for this "frameworkName" in android base code so that it is able to figure out the framework folder/path. Which looks like to be the main problem
What are the possible steps to make this work as I am unable to run my application(Force Close).
EDIT: Initially I was getting Runtime Exception:-Class Not Found for framework classes. Moreover that error was coming up when I missed the "user-library" tag. Now after adding the tag, my apk is not getting installed by the package manager as it is not able to figure out the the framework path.
Android Developers says this:- "the PackageManager framework won't let the user install the application unless the library is present on the user's device".
http://developer.android.com/guide/topics/manifest/uses-library-element.html
So which linking am I missing. Any guesses or help would be really helpful for me.
thanks
Instead of "frameworkName", you should put package name of your library (the one defined in the application name of your library).
If your classes (and R) are in com.example.myframework, then that's your library name.
I'm trying to play with Scala in Android but the Manifest doesn't recognizes my main/only-so-far activity.
I did the set up according to this blog post: http://novoda.com/2009/10/17/scala-on-android/ and everything works until i try to run my app, moment in which the logcat saids that it just doesn't find my Activity. the thing is all i can found about this problem is this: http://tiliman.wordpress.com/2010/02/10/android-development-with-scala/. According to this post the manifest doesn't recognizes the Activity because it ain't a Java file, so he creates a Java class that extends from Scala, which i don't think is a good solution at all.
What do i have to do to get started? I think i'm not missing anything.
According to previously asked questions, there seems to be no solution, i mean no one provided one. But i can't believe that using something like sbt is the only way to make full and substantial Android apps in Scala. Truly, no solution at all?
UPDATE: As for the answer given, i'll give SBT a try. But i still think that is necessary a more straightforward way to do it. In a Google Dev Fest i attended, Tim Bray practically said that you could jut make Android apps in Scala or in Java, naturally and without problems: i don't see how this fits with Manifest doesn't recognizing a Scala activity.
The page you're looking at is pretty old. I'd recommend using AndroidPlugin, which is built on top of SBT (https://github.com/jberkel/android-plugin). It handles building, testing, deploying to the emulator/device, etc.
I've got this building my android app, and the only java file I have is the autogenerated R.java.
With SBT you can also generate IDEA and Eclipse configurations, so you should be good to go.
The solution posted here uses the AndroidProguardScala plug-in, in which if the name of the scala file matches the name of the main activity, there is not problem to have your main activity written in scala.
https://stackoverflow.com/a/11084146/1287856