How to convert a specific android project built with ant to gradle? - java

I am using this framework for one of my projects and i have problems keeping it up to date. It is a little old, uses ant to build the components and is meant for eclipse. I usually use android studio and use gradle to build from interface(not command line).
The project has a host and plugins that are loaded from a server. The plugins are compiled from the command line cmd from windows using "tools/update.sh workspace" and "ant release" commands.
What i succeded so far:
I manually copyed the files from the host component and succeded without too much stroogle to do an android studio project and build it with no errors. And it succesfully loading the plugins.
On the plugin side I have to projects: for every new plugin i do a special android studio project and after everything is ok I adapt the code and copy it to a special template like eclipse project(i edit it with notepad++ no need for eclipse) and i build it with "ant release". That apk then i move it to server.
You see now that it is a little strange but somehow I made it to work. Problem is I'm always on the edge, I almost make it every time with little hacks to pass the build process. I think it is because i work in a mixed situation. I want to port everything on android studio and gradle. And hopefully build everything from the android studio command line.
The host builds in a jar file and is used in the plugin build.
I will put the new source code on request, till then you can see it in action here
To be more specific, the impassable bug appeared when i used MediaPlayer on the plugin. I had to move the wav files on the host witch is opposed to the framework design. But this is anyway the tip of the iceberg. So i would like to port everything from ant to gradle, and eclipse to android studio.
Thanks for your help.

If you have any existing project open in your Android Studio then just close that project. After your project is closed, it will show you a Welcome screen popup, there you can select Import Project option and it will automatically convert your project into Android Studio Project.
Here is what it will look like

Related

Is there a way to deploy Libgdx Desktop application with Android Studio (An IntelliJ Idea based IDE)

I have read this article about deploying libgdx application on linux, windows and macs.
However, it only describes how to export using eclipse. I am currently using Android Studio and it deploys android *.apk files very nicely. And I intend to keep using this. However, I had not figured out a way to deploy the desktop version of the project.
Can anyone tell me how to deploy a Libgdx Desktop application with Android Studio (or Intellij Idea because they are pretty much the same).
you can simply click on Gradle panel in the right, select :desktop, press the Execute Gradle Task, type dist and press enter, that's it.
Jar is located in /desktop/build/libs.
lbalazscs gave you a more detailed answer, so i recommend you doing what he said.
Yes, tell Gradle to build a jar for you. Here's how.
In Android Studio you can start the Gradle tasks from the GUI on the right side. Anyways, I recommend you to learn first without an IDE.
You can setup Android Studio to run the desktop version by setting up a new run configuration. Then you can run the desktop version just like you would the Android version.
Follow this link: Configuring a libGDX project to run as a desktop application in Android Studio.
In GUI we can do it.
Menu: Run -> Edit Configurations -> Add New Gradle Configurations
Gradle project: choose main Gradle project
Taske : gradlew desktop:dist
Then Run this configuration.
From this link:
exporting-a-libgdx-game-as-executable-jar-from-android-studio
A simple way of deploying on windows is to make a jar using gradle with the command gradlew desktop:dist in terminal. A similar command can be used on Linux as well.

How to install Cordova plugins in Netbeans IDE? 8.0

I'm just getting into javascript development so please bear with me.
I'm trying to install the SpeechRecognizer plugin into Cordova/a Cordova project (which is built into Netbeans IDE 8.0 )
and I really don't know where I have to begin. Could somebody help me out with this? How do install the plugin, how do I call the function? How do I get a string or array returned to me conntaining what the speech recognition picked up?
Thanks so much, I'm a total noob.
The plugin is SpeechRecognizer - https://github.com/poiuytrez/SpeechRecognizer
You can do following:
open [projectFolder]/nbproject/plugins.properties file
paste following at the end of file
SpeechRecognizer=https://github.com/poiuytrez/SpeechRecognizer.git
build project
The plugins.properties file contains list of used plugins. Some "core" plugins can be added/removed easily in project properties but for 3rd party/unknown plugins, you need to manually modify the file (it is also mentioned in project properties dialog ->Cordova->Plugins)
Edit: The pasted line could look like
com.phonegap.plugins.speech=https://github.com/poiuytrez/SpeechRecognizer.git
or
com.phonegap.plugins.speech.SpeechRecognizer=https://github.com/poiuytrez/SpeechRecognizer.git
in case of some issues (I was able to build the project with the 1st line with friendly name but in case there is some catch, try this name instead)

Errors in Android NDK Project in Eclipse IDE after Importing

