I have installed PhoneGap via command prompt. I have installed java, ADT and Apache ANT and setup their environment variables as follows:
ANDROID_HOME - C:\Program Files\ADT\adt-bundle-windows-x86_64\sdk\platform-tools
ANT_HOME - C:\Users\myname\Downloads\apache-ant-1.9.3-bin\apache-ant-1.9.3
JAVA_HOME - C:\Program Files\Java\jdk1.7.0_51
When I use command prompt to check on Java via the commands java or javac, I get a list of print out which I believe indicates that it is working.
Similarly when I try to type ant, it is not recognized which I am assuming is the problem. I did look through past questions here from which I have come to the current setup and it is still not working.
When I go into the created PhoneGap project folder and input the command:
phonegap run android
It returns the following error message:
An error occurred during the creation of android sub-project.
Please advice what I am doing wrong. Thanks.
Edit:
adb - it prints out a long list
android - The system cannot find the path specified
Failed to create c:/Program Files/ADT/sdk/add-ons
Error: unable to parse SDK content.
android is returning error as above. I checked the path and it is
correct less the last part. I don't have a folder called add-ons
inside sdk folder.
Related
I set up jdt.ls.java.home propertie in settings and i chagned my JAVA_HOME environment variable propertly, but my Gradle is throwing out this error:Gradle Build Error
There is also some sort of that error:
secound error
You can specify a different java home to Gradle via User setting java.import.gradle.java.home.
jdt.ls.java.home is used to launch the Java Language Server, and the extension had embedded a JRE to start the Java Language Server. So it doesn't matter, you can remove it.
And what's the value of C:\Programe Files\Eclipse Adoptiu..? please make sure it's an executable java path.
I am trying to write a script to automate my build process and push builds every so often. So ever everything seems to be working except for my JAVA_HOME environment variable.
When building the app normally from command line I specify my JAVA_HOME as:
/Applications/"Android Studio.app"/Contents/jre/jdk/Contents/Home
However if I add this as an environment variable to my launchctl.plist I get the following error:
ERROR: JAVA_HOME is set to an invalid directory: /Applications/"Android Studio.app"/Contents/jre/jdk/Contents/Home
This directory does exist and works fine when building the app normally.
If I do not specify the JAVA_HOME then I get the following error on building my app:
General error during semantic analysis: Unsupported class file major version 60.
Is there something I am doing wrong or can change to allow launchd to either build without the specified JAVA_HOME or to recognize the JAVA_HOME I am setting?
Add the code below to your environment's path .zshenv file in your home directory.
Run source ~/.zshenv to update terminal or Quit the terminal and reopen it again
Android Studio Dolphin and below:
export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jre/Contents/Home
Android Studio Electric Eel and above:
export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jbr/Contents/Home
I have been trying to find a way to integrate java code, generated by google-protobuf's protoc compiler, into an Android Studio project.
protoc --java_out=. Navigation.proto
where Navigation.proto contains:
syntax = "proto3";
option java_generic_services = true;
message Navigation {
string name = 1;
string url = 2;
}
service NavRPC {
rpc putNavigation(Navigation) returns (Navigation);
};
will generate a java class (Navigation.java), but that class references packages that are not present in the list of libraries (application or external) within Android Studio.
I tried installing the libraries from maven central through the dependencies tab of Project Structure, in Android Studio - but I keep getting error messages that include:
Error:(116, 79) error: incompatible types: IOException cannot be converted to String
Error:(261, 36) error: cannot find symbol method parseWithIOException(Parser<NavDrawerElement>,InputStream)
Error:(266, 36) error: cannot find symbol method parseWithIOException(Parser<NavDrawerElement>,InputStream,ExtensionRegistryLite)
Error:(269, 36) error: cannot find symbol method parseDelimitedWithIOException(Parser<NavDrawerElement>,InputStream)
Error:(274, 36) error: cannot find symbol method parseDelimitedWithIOException(Parser<NavDrawerElement>,InputStream,ExtensionRegistryLite)
Error:(278, 36) error: cannot find symbol method parseWithIOException(Parser<NavDrawerElement>,CodedInputStream)
Being somewhat new to Java, Android Studio, and Maven -- I am not sure why the errors are happening. The libraries show up in the external-libraries list but I keep getting unresolved dependencies and errors that would seem to indicate otherwise.
One solution I found that actually works for me is to build the google-protobuf jar files and then add to my project libraries.
To build these jar files in MacOS, there were several technologies/packages that had to be installed, configured, and set up correctly.
JDK 1.8
In MacOSX there is a utility (/usr/libexec/java_home) that can be
used to generate the correct JAVA_HOME environment variable.
I modified my .bashrc file to include:
export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
If the version of MacOSX installed on your system is based on 10.6,
then the default jdk is version 1.6. New versions of java and jdk
can be installed from the system preferences/java/java applet, but
once installed, it is still necessary to set JAVA_HOME to point
to the version you want to use.
This is because multiple versions of java can exist on a mac, and
the update utility doesn't try to guess whether or not you want the
latest versions.
Maven 3.3.8
I use MacPorts for the installation of maven3. In the process of
installing maven3, I had to update ports and all of the related
packages in order to get rid of warnings [regarding out-of-date
packages].
I tried to do the updates installations with 'sudo ports' but kept
running in to problems. So I ended up using 'sudo bash'.
The commands executed:
sudo bash
ports selfupdate
ports install maven3
ports update
google-protobuf
I downloaded protobuf-master from google and built protoc.
I couldn't figure out why the jar files that I expected to be built
weren't, which is what prompted the installation and updates (above)
Once I had the correct jdk and maven was installed, I was able to
change into the java directory and install maven3
The commands executed:
mvn3 install
mvn3 package
I don't know if/what the differences between install and package -
but it didn't seem to hurt anything by running both.
Compiling the .proto files
I used a simple .proto file with several message types and the
definition of an RPC service:
syntax = "proto3";
option java_generic_services = true;
message Navigation {
string name = 1;
string url = 2;
};
service NavRPC {
rpc putMessage(Navigation) returns (Navigation);
}
To compile
protoc --java_out=$PROJECT_DIR/path/to/package/Navigation.java \
Navigation.proto
Android Studio
In order to get the protocol-buffer generated class to compile:
I copied these files into my lib directory:
protobuf-master/java/core/target/protobuf-java-3.0.0-beta-2.jar
protobuf-master/java/util/target/protobuf-java-util-3.0.0-beta-2.jar
With those files copied, I had to put the name of the package that the source file was being added to.
There are still some questions i have (like how to make Android
Studio automaticall compile a .proto file), but everything works!
I keep recieving the following error when attempting to add a platform to a cordova project.
ERROR: executing command 'ant', make sure you have ant installed and added to your path.
I have added my JAVA_HOME, ANT_HOME and ANDROID_HOME (both \tools and \platform-tools) environment variables and can confirm they are all installed correctly be executing 'java', 'ant -version' and 'android' commands in my console and getting responses.
Right now, I have the above mentioned environment variables as both User and System variables, but have also tried just having them configured as System variables.
Ant version: 1.9.2
java: jdk1.8.0_11
I'm quite stumped right now because everything seems to be configured/installed correctly. Is there a specific location I should install/un-zip these components?
You have to show full path to bin folder of ANT. see for the variable name path, edit it. add one of the following to the end of it's value.
Suppose your ant folder is in d drive like this D:\ant then your ANT_HOME value should be D:\ant. Then add this to your path variable
%ANT_HOME%\bin
OR add the full path like
D:\ant\bin
executing
:ProjectCreate /path -n android
gives
java.lang.RuntimeException: no command android list targets found
while executing command (port: 9091): -editor vim -command android_list_targets
The problem is that is telling you the android command is not found, what you need to do (you're already solved it but for other readers...) is:
Be sure you have downloaded the android-sdk and path is properly setup (when installing eclim it ask for its path but you can also change it in your .vimrc).
Be sure 'android' command is available in your system, i.e loaded in your path. (in linux you can type in a terminal "which android" to see if android cmd can be found).
Good luck!