I've been working on a Cordova project for iOS for the last couple of months, and now I want to move over and test the Android portion. I've tried twice of installing the Android SDK, JDK, Ant, and putting them in the Path Environment Variable but I just can't get the app to build. I tried looking around at other questions but couldn't seem to find a definitive answer.
So, when I go to build the Android platform, this is the error that I get:
BUILD FAILED
C:\Program Files (x86)\Android\android-sdk\tools\ant\build.xml:720: The following
error occurred while executing this line:
C:\Program Files (x86)\Android\android-sdk\tools\ant\build.xml:734: Compile failed;
see the compiler error output for details.
Total time: 3 seconds
C:\Users\thomas\Desktop\batapp\BatNetting\platforms\android\cordova\node_modules\q
\q.js:126
throw e;
^
Error code 1 for command: cmd with args: /s,/c,ant/debug/-f/C:\Users\thomas\Desktop\
batapp\BatNetting\platforms\android\build.xml,-Dout.dir=ant-build,-Dgen.absoule.dir=
ant-gen
ERROR running one or more of the platforms: Error: C:\Users\thomas\Desktop\batapp\
BatNetting\platforms\android\cordova\run.bat: Command failed with exit code 8
You may not have the required environment or OS to run this project
I'm really not sure what could be causing this. Like I said, I've tried reinstalling the SDK, Java, Ant and double checked the Path. First, I tried pulling the files from a local Git server, then I removed them and copied them straight from the project I had open on the Mac VM I had been working on. I have also tried using both cordova build android and ionic build android, but both have the same result.
Any help would be greatly appreciated!
Update
I've tried creating a new app with ionic and everything in the new app works fine. I've successfully created a project, added Android as a platform, built and ran the Android project. So, it seems to be something with the app that already exists that doesn't seem to be agreeing with me.
I actually figured it out. I was just having a problem with one of my plugins. It required a java library that wasn't in my project. Once I put the library in the project, it was able to build and run fine.
Related
I cannot get eclipse to run any code whatsoever. I have just begun using eclipse and think I may not have installed the jre/jdk properly because I have tried running different code and always get the same error. This is the error message I got as soon as I opened the workbench and tried to run something the first time:
Error occurred during initialization of boot layer
java.lang.module.FindException: Module tutorial1 not found
Everything appears to be there in my file system, but then again I have never done a successful build so I'm not entirely sure how it should look. I'm just getting started learning java development and this is rather discouraging. Why won't eclipse run any code? Are there other steps I should have taken before installing eclipse?
I have tried running different code and always get the same boot layer message. I have also tried installing multiple versions of the jre, jdk, and eclipse and it still doesn't work.
I am facing a so weird issue with my eclipse. Android projects are not running in my eclipse
I'm using
Eclipse version 4.4 Luna ,
android SDK latest API level 23
(even earlier versions is not working ).It was running well till some days ago , and all other java projects running fine like web and desktop etc..
Whenever I am running the android project it shows the error dialog box, though no errors are there in the project(for a new project also), I have tried clean build, cleared cache, updated eclipse adt , and is there anything left I need to try other than formatting PC?
Well ,after some struggle I have found out what is the actual problem. It was my debug.keystore file.
I have got an error in my console saying Debug certificate expired
Well I have found my debug.keysotre file in here %USERPROFILE%/.android and deleted it. Eclipse itself will generate a new one when compiling a new project. You may need to clean and then build to generate the certificate.
Thanks everyone for your support.
Problem solved !!! :)
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.
When I installed Android Studio on my mac (OSX Mavericks) and created a project, I got this error:
Failed to sync Gradle project 'project name'
unable to find method 'org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V'
When I first had this problem I had gradle-1.12 installed. I then installed gradle-2.1 and still the same problem. I then installed gradle 1.1 and still the same problem.
I've been trying to fix this problem for the past week to no avail.
Look in ~/Library/Java/Extensions. I had an alias in there for slf4j-api.jar, amongst other old things. Removed that (actually I deleted the whole ~/Library/Java directory :-) and it works fine now.
This question already has answers here:
Failed to import new Gradle project in android studio
(11 answers)
Closed 9 years ago.
when i started android studio i get this error:
Failed to import new Gradle project: Could not fetch model of type 'IdeaProject' using Gradle distribution 'http://services.gradle.org/distributions/gradle-1.6-bin.zip'.
Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the user guide chapter on the daemon at http://gradle.org/docs/1.6/userguide/gradle_daemon.html
Please read below process output to find out more:
-----------------------
Error occurred during initialization of VM
Could not reserve enough space for object heap
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
Consult IDE log for more details (Help | Show Log)
i use latest android studio and latest(1.6) gradle. whats the problem here? i use 32bit window 8
If you upgrade your Studio to 0.2 version, then to fix this, open the SDK manager, and make sure that the "Extras/Android Support Repository" (not just Android Support Library) is installed.
Source: http://tools.android.com/recent/androidstudio020released
Might be a proxy issue, can be solved by adding proxy address.
Studio-->Settings-->HTTP Proxy-->Use Proxy and add proxy details and verify with check connection.
Another solution is to install the SDK repository as mentioned in the install notes at the very bottom of the page. This happens after upgrading from android studio 0.1 to 0.2 when creating new projects or implementing existing ones.
Open Android SDK Manager
Install Android SDK Repository from the Extra's tab
IMPORTANT: I done it on fresh android studio!!
if you have plugins and such it may not work for you !
I found the solution that worked for me :
Go to Gradle
Download last version
Open grandle location within Android Studio (in my case is: C:\Program Files (x86)\Android\android-studio\plugins\gradle"
Important: backup your existing Android Studio gradle lib folder (in case things go wrong, as some of the commenters have pointed out)
Open download file from 2.
Override lib folder within Android Studio with lib folder within downloaded file.
Everything should work like a charm :)
I made sure I had the latest version of Gradle, but that made no improvement. Then I ran Android Studio using an admin account, at which point all the errors disappeared. If you are able to, I suggest you do the same. This was on a Windows 7 box.
I'm on a Mac:
After updating to Version 0.2.0 I had the problem and here is what I did to fix it:
First I removed all old config/settings files:
$ cd
$ find Library/Application\ S* Library/Preference* -iname "*androidstudio*" -exec rm -rf {} +
$ rm -rf .gradle .android
And after this didn't help either I freshly downloaded AndroidStudio. And then it worked.
So you might start with a fresh download before removing everything.