I created a project that utilizes the Android NDK. It works fine in the workspace I first created it in. However if I try to import the project into a different workspace I can no longer view let alone edit any of the JNI files. The minute I open a file under the JNI folder the project stops compiling and running. Note, this occurs even without saving the file just simply opening it. This can be fixed by removing the project from the workspace and reimporting it.
This is a large hindrance if I want to have any one else work with the JNI code. They can change the Java code without issues.
IS this some weird bug with project set up, or simply a bug in the Eclipse NDK plugin?

Stuck with first time java for android

guys, with my friend started working on a school project - developing a java app for android. He started it, now it's my turn to do my job, so i got the code he already has, set up Android SDK for Eclipse and downloaded all the neccessary files and packages, but it still gives me errors and I can't even run the project.
One of the errors (the main one, I think) is that it can't import android.support.v7.app.ActionBarActivity
If anyone knows what can I do (I've tried all kinds of solutions from the internet, but none work) I would be very grateful.
Here is a screenshot of the code
http://s17.postimg.org/8aw952lha/Capture.jpg
See if you have imported the ActionBar project to your Eclipse workspace, also, right click on your project->properties->android and check that you have referenced/linked the ActionBar project there.
If you are using a repository without the proper ignore files it is possible that you have imported your partners configurations and then have the references to the auxiliary projects broken (you just need to update that).
Hope it helps.
android.support.v7.app.ActionBarActivity is a support library. This allows older versions of Android (before native support for an action bar was available) to use the action bar.
Since you are having difficulty importing it, I'd assume you do not have the support library installed.
Full instructions are available here:
http://developer.android.com/tools/support-library/setup.html
A snippet for adding support libraries to Eclipse:
Make sure you have downloaded the Android Support Library using the SDK Manager.
Create a libs/ directory in the root of your application project.
Copy the JAR file from your Android SDK installation directory (e.g., /extras/android/support/v4/android-support-v4.jar) into your application's project libs/ directory.
Right click the JAR file and select Build Path > Add to Build Path.

Issues with Eclipse while working on and Android project

I am currently developing an application with my software engineering classmates. I am experiencing a few issues with Eclipse, however. But first, some information about my Eclipse: I am running version: Juno Service Release 2 with a build id of 20130225-0426. I am running Eclipse on my MacBook with OS X Mountain Lion 10.7.5. I am using SVN to upload and download the project to a repository through assembla.com.
First, Eclipse will not recognize any errors. If I purposely type random characters, Eclipse does not underline them with red.
Next, whenever I type "this.whatever" or "# for javadoc" I receive the following message: "this compilation unit is not on the build path of a Java project." I can click "OK" and continue with no problem though.
Finally, whenever I attempt to run the program I receive this message:"The selection cannot be launched, and there are no recent launches."
Other notes: I do not have any of these issues with any of my other projects in my workspace. I also have another project using the assembla repository that does not contain these issues. These issues just occurred all of the sudden.
Edit: None of the other members in my group are experiencing these issues. I have attempted to download the project from the repository on a different machine and I still have these problems. I have attempted to delete the project from my workspace and re-download. Still a no go.
Update: I even installed the Android Development Kit and used the included copy of Eclipse. It will still not work properly.
What is going on with my Eclipse?
Since I guess you're in start phase of android coding and you're not addicted to a special IDE, I strongly recommend the IntelliJ IDEA instead of Eclipse for Android development. I have tried Eclipse already and because of its weaknesses, now I'm using IntelliJ. Eclipse is not the best IDE for Android development and have a long way to become the one.
IntelliJ IDEA
I suggest you try installing the ADT bundle in a new location and see if you still have these problems. The ADT bundle includes the latest Android SDK along with a version of Eclipse with the ADT (the Android Developer Tools plugin) already installed and configured. It's possible that you have (or have had in the past) other Eclipse plugins that affect how the Java tools in Eclipse work, possibly in a way that interferes with ADT. I have personally had problems like this in the past with tools like Aptana, where even after uninstalling there would be problems.
Eclipse is telling you already with the above error message: You don't have your sources on a build path, but just in some folder.
Either you have created a simple project instead of a Java project, which then also doesn't do anything Java specific. Or you have created your Java files in plain folders, instead of source folders.
The best way to sort this out is to create a new Java project using the Eclipse "New..." wizard from the main menu. Compare the result of that to your project. The two important things are: The project has an icon with a small "J" overlayed. The Java sources are shown in packages, which themself are in source folders (with a package overlay), not in simple folders.

Categories