I'm trying to get JavaFX applications to run on Android by using the Dalvik JavaFX-Android SDK (provided by the JavaFX Android porting team). So I downloaded the samples provided by the JavaFX Android porting team and have been trying to run one of them on Android without much success.
Using Eclipse with the Gradle plugin I imported the "HelloWorldFxml" sample project. Then I ran the Gradle task "./gradlew androidInstall" on the project like the README file told me. But unfortunately the task cannot execute because Gradle cannot locate my JDK:
(source: forumbilder.se)
Even though my JAVA_HOME system variable is correctly set and I havn't had a problem with it before:
(source: forumbilder.se)
Anyone that can provide some insight as to how I can fix this?
Versions: Eclipse Luna Service Release 1a (4.4.1), Gradle 2.2, dalvik-sdk-8u40-ea3, Android SDK Build-tools 21.1.2, Android SDK Tools 24.0.2
Edit: The console output when running "gradlew androidinstall" on a sample project:
Even though the error message doesn't specify it, maybe it's looking for javac in your PATH? In case it's not in there try adding ;%JAVA_HOME%\bin to the end of your PATH variable (and restart Eclipse afterwards, I've had the problem of running processes not getting changes to environment variables before).
Check the Java setting in Eclipse:
Window -> Preferences
Java -> Installed JREs
Make sure that your JDK 1.8 is listed there. If it's not, add it using the Add... button.
Once the JDK is known to Eclipse, make sure that your project's settings use that JDK as a compiler, and the Gradle plugin should be able to pick up the setting from there.
In a pinch, you should also be able to run Gradle from the command line, and it should work fine since you already set the %JAVA_HOME% variable.
Basic Note
Since the release of dalvik-sdk-8u40-ea3, and in very short time, the JavaFXPorts team has released a few new versions, all of them simplifying all the process of porting a JavaFX application to Android or iOS.
They released dalvik-sdk-8u40-ea4 and they announced the release of a new plugin, that will simplify to the minimum the steps to create a mobile application from JavaFX.
While this answer may not help the OP in his particular problem, definitely it will help him and others, since everything is really simplified.
New approach
With this plugin, there's a new way of creating the HelloWorldFxml application for Android.
The new javafxmobile-plugin allows you to generate the apk with a single 'build.gradle' file.
You can find this an other basic samples here, and download the repository here.
You won't need to edit a single line, just type this on the command line, on the root of the sample, with your device connected:
gradlew androidInstall
As for previous releases, you will need JDK8u40 and Android SDK installed. No need for dalvik-sdk though, it's retrieved by the plugin.
Notice that you can open these samples from your IDE, so you will be able to modify them, and run them locally or build again the apk for your device.
Had this problem, too.
My proberties:
-Windows 7
-Dalvik SDK (dalvik-sdk-8u60-b5)
-JDK 8 (newest Version 8_60 / IMPORTANT: JDK not JRE)
-And I tried also the HelloAndroid project provided by the Dalvik-SDK-download.
So i execute the command line: gradlew installDebug
My probelm was nearly the same.
"Fail to find JDK. Please make sure there is a JAVA_HOME or JAVA8_HOME systemvariable."
#1
Created these proberties. Just like described in this post:
How to set java_home on Windows 7?
So to make everything sure, I created both with the same path. Cause I don't know exactly which one is used by gradle.
#2
This is really the hack that helps me out. Found this also in StackOverflow.
Write in your build.gradle under the android{..} stuff this line:
retrolambda {
jdk 'C:/Program Files/Java/jdk1.8.0_60' //<--your JDK-path
}
it looks like that
Then execute the same command line again and it worked for me.
I think only the 2. steps was the solution, cause I guess gradle don't look for the variable if there is a direct path to the jdk.
Related
Gradle does not work at all, even gradle -v after updating android studio (4.3.1). I'm not pretty sure Android Studio caused this issue or not.
I installed Gradle from sdkman. The Gradle version is 6.6.1. When I run any Gradle command in terminal, the process keep running but nothing display. The path is not an issue here. Computer recognize Gradle itself.
Do you know any ideas to fix the issue?
I already uninstall/install Gradle, remove .gradle folder, restart a computer, remove cache and stuff like that...
Android Studio likes to use it's bundled JDKs and SDKs by default and change the location of it's settings every few releases. It doesn't like when you try to customize settings to your preferences, even something as trivial as choosing your own default project save location.
Currently (in version 4.2.x), I could only find gradle path in global settings, which turns out that even if you set global setting for gradle path, you would still need to configure it per project level.
So for sake of sanity, forget global settings and configure it per project level.
There are some forum discussion which suggests that android studio automatically switched kotlin compiler or java compiler from your gradle settings, but there are some conflicting articles too.
If you try to discuss it on their forum, they will tell you it's bad decision to change jdk because of compatibility reasons, won't help you much. This is based on my multiple bad experiences on their forum. Choosing your own JDK, Kotlin, build-tools etc has been active sore-point with community.
PS: Kotlin compiler settings is available in Other settings.
I have a new MBP (16" 2019). Downloaded a fresh copy of IntelliJ IDEA Ultimate 2020.1.1. Used SDKMan to install Java 11-zulu and latest Gradle, 6.4. Went to File->New-Project and chose Gradle. When it loads, I get a Sync error and gradle won't process in IntelliJ correctly. Everything works fine from the CLI. I tried with importing an existing gradle project, different Java and Gradle versions, all give the same vague error.
idea.log
Caused by:
org.gradle.launcher.daemon.client.DaemonConnectionException: The newly
created daemon process has a different context than expected. It won't
be possible to reconnect to this daemon. Context mismatch: Java home
is different.
I've seen other questions about this but none of those solutions are working for me and I've never had this issue before, 10 years of using IDEA on OSX.
The issue is likely caused by the incorrect Java home path specified for the JDK in IntelliJ IDEA. Make sure it points to the correct location like this:
/Users/rob/.sdkman/candidates/java/14.0.1-zulu/zulu-14.jdk/Contents/Home
On macOS /Contents/Home part of the path is significant.
If some one are using macos with Sdkman use this version: sdk install java 8.0.322-librca for sdk 1.8 or other correlated version from librca, because sdk fom zulu i always had this same problema in intellij idea with java/kotlin and gradlew...
I've tried building the CSEmptyTemplate project in eclipse for android but have run into a host of issues with it.
Looking at the documentation, it doesn't appear as if it should be this difficult.
Firstly, I've installed cygwin and installed the devel package to get make.exe and gcc compilers. I'm also using cygwin as part of the tool chain.
However, the error I keep getting is 'make: *** No rule to make target `all'. Stop.'.
Any advice on fixing these issues would be appreciated.
edit: Found the make files. I was just an idiot last night when working on this.
There shouldn't be any additional steps required to build Chilli Source for android on windows, just the simple steps listed on the website here: http://chilli-source.chilli-works.com/docs/?page_id=67
However setting up the Android Development Tools with the NDK can be a bit of a pain. Judging by the error your getting my gut feeling is that something isn't set up correctly there.
Chilli Source requires the latest versions of the SDK, NDK and ADT. Can you ensure you have:
Android API level 21.
The latest versions of the Built Tools, Platform Build Tools and Google Play Services.
NDK revision 10c.
The latest ADT is also missing a couple of things that means it can't be used out of the box.
It doesn't come with the native dev tools which can be acquired by doing the following:
Go to "Help" then "Install New Software..."
Select "Android Developer Tools Update Site - https://dl.google.com/android/eclipse". You make have to edit it to instead point to https://dl-ssl.google.com/android/eclipse
In Developer Tools select and install Android Native Development Tools.
It also doesn't come with ant. This isn't causing your issue, but it will cause issues later on, so get it following these steps:
Go to "Help" then "Install New Software..."
Select "Juno - http://download.eclipse.org/releases/juno"
In General Purpose Tools select and install Eclipse Plug-in Development Environment.
Now that you've got everything required, ensure that you've got it set up correctly:
The correct version of the SDK selected the Android tab in preferences.
The correct version of the NDK selected in the Android/NDK tab in preferences.
Android 5.0 selected in the Android tab in Project Properties.
Finally, on windows you also need Cygwin. It's been a while since I've used it (I'm not a fan of cygwin so I do my Android development in a Ubuntu virtual machine) but only the "devel" package is needed iirc, so make sure you've at least got that.
Hopefully ensuring all of that is set up correctly will fix your problem!
Sorry if this is the wrong Stack Exchange, but this is where most of the questions were asked when I googled my problem.
For some time now I've been having problems with Android Studio and the AVD/SDK. It seems to be a relatively common problem, but I haven't been able to fix my problem with any of the solutions that worked for everyone else. This is the error I'm getting whenever I try and run the AVD or the SDK:
Cannot launch AVD manager.
Output:
Access is denied.
ERROR: No suitable Java found. In order to properly use the Android Developer
Tools, you need a suitable version of Java JDK installed on your system.
We recommend that you install the JDK version of JavaSE, available here:
http://www.oracle.com/technetwork/java/javase/downloads
If you already have Java installed, you can define the JAVA_HOME environment
variable in Control Panel / System / Avanced System Settings to point to the
JDK folder.
You can find the complete Android SDK requirements here:
http://developer.android.com/sdk/requirements.html
I've tried re-installing everything Java (Both JRE and JDK), reinstalling Android Studio, running as admin, configuring permissions and a bunch of other stuff. I'm running Windows 7 and I've tried both JDK/JRE 6, 7 and 8 (JDK 6 worked very poorly though). I don't really know what kind of information you need to help me solve this problem, but I'll supply any information needed as fast as I can. Thank you very much.
Edit:
Please note that Java IS installed. Both Java and Javac is working fine in cmd.
I can suggest that Go to Windows -> Preference -> Java -> Compiler
And try with different java version.
Probably your Java folders are in the path (and that's why they work from CMD) but your JAVA_HOME is not defined.
As you are on Windows try creating a System Variable following those steps
Try (re)installing the ADT and see if it works. If not, go to the sdk's root folder ([PATH TO THE UNZIPPED ADT]/sdk) and open the AVD Manager.exe. Does it still give you the same error? If not, try to open the SDK Manager.exe and make sure you've installed all the propper APIs. I'd recommend installing at least the SDK Tools and Platfom-tools, and all of API19 (Android 4.4.2).
Finally Solved my problem! Some software I had previously installed had created a Path in User Variables, which was the one I was using for my JDK path. I tried using the Path in System Variables and it worked just fine! Thanks to everyone who took time to help me.
I wanted to develop an android app a few months ago, so I followed all the steps from here-> https://developer.android.com/training/basics/firstapp/index.html?hl=p and I believe I downloaded all the tools I needed. I never got around to developing anything, so I tried starting again a few days ago. When I went to the above mentioned website, it said download the new versions of this and that, so I did. I tried following the steps, but now when I try to open eclipse, I get an error saying:
"Error could not find Java SE Runtime Environment".
My questions are:
How do I delete everything and start from scratch? I wan't to delete eclipse, sdk manager, sdk folder, everything. I want to follow the download instructions all over again and see what happens because it did seem to work the first time i tried a few months back.
Do I just delete some programs from control panel?
If this is not easy, how can I fix the error I'm getting when trying to open eclipse?
Edit: windows 7, 64-bit OS, if that helps
That sounds more like a problem of a corrupted Java installation. Check the JAVA_HOME environment variable. If this is empty fix this and try again.
To delete eclipse and the sdk just delete them from where you installed them.
SUGGESTIONS:
0) I assume you're running Windows. Please specify if you're on a different platform.
1) Delete Eclipse.
If you're not using Eclipse for anything else yet, I would strongly encourage you to delete it.
2) Uninstall your Java JDK (from Control Panel).
Download and install the JDK from Oracle: http://java.oracle.com.
3) Download and install the "ADT Bundle for Windows": https://developer.android.com/sdk/
In earlier versions of Android, you had to install Eclipse, the Android Plugins, and the Android SDK separately. I believe this is the procedure your link describes.
The newer "ADT Bundle" saves you this trouble. If Android is the only thing you're using Eclipse for (at least for now), you definitely want the ADT bundle. And you can probably ignore most of the instructions in your link.
'Hope that helps..