Compiling android .apk by java code - java

I would like to create a java app that actually programaticlly compiles a differnt android project - Meaning i'd like to create .apk files by code. How would i go about this??? Is this feasible?
Thanks

Sure, it could be done. If there is a way to build an Android project by command line, you can make those calls with Java I'm sure. See this and this link for information on building Android programs from the command line. From there, its simply invoking the correct commands in Java, maybe using Runtime.exec().
This will require a good understanding of the build process, and will most likely get very cumbersome. So an answer to your question as to whether or not it is feasible: no, it would be difficult.
You could use Ant to automate your build process.

Related

How do I turn my chess engine into an executable file

I have this chess engine i wrote in java. Thing is, I need to make a exe application that can take commands following a certain protocol (UCI). Ive had many problems trying to get this to work, but ill keep this brief and share the most important ones.
Other engines pop up cmd when you click on them, mine is just a basic java CLI (Dont know if this is a problem).
My anti virus keeps stopping me from opening the exe. Launch4j gives me a warning telling me I should sign it to prevent this sort of thing, but I dont know what that means.
So heres the deal, I know this post is word vomit, but Im truly at a loss right now. Id like general order advice on how I should approach the problem and maybe some advice on wether i should be using launch4j in the first place.
UPDATE: The reason i wanted to make an exe in the first place is because thats the format that was suggested in the lichess documentation (I wanted to upload my bot to lichess). I wrote a bat file that executes the jar file and it worked fine. Thanks to everyone for the suggestions.

Run ImageJ scripts in IntelliJ

I am an average ImageJ user who learnt to write IJ.macro and Groovy by trial and error. I did this mainly using the plain a simple script editor within ImageJ. I recently came up with IntelliJ, an amazing IDE with auto-completion and debugger. With the help of google, I was able to include the ImageJ jars, and pluggings accessible as external libraries/modules so that I can use the mentioned functionalities [by adding the path in File>Project Structure>Libraries>"+">Java>... here I selected the folders with the Jars and plugins of ImageJ].
I am, therefore, optimistic that I could achieve the last step. Rather than writing the code in IntelliJ and run with the ImageJ script tool, I was wondering if it could be possible to run a script (say with Groovy or Jython) directly from IntelliJ. Somethin like calling ImageJ when I click run. Maybe changing the Java Run Environment, or using it as VM.
Before finishing, sorry if I am saying something really odd or non-sense. I am an average Joe learning by trying.
Kind regards,
You might want to have a look at this GitHub project:
https://github.com/haesleinhuepf/run_jython_scripts_from_ide
It explains the steps required to run a script from within the IDE by starting up and using ImageJ. The tutorial focuses on Jython, but is applicable to all supported scripting languages.
In general, questions about ImageJ usage and script development are best asked on the Image.sc forum instead of here on StackOverflow.
I've never used ImageJ, but I guess your question is independent of ImageJ :-)
I you use ImageJ from java, you will have a class with a main method. Just right-click on the class and then "run" on the menu which appeared.
After your program has finished, there is a "run"-icon in the upper left corner of the small window which appeared.
I guess that's already close to running a script.
Groovy would be a better starting point for scripting (since it is partly a scripting language). You can code Groovy with the IntelliJ community edition, but for full support you need the ultimate edition. So I guess the groovy console is only available in the ultimate edition...
All other options I am aware of will not give you the auto-completion and only a poor-man's debugger (println)
Hope that helps
I don't know if people still struggle with this, it is now 3.5 years later, but if you start a script with this:
//# ImagePlus myImp
import ij.ImagePlus
ImagePlus myImp = myImp
You can use both the autocomplete of IntelliJ and the SciJava script parameters. I keep the same script file open in both ImageJ and IntelliJ. After a change in IntelliJ, I go to the script editor to run it. It automatically detects something has changed and will ask to update.
This is a bit of a hassle, but I haven't found how to get IntelliJ to execute the script in a running instance of ImageJ.

Android development with notepad-like editor and command line

I have a problem with Eclipse. It is very slow for me. My PC is an old PC and I'm not comfort with the performance. Is there any lightweight alternative to Eclipse (Available for Windows and Linux)? I want SPEED!
My ideal is to write my code in an editor like Notepad and supplement with the command line! How can I compile my code in this environment? How do I update my R.java file or build my project's configuration?
The documentation provides very nice instructions about using the command line tool. The building is performed with the aid of Ant tool. You could also use a more advanced editor than notepad (Notepad++ for example).
However, if you have a slow machine, you would suffer during development anyway. You should also forget about using the emulator for debugging. The emulator would take ages to load.
see the link managing project through command line
It provides a brief description about how to develop android app without any IDE
If you want speed, you should buy a faster computer.
It seems that you are a beginner -> I would suggest purchasing almost any java book, or visiting websites with tutorials, if you are at the stage where you don't know how to compile your code.
well, nothing holds you back to use notepad and manually compiling with javac:
http://docs.oracle.com/javase/1.4.2/docs/tooldocs/windows/javac.html
Like kgiannakakis pointed out; you'll also need the Android SDK:
http://developer.android.com/sdk/index.html

How to use JCurses in Eclipse

I'm trying to develop a program that simulates the Terminal in Linux. My problem is that I can't clear the screen in the default Eclipse console.
After a lot of searching, I've found a library called JCurses that can do the task. But I can't get it working in Eclipse.
I've searched for a tutorial, but it seems there is not.
Can any one help me how to use it?
OK, I found it.
I have used an external Java console. It's called Eric:
http://cs.roosevelt.edu/eric/console.html
It's very easy to use. It could be run flawlessly on Eclipse although it's said to be for Netbeans only.
Thanks guys very much

How can I run an app's source code that I got from the Android source code?

For all of you android devs out there that have the Android simulator running on your comp, you know that there are a few built in apps that are already installed on your 'phone'. I had an idea for an app that would utilize a function that is already being done in the spare parts app that comes already installed.
I went on to the android developer site, dug through the source code files, and found the spare parts app, and am now trying to set it up so that running it from eclipse on my machine actually runs the app in the simulator. In other words, I want to be able to make changes to and adjust some of the things in that app for my own needs. But it won't compile, because of a number of different errors.
How do I get that source code running on my local machine? Is there some special trick that I just dont know about? I thought that if I could get the source code than the rest would be easy, but it isn't being too easy.
Not knowing what the error is, it is hard to say. But there are some tricks. First, you want the entire spare parts app in Eclipse, not just the code you are interested in running. Second, right click on your project, and go down to the "Android Tools" menu. Then click on "Fix Project Properties". Do a clean on your project and hopefully that will help.

Categories

Resources