I have set the CLASSPATH and HOME_PATH for my JDK in the windows environment variables, do I need to set anything similar for Eclipse in order to compile Android programmes?
The problem I'm having is that Eclipse can be opened and create a program as simple as the Helloworld example, seems to be not an exact way to compile and then I can pack into any execution file so my little Android phone can install with.
Android requires more than just Java, but also the Android SDK. To get it working with Eclipse, you'll also need the Eclipse Android plugin. So, if you can run the HelloWorld program, Java is working. Follow instructions to get Android working here:
http://developer.android.com/sdk/index.html
Also, there's a couple links under the "ADT Bundle" section to just download a self-contained version of Eclipse bundled with the Android SDK to save you from installing the Eclipse Android plugin and configuring anything. You'll unzip the folder in a convenient directory, then see two folders: the Android SDK and another containing Eclipse. You can just run the Eclipse.exe in the Eclipse folder and your Android environment is good to go.
Do you have the android SDK? If not, get it here. It comes with eclipse IDE with all the required things already set up.
Related
I wanna export my app to PC and Android devices. If i create a JavaFX project with sdk 13.0 and try to export as a JavaFX application it says fx:deploy not supported. So i tried gluon plugin. But when i open a project i cant run even the empty scene. I found one tutorial on the internet how to do that, but he had inside the build.grandle some long settings, and i have only one line
apply plugin: 'base'
And i get this error every time
The project uses Gradle 4.3.1 which is incompatible with Java 10 or newer.
What is the easiest way to export java app to exe or apk ?
Creating an installer for the desktop platforms (Windows, macOS, Linux) has become easy these days. The tool of choice is jpackage which started to be shipped with JDK 14. It can either be used on the command line on the finished project or you can use a Gradle plugin (https://github.com/beryx/badass-jlink-plugin). If your project is not modularized you could follow this tutorial https://github.com/dlemmermann/JPackageScriptFX which also uses jpackage but together with Maven and some other tools from the JDK. The Maven part could easily be rewritten to Gradle, if needed.
Building for Android or iOS is another story. You will need the Gluon client-gradle-plugin (https://github.com/gluonhq/client-gradle-plugin) to do that. But I think it is rather naive to believe that an application which is written for the desktop can be used one to one on a mobile platform. Technically this would work for a hello-world like demo but not for a real application just because your environment, the form-factor and many other things are just different. So you will have to adjust your project to accommodate for that.
I've been trying to generate an Eclipse project using libGDX, in order to use it with this tutorial. However, everytime I generate the project I get the error message:
Execution failed for task ':core:compileJava'.
Could not find tools.jar
The images below show the settings I use and the messages I get.
I'm using the most recent version of Eclipse and the Android SDK. I got the Android version of Eclipse through the installation program from the Eclipse website and I got the Android SDK through Eclipse. Everything is installed in the default folders. I've got the most recent versions of both the 32 and 64 bits versions of Java.
Could anyone tell me what I'm doing wrong?
PS. My question might be similar to this question: What exactly is “tools.jar” in the Android SDK?. However, the answer to that question only applies to Android studio users.
Check your installed JDK.
You have to set the system property "java.home" and the environment variable JAVA_HOME to a valid JDK.
Check gradle.properties file at the root of your project with the following property:
org.gradle.java.home=C:\\Program Files\\Java\\jdk1.8.0_74
org.gradle.java.home needs to point to a valid JDK location.
Without this file, you get the same error (Could not find tools.jar). With the file present, this is no longer an issue.
Just add this line to gradle.properties:
org.gradle.java.home=C:\\Program Files\\Java\\jdk1.8.0_131
Is it possible to develop Android apps using only the Android SDK, without any IDE like Android Studio?
Yes, see the Google SDK documentation.
However, with the current toolchain and documentation it'll be an uphill struggle. I'm trying to do this too (for a dev who lives in Vim and Unix tools, Android Studio is needlessly slow and bloated).
The main issues I've found so far:
The SDK documentation gives instructions to create an Ant-driven project, but the SDK is now geared towards using Gradle. If you're working through the Google documentation in a linear fashion, you'll find subsequent lessons have you issue Gradle build instructions. For your Ant-built project.
There is very little documentation on how to actually create a Gradle-built project from the command line. The command line I use is:
android create project --target android-22 --name MyProjectName --path my_project/ --activity MyProject --package com.example.android.myproject --gradle --gradle-version 1.2.2
The --gradle-version actually refers to the Gradle Android plugin version, not the version of Gradle itself. Finding this out wasn't easy.
Even if you get it to create a project properly, it probably won't build without further manipulation. One of the generated files (project/build.gradle) has an invalid directive name (runProguard - I'm guessing it's now deprecated). That must be changed to minifyEnabled before the project will build. And using the Gradle plugin 1.2.2, the file project/gradle/wrapper/gradle-wrapper.properties has the Gradle distribution incorrectly listed as gradle-1.2.2-all.zip. This should be gradle-2.2.1-all.zip.
These are files generated by the SDK with errors.
The documentation is focussed on IDE-based development. Once you get past the initial few pages on creating and managing a project using the command line, it's very IDE-focussed.
Instructions on things like changing an app Theme are difficult or impossible to follow as they omit steps that the IDE performs for you.
In general, fully IDE-less development for Android (at least in Java, using the official SDK) is very painful. And my personal opinion is that IDE-based development is equally painful (slow, bloated, ugly on high-DPI screens under Linux and evidently full of magic that's a pain to replicate on the command line).
Edit: I should add that the above refers to using SDK tools v24.2, SDK Platform-tools v22, SDK Build-tools v22.01 and Android API 22 (5.1.1).
For android the basic debugging environments are:
ADB
DDMS
Java Debugger
You can try with them.
More details are here : http://developer.android.com/tools/debugging/debugging-projects-cmdline.html
Writing an Android app on Notepad is what I do on my Windows Laptop.
First you configure your laptop as follows:
Download development Kits: Download a Java Development Kit 1.6 for Windows and an Android Development Kit . Similarly try downloading older version of Android kit GUI version of Kit Manager so that you can download essentials. Using kit Manager download Android-23 platform build tools. Android Studio may have slower performance, so try to avoid it.
Configure Kits: Set Windows PATH variable by right clicking My Computer -> Properties -> Advanced System Settings or change the appropriate settings in your Control Panel. PATH should include the Java's compiler executable
file in Java directory, and the android.bat file of Android Kit.
Download Build-Tool: (recommended, but Ant can be used too.) These
programs configure the command-line tools for easy usage for our
convenience. I downloaded version 2.2.1 as it can use old
Java & old Android.
I've also written about these instructions on my GitHub Page.
For the development of Android apps one doesn't even need a PC, and not even the Android SDK. One can develop them completely on a mobile Android device, so an emulator isn't necessary either.
For that one needs to the app Termux on the device, and the toolchain script apkbuilder, which stitches together all APK building programs that come with the Termux packages aapt, apksigner, clang, cmake, d8, ecj and unzip, including the OpenJDK.
I am running Windows 7 and just upgraded my Android Studio and it is not working anymore. I get a dialog that says it cant find the jdk. I have version .9 now. I do not have admin rights so I can not edit my Enviroment Variables. Is there a way I can tell Android Studio where the JDK is. Maybe command line args? I havent found any source that outlines if there are any.
Please note that I can not run Android Studio, so I cant update it from inside the application.
Also, I do have Cygwin.
Since, Android Studio was working before and only broke after the update, please check the Studio shortcut you're using to launch the IDE. By default, Android Studio points it to studio64.exe. If you have a 32-bit Java JDK installed use the studio.exe to launch the IDE.
If that doesn't help, see if you can create a JAVA_HOME user variable? You maybe able to do that even though you have a limited account. If you are unable to do so, as a last resort, move/copy the JRE (not JDK) into the Android Studio install location (right next to bin). You need to name the folder jre or jre64 depending on which launcher you use studio.exe or studio64.exe.
I solved this. I download the Server JRE from the Oracle page. I then decompressed the gzip and untared it. I then then added to my ~/.bashrc file in cygwin "export JAVE_HOME=". Studio was able to find this.
I currently have the android sdk running with eclipse. It happens to be that I also want to download stanford's customized version of eclipse in order to learn some other stuff. Will there be a problem downloading and installing this customized version if I already another version of eclipse installed on my computer?
Nope! Just make sure you install them to different locations and (potentially) use different workspaces. Eclipse is totally self-contained in the eclipse directory (or where ever you install it).