Creating *.aar library - java

Hi I'm a new in Android development and using Android studio. I need to create *.aar lib. I created New Android library project (empty for now). How to generate *.aar file from it? Can you explain by steps? Has read a lot of topics but still unsuccessful. Thanks.

Here's what has worked for me.
on the command line go to the root directory of the project
ensure that your JAVA_HOME environment variable points to the version of the java sdk you are going to use. On a Mac via the bash shell that would look something like this:
export JAVA_HOME='/Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home'
(click here to find out how to find your Java Home)
To clean type ./gradlew clean
To build the library type ./gradlew aR (This may take a while)
You should now find the .aar file in mymodulename/build/outputs/aar
Thanks to geekgarage for clarification.

Thanks for #pskink, found out, need to build it like: "gradlew assemble" from the root of project.

Related

Configure scala project sdk for idea

I know there is already questions about it on stackoverflow, but none of them helped me answer my question. I just downloaded idea with the scala plugin and created a new scala project. I got the error no jdk for this project.
After looking on internet I understood that I need to give it the java sdk for it to run. readlink -f $(which java) gave me the java jdk location (/usr/lib/jvm/java-8-oracle/jre/bin/java) but adding it to the option like shown below didn't help.
How to configure the project sdk for an sbt project ?
To set the JDK, go to the Project Structure dialog in the "Project" tab. If you haven't set up a JDK yet, click "New..." and choose the home directory. Note that this needs to be a JDK (download from Oracle or install via apt), not the JVM you are using in your screenshot.
Go to Project Structure and do what I marked on the screen

Installing and using HDF5 for Eclipse on Mac OSx

I am trying to install and use the HDF5 libraires in eclipse in order to read and manipulate a dataset for my Big Data class.
I followed the instructions from the following website : http://www.hdfgroup.org/products/java/release/downloadsrc.html
At the end of the installation, after the command
ctest -S HDFJAVAMacCMake.cmake -C Release -V -O hdf-java.log
I get the following message :
100% tests passed, 0 tests failed out of 313
Total Test time (real) = 39.85 sec
[ERROR_MESSAGE]
Error in read script: /Users/fg/Downloads/build/HDFJAVAMacCMake.cmake
I don't understand why I get the Error in read script after every test passed.
Was the installation successful or not ? If yes, how do I manage to link the hdf5 libraries into my eclipse project ?
Thanks a lot for your time!
Okay, I managed to link and use the library in Eclipse. For those with the same problem, here is what I did.
After building the HDF-java software with cmake (as described in the link I provided), I still get the error message
[ERROR_MESSAGE]
Error in read script: /Users/fg/Downloads/build/HDFJAVAMacCMake.cmake
But everything has been compiled successfully (I still don't know why I get this message though).
Then, the following dmg appears in the build directory HDFView-2.10.1-Darwin.dmg (for version 2.10.1 of course). You need open it and drag it to your application folder. This "app" (right click, Show Package Content) contains the java libraries for HDF4 and HDF5, as well as the native librairies (.dylib for mac osx).
The paths are the following,
JARs files : /Applications/HDFView.app/Contents/Java
Native libs: /Applications/HDFView.app/Contents/Resources/lib
At this point, you can open Eclipse and go to the "Build Path Configuration" of your project and provide both the JARs and the native lib path.
Under the Libraries tab, you have to provide all the JARs contained in the first path I mentioned above. Then, go to the Source tab and you should see Native library location under your project. Simply give the second path I mentioned above.
Now you should be able to use the HDF libraries and compile your project without exception.
Hope this helps!

How to install Cordova plugins in Netbeans IDE? 8.0

I'm just getting into javascript development so please bear with me.
I'm trying to install the SpeechRecognizer plugin into Cordova/a Cordova project (which is built into Netbeans IDE 8.0 )
and I really don't know where I have to begin. Could somebody help me out with this? How do install the plugin, how do I call the function? How do I get a string or array returned to me conntaining what the speech recognition picked up?
Thanks so much, I'm a total noob.
The plugin is SpeechRecognizer - https://github.com/poiuytrez/SpeechRecognizer
You can do following:
open [projectFolder]/nbproject/plugins.properties file
paste following at the end of file
SpeechRecognizer=https://github.com/poiuytrez/SpeechRecognizer.git
build project
The plugins.properties file contains list of used plugins. Some "core" plugins can be added/removed easily in project properties but for 3rd party/unknown plugins, you need to manually modify the file (it is also mentioned in project properties dialog ->Cordova->Plugins)
Edit: The pasted line could look like
com.phonegap.plugins.speech=https://github.com/poiuytrez/SpeechRecognizer.git
or
com.phonegap.plugins.speech.SpeechRecognizer=https://github.com/poiuytrez/SpeechRecognizer.git
in case of some issues (I was able to build the project with the 1st line with friendly name but in case there is some catch, try this name instead)

.classpath file does not exist in new projects

I'm just starting out android development with eclim, and I'm getting somewhat frustrated just trying to get a hello world going. While inside my workspace, I enter vim, type :ProjectCreate /$PATH_TO_MY_PERSONAL_PROJECT -n android. I'm walked through the steps, but when I enter the project root directory, no .classpath file exists. The .project file is there, and the directory is created, but eclim doesn't report any existing projects when I execute :ProjectList in vim.
Are there special steps I must go through to get eclim to recognize the android SDK?
Any ideas what's going on here?
Using eclim 1.7.14 and android API 17.
Thank so much in advance!
So this seems to be a problem associated with Eclim alone, not eclipse. The easiest solution for those of us who want to keep our business inside the terminal is to use the android tools provided instead of using eclim to create projects from inside of vim. Just enter the command:
android create project --fill in project specs in options
to create projects from scratch with no problems.

KSOP2 Librarary class not found exception

I've used KSOP2 in my project and it worked all these days. Recently I bought a new machine and moved my project to new machine and imported the ksoap library to project etc etc and when I try to run the application I get following error in the emulator
Caused by: java.lang.NoClassDefFoundError: org.ksoap2.serialization.SoapObject
this is the place where exception is thrown.
SoapObject request = new SoapObject(namesapce, methodname);
has is something to do with 64 bit machines??
How come the app that worked all these days stopped working all of a sudden?? Can someone enlighten me please. I'm stuck with this. Thanks for your time in advance.
I had similar problem, simply I forgot to check checkbox on kosoap2 library in Java Build Path options, Order And Export tab :)
I managed to solve the problem by
Creating a folder "libs" in the project
Copying the external jars in to the folder
Refresh the folder
Go to properties -> Build path -> Add Jar (not external JAR)
Clean the project
Restart Eclipse
Boom it worked for me. Hope it'll help others too.
This may be related to the latest Android plugin and tools (r17). I read somewhere that external jar files need to be run through the dx --dex tool (because of the different binary format of Java binaries in Android), but it didn't work for me. What I ended up doing was adding the project as source instead of compiled binaries (by linking to the source from the project and adding it as a source folder.) This way Eclipse builds it properly and Android finds it during runtime.

Categories