Recently i have been trying to transfer my javafx app on android mobile devices. Javafxports seens to be the way to do it, but I am looking for a quick way to do it through eclipse and not using the "command line", to go to a path and run gradle command. Can someone post a brief guide if there is such a way to build everything from eclipse IDE?
Thank you in advance.
How to use eclipse and gradle to install a JavaFX App on Android.
1. Download and extract e(fx)clipse ( I have downloaded the ALL_in One). I downloaded 4.4.
2. Download and install JDK 8u40 or greater from Oracle website. I downloaded v8u45 64-bit for Windows.
3. Download Android SDK Tools( I downloaded and extract android-sdk_r24.1.2-windows.zip)
Run "SDK Manager.exe" and install
(a) Tools -> Android SDK Build-tools 21.1.2
(b) Android 5.0.1 (API 21) -> SDK Platform
(c) Extras -> Android Support Library.
4. Download sample application of JavaFX and later extract it to eclipse "workspace".
5. Run eclipse and download Gradle Integration for Eclipse (4.4) by drag and drop from web to eclipse.
If that does not work go to
Help -> Install New Software -> Add... -> Location: http://dist.springsource.com/release/TOOLS/update/e4.4/ -> Core / Eclipse Integration for Gradle -> Gradle IDE
6. In Eclipse go to
File -> Import... -> Gradle |_ Gradle Project
(a) Browse to eclipse workspace where you have extracted "Sample Application from Step 4"
(b) Press "Build Model" button
(c) Choose JavaFXAndroid project and "Finish"
7. Edit "build.gradle" file and change androidSdk parameter to indicate the directory where you have extracted Android SDK Tools in Step 3
8. Check if the build runs ok on windows machine
In Package Explorer
Right Click on JavaFXAndroid -> Run As -> 2 Gradle Build... -> type "run" in the large editor and press "Run" button
9. Install it on an android with version > 4.
In Package Explorer
Right Click on JavaFXAndroid -> Run As -> 2 Gradle Build... -> type "androidInstall" in the large editor and press "Run" button
Note: Make sure that you have installed the correct ADB driver for your device and that your device is in developer mode.
10. Enjoy:)
i dont know how the plugins on eclipse are, but on intellij you got there is gradle plugins and it reads the configured tasks. So you can configured easily your own "run". I bet you can do it to with eclipse.
Related
After selecting “Profile or Debug APK…” to open an existing APK, pressing the “Debug” button gets us to the “Edit Configuration“ windows with the “Error: Please select Android SDK” message.
If we still select “Debug”, and then select “Continue Anyway” in the “Change Configuration Settings” windows, the error notification from the main window is “Error running ‘com.appname’: No JDK specified for module ‘com. appname’”.
I found the solution for myself. There are 2 places to check if the SDK was set correctly.
File-> Project Structure… -> Project Settings -> Project
Ensure that Java SDK is set under “Project SDK”. (for example, ‘9.0.1 (java version “9.0.1”)’)
Project Settings -> Project (tab)
File-> Project Structure… -> Project Settings -> Modules -> -> Dependencies
Ensure that your installed Android SDK platform is set under “Module SDK”. (for example, Android API 27 Platform (java version “9.0.1”)’)
Project Settings -> Modules (tab)
If the application is debuggable, pressing the “Debug” button will bring up the Android emulator selection windows.
I am new to Ubuntu and Android, and I tried to install Android Studio and succeeded in that matter, but when I click Start a new project nothing happens. I tried reinstalling, but it didnt help. Any ideas?
EDIT:
i managed to create project manually using terminal, but in android studio I still cant create project nor edit existing project (some IDE error is thrown)
You should be more specific (screenshot or quotes of error), so try this:
In Android Studio, go to Configure -> Project Defaults -> Project
Structure -> Platform Settings (SDK) choose the Android SDK, set the
build target and click on apply.
After successfull installation of Android studio,sdk and jdk i was not able to open new project in Android in Android Studio on windows 7. This got resolved by doing the below settings,
Configure -> Project Defaults -> Project Structure -> Platform Settings (SDK) choose the Android SDK >click Apply and Ok.
You are good to go. Please note that you need jdk 1.7 to work with Android studio.
I just initialised a project on Android Studio, and it was working fine in version 0.2.6, but in 0.2.7, I get this error:
It creates a folder inside my Applications directory, but it does not initialize the project. Any help regarding this problem would be appreciated. I get no problems with version 0.1.1 through version 0.2.6, but when it comes to 0.2.7, things start to get problematic, like this and I can't even start a project.
With 2.7 update I got the same issue. It looks like now Android Studio thinks sdk lays in under its own folder at android-studio/sdk.
You should be able to use android app under android-studio/sdk/tools to get missing components (not tested).
Another solution would be to fix sdk path (tested):
Close any projects then drop to Welcome to Android Studio Dialog
Select Configure -> Project Defaults -> Project Structure
Select SDKs -> Android SDK -> Android SDK Home Path
Update it to your previous sdk location.
got the same problem when applying the last patch (2.7). I've resolved it by copying SDK Manager.exe from android-studio\sdk\tools\lib to android-studio\sdk\ then I've launched it and install the missing component.
After restarting Android Studio it works again !
You must manually run SDK Manager.
Folder: android-studio/sdk/tools
Search for android or android-sdk
The new Support Repository must be already selected, and you need only click the "Install" button.
Just as Leonidos said, install ASR through SDK Manager:
Tools > Android > SDK Manager ; Navigate to the Extras folder, and select Android Support Repositories.
Click install packages and it will work fine
I did a fresh install of Java, SDK and Android Studio, update it to 0.2.7 and install the ASR through SDK Manager, but the messages comes again.
So i found this solution.
The most common problem for Android Studio and 64Bit Windows System is the no 8.3 short path for
C:\Program Files and C:\Program Files (x86).
find_java.exe
couldn't handle it and give a wrong path back.
Finally do this:
dir /x C:
-- It shows no 8.3 short paths.
fsutil 8dot3name query C:
-- It shows NtfsDisable8dot3NameCreation is 1 on "C:",
means 8.3 short path won't be created in "C:".
Then I enable the generation of 8.3 short name by:
fsutil 8dot3name set C: 0
and create short names for C:\Program Files and C:\Program Files (x86) in windows recovery mode by:
fsutil file setshortname "C:\Program Files" PROGRA~1
fsutil file setshortname "C:\Program Files (x86)" PROGRA~2
And now dir /x C: can show the short names.
And now find_java.exe -s
can show the short path C:\PROGRA~1\Java\JDK17~1.0_2\bin\java.exe.
And now find_java.bat and android.bat can work good now!
source
Also copying SDK Manager.exe from android-studio\sdk\tools\lib to android-studio\sdk\
Just a few ideas to try that should hopefully help. These can be found by using Ctrl + Shift + A.
"Sync project with Gradle" - (it's also often in the toolbar with a green and yellow ball and a blue down arrow next to three android icons)
"Gradle" and select the ToolBox option; then hit the blue refresh icon to refresh all the gradle projects
"Project Structure..." (also available under File) Under the Libraries project settings you should see a valid reference to your support library. You'll also want to skim through everything to make sure everything else looks good with the project.
"Invalidate Caches..." (another available under File) Invalidate and restart. This one got me going again after the previous upgrade generated a bunch of errors.
Some of these may be redundant, but after having fought with similar issues in the past it's just a few easy things I've found to check.
If refreshing everything doesn't work you can always pull up the Android SDK from Tools -> Android -> SDK or from the toolbar with the blue/green boxy android that has a black down arrow. It should be next to the Sync Gradle button.
I update the Android Studio(AS) and see the same issue.
However, there is something slightly different about what I find out.
I actually have two sdks because I shift from Eclipse to AS.
Hence, I get one sdk in
c:\Program Files(x86)\Android\android-sdk
and anther in
c:\Android\android-studio\sdk.
And the real one that I use is in c:\Program Files(x86)\Android\android-sdk.
The important thing is that, I find that only one of the sdk setting is changed after the update.
Quick Start > Configure > Project Defaults > Project Structure
> Platform Settings > SDKs
1.7
JDK home path:
C:\Program Files\Java\jdk1.7.0_10
Android 2.2 Platform
Android SDK home path:
C:\Program Files(x86)\Android\android-sdk
Android 4.0.3 Platform
same as 2.2
Android 4.2.2 Platform
Android SDK home path:
C:\Android\android-studio\sdk <- it is modified after update!!!!
Android 4.3 Platform
same as 2.2
After fixing the path in 4.2.2, I could create new project successfully again.
For some reason, if you install Android Studio in the same directory as the SDK, this error will pop up. Just install it somewhere else.
For instance, I had it installed at C:\Android\, along with the SDK. Then, I decided to install it at C:\Program Files (x86)\Android Studio and it simply worked.
I'm running Eclipse 3.7.2 on a Win7 machine. I have the Android SDK and AVD. All was working well. I have an Android App project that I've run under the emulator on an AVD and on a real Android device. ADB worked fine as well.
At some point I grabbed SDK Android 4.0.3. Then I had to upgrade a few more things that I cannot remember, perhaps my AVD. But ever since this upgrade there is no option to run my package as an Android Application anymore. If I choose "Run" it throws up a menu asking me to select a way to run it and "Android Application" is not a choice. It has to be Java App, etc. If I open "Run Configurations" there is no "Android Application" in my left column.
My SDK manager still lists Android 4.0 and Android 4.0.3 as "Installed." My AVD Manager still let's me launch an Android virtual device and even create a new one. But Eclipse does not let me run my package as an Android Application.
Make sure you check for updates to the Android ADT plug-in for Eclipse in addition to upgrades for the AVDs, SDKs, and other debug tools. Then make sure you're in your Android perspective (upper left of Eclipse window), rather than some other/generic Java perspective (no Android-specific options).
Also, you can check under Window > Customize Perspective... in Eclipse to double-check that all the Android options (menus, context items, views, toolbars) you want are enabled.
UPDATE:
You can add the Android tools to any perspective (I named mine "Android"). From the DDMS or Java perspective, go to Window > Customize Perspective - DDMS. Click the Command Groups Availability tab, and make sure that "Launch" is checked.
Also go to Project > Properties > Run/Debug Settings and check that there is a Launch Configuration listed. Create/Edit that configuration and confirm that it has an Android tab (usually set to run the Default Activity from your Manifest).
If not, there may be something wrong with your project's association - try right-clicking on your Project in Project Explorer, go to Android tools (if available) > Fix Project Properties. I believe there's an Ant tool that can do this from the command-line, but you'd have to check the Android/Google docs.
There's also the possibility that something's off with your Eclipse installation or that you've got a newer ADT plug-in than your version of Eclipse. Eclipse Juno (v4.2) released at the end of June, and the most recent ADT plug-in may be looking for something that's not there in your v3.7 install.
What fixed it for me was:
Right-clicking on the Project Name in the Package Explorer
Android Tools -> Fix Project Properties
After that I was able to just Click Run As -> Android Application and all was well for me
Click mouse right button on your project -> Configure -> Convert ADT Android Configuration
An easy fix is to manually create an android run configuration:
Run / Run configurations..., then right click on "Android application" and select new, select your project and click Run.
I had a similar problem. What I finally did that worked was go into Project->Properties->Java Build Path->Order and Export and I made sure that the /gen files we're first in the sequence followed by the /src files.
I just installed the latest version of Eclipse and the Android SDK. In the Android SDK Manager I installed everything, and in Eclipse I installed the ADT Plugin.
If I choose new Android project, I can't choose any Build Target. How can i select different build targets?
Thanks for your help!
I had the same issue and had to go to Eclipse > Window > Preferences > Android to set the Android SDK location (C:\Program Files\Android\android-sdk in my case).
You can see this post: android can not find a target
and
http://www.mail-archive.com/android-beginners#googlegroups.com/msg17763.html
first of all select SDK manager in the android folder, then a windows pops up automatically in which certain packages are selected, from which you can select the platform on which you want to develop you application..... it will take some time to download those packages
Then go to preference(Eclipse) -> select android from the leftbar -> select target in the right bar -> got to the program Files - > select android -> select sdk -> Finish
Before running you application perform the following steps ->
-> select project name from the project explorer
-> select run as -> run configuration -> select android configuration -> select project name and activity name to start with -> Select target tab from the above -> it shows the platform which you have installed -> select that platform -> select run
don't forget i struggled with it, always mention the activity name in the manifest file otherwise what ever you program, it will never comes on emulator, but shows error....
You have to open the SDK Manager in the location in which you installed the Android SDK and download individual build targets depending on the Android version you want to develop for.
See Step 4 Here: http://developer.android.com/sdk/installing.html
Perhaps you've missed Step 4. Adding Platforms and Other Components at http://developer.android.com/sdk/installing.html . Pay attention on it.
To fix this problem, open SDK manager thru programs or eclipse. It will show available packages to download. In that list don't select the latest one. Select Versioin 2.2(API 8). Then install all sub packages (there are six) inside that.
the same error for me, Just activate "Automatic Updates" in eclipse, restart, install the new update of eclipse, you will be notified> now you can select in the preference android: your folder and all target will be there