Android doesn't recognizes Scala activity - java

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

Related

May I add this package to my existing Java project?

I am beginning at Java GUI, so I ask you professional coders to be understading towards to my humble question.
So, I have been coding this small Java project. I came across a problem, which is to query a Json file. During my quest over the internet looking for an answer, I stumbled upon this project on github:
https://github.com/json-path/JsonPath
Which proved to be the solution for my problem. Everything I need to be able to search for specific nodes on a json file is there, hard coded.
My beginner question: Is that possible to include this 'JsonPath' in my existing project? The IDE is Apache Netbeans 10.0 and the project is a Java SE application.
Thanks in advance!
I tried searching Services->Maven repository->Find...
I happened to find this package but I have no clue how to add the package. Also, I am not sure if its possible to add it to my project.
At first I thought doing something like "com.jayway.jsonpath" to my main class would solve my problem - But obvisouly it didn't, that's why I'm asking you guys for some guidance.
You're going to want to use a dependency management tool like Gradle or Maven first. This gives you a place to put all of the third-party dependencies like this one in your project. (Note: how to use or install either of those tools is outside of the scope of this question.)
Then, you just need the Maven coordinates. Luckily the project has those coordinates available.

Codename One javafx.util.pair

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.

How to download Packages for Android Studio?

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.

Android: Adding a new framework

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.

Android application : how to manage handwriting input?

I just want to know if there is some existing libraries to manage handwriting input/recognition?
I want to develop an application in which the user could write his text with a srylus, and not with a keyboard. I did research on Google and didn't find anything efficient for that.
Thank you,
It looks like Phatware has an SDK for their Writepad product, but only on iOS.
I don't see any public libraries available, but here's an SO post about it: https://stackoverflow.com/questions/768664/recommendations-for-handwriting-recognition-libraries-packages-in-java
Finally, I use some classes who are still in development. I have included in my project a class called FingerPaint.java, GraphicsActivity.java, PictureLayout.java and ColorPickerDialog.java (optional), not really useful for me right now. You could find these different classes here: FingerPaint
I worked pretty well for me, here is an app using it: Electronic calendar on Github
MyScript algorithm for recognizing handwritting input(such as normal input, math, geometry, music). Here's the link http://myscript.com/

Categories