i found lot of FFT library on github but i don't know how to add them to my project.
I try to import it without success.
Can you help?
Here what i found:
1) https://sites.google.com/site/piotrwendykier/software/jtransforms
2) https://github.com/wendykierp/JTransforms
If your project has a libs folder for external dependencies then you are good. Else create one under the main project. If you have the jar with all dependencies for the FFT algorithm, put it in the above mentioned libs folder. Next open build.gradle under app and add the following line under dependencies if it not already there..:
compile fileTree(dir: 'libs', include: ['*.jar'])
Sync the project as you usually do.
Related
I am using unity3d in my android studio project and need to import the unity ads aar file into my project. To do so I added the following lines and the unity-ads.aar to the libs folder :
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
implementation files('libs/unity-ads.aar')
I get the following error when I compile the project :
Duplicate class com.unity3d.ads.BuildConfig found in modules jetified-unity-ads-4.2.1-runtime (com.unity3d.ads:unity-ads:4.2.1) and jetified-unity-ads-runtime (unity-ads.aar)
If I delete these lines and the unity-ads.aar file all the classes from unity3d aren't recogonized and I get errors.
I don't understand why the classes are duplicated and how I can resolve this issue.
You only need the first line
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
and make sure you update your gradle version to 7.x.x
file -> Project Structure
I know how to work with Apache Commons Lang 3 library in an Android Studio app by implementing it in the build.gradle file using implementation 'org.apache.commons:commons-lang3:3.12.0'. But I want to know if it's possible to include the Apache Commons Lang 3 library (or for that matter, any external library) in the Android app manually if I have the library downloaded on my PC? For example, like adding the .jar file of the library to Android Studio or something of that sort.
I'm asking from the viewpoint where I have a library folder in my PC which doesn't have an online link from which gradle can download and merge it with the Android Studio app automatically. How do I add that library to my Android app? Any elucidation on this matter is complimented.
Regards
These are the steps to add a local library as dependency (.jar):
put the jar file into "libs" folder
add the following line to your build.gradle, inside dependencies:
compile fileTree(dir: 'libs', include: ['*.jar'])
like:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
Options in the links listed below actually helped me to achieve my objective properly:
https://www.geeksforgeeks.org/how-to-import-external-jar-files-in-android-studio/
https://medium.com/#jonathanmonga/how-to-add-libraries-in-android-studio-in-english-286db8b073c2
I don't know how to add jxl.jar in android studio
I tried to pasts jxl.jar in lib project and using project structure
then tried to start to create WorkBook obj
but not working.
what I missed?
If you use gradle (Android Studio), then add in dependencies:
dependencies {
implementation 'net.sourceforge.jexcelapi:jxl:2.6.12'
}
Paste your jxl.jar into the libs folder
Right click it and select 'Add as library'
Make sure that compile files('libs/jxl.jar') is in your
build.gradle file (or compile fileTree(dir: 'libs', include: '*.jar')
if you are using many jar files) if it still not there then you can try to add it manually by adding this compile files('libs/jxl.jar') inside dependancies
Synch your project
I am working on integrating twitter with my android application, I am using twitter4j library to do this.
I have added the twitter4j library files and put it in a folder libs and added compile dependency in build.gradle inside app folder
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.google.android.gms:play-services:6.5.+'
compile 'org.twitter4j:twitter4j-core:4.0.2'
}
but I am still not able to use this library
In the Gradle drawer to the right, could you hit the refresh button to see if that helps? Also, the dependencies block that you've pasted above doesn't contain a directive for twitter4j - did you happen to simply miss it out in the question, or is it really missing from the gradle.build file?
Try to add this at "repositories" on your buildscript.
repositories { mavenCentral() }
I am trying to import my own library into one of my apps in Android Studio. I have seen instructions in several places that basically amount to :
1 Move the files into a library folder within your project diectory.
2 Add include 'projectName:folderName:libraryName to your settings.gradle file
3 Add compile project('folderName:libraryName') under dependencies to your project level build.gradle file
This works for me if I am importing a module... I think its a module. I'm still trying to figure out gradle. My library structure looks like this:
ProjectName
Module1
Classes
Module2
Classes2
If I import Module1 or Module2 separately in this fashion (where Module1 is my 'libraryName' in the instructions above), they will work. But if I try to import the whole project as one library I get errors.
What am I doing wrong? I would like to import the entire project as I would like it to have many modules. Is there another/better way to do this? What am I misunderstanding?
Update:
As per #ScottBarta 's instructions I merged settings.gradle files. This appears to have worked in my main project because the gradle sync completed properly but I'm not ready to run that project. So I made a tester project and imported the library using the same steps. This time I get the error:
Gradle 'Tester' project refresh failed:
Build script error, unsupported Gradle DSL method found. 'compile()'!
As near as I can tell, the files are equivalent in the two projects:
Main:
include ':Eed'
include ':Eed:libraries:Overt:Visible'
include ':Eed:libraries:Overt:Control'
Test:
include ':app'
include ':app:libraries:Overt:Visible'
include ':app:libraries:Overt:Control'
Main:
dependencies {
compile 'com.android.support:appcompat-v7:+'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project('libraries:Overt:Visible')
compile project('libraries:Overt:Control')
}
Test
dependencies {
compile 'com.android.support:appcompat-v7:19.+'
compile fileTree(dir: 'libs', include: ['*.jar'])
complie project('libraries:Overt:Visible')
complie project('libraries:Overt:Control')
}
And here's a screenshot of the file structure in the Tester project.
You can only have one settings.gradle file per project, so if you have a multi-module library with its own settings.gradle, you can't bring it in with a single include statement. You'll need to merge the library's settings.gradle into that of the project you're including it in.
When you do the merge, make sure that all the include statements in the merged settings.gradle have sensible paths that will locate their libraries relative to the project root. Also keep in mind that the paths specified in your settings.gradle file have to match what's in your dependencies block. So if you have this:
include ':app'
include ':app:libraries:Overt:Visible'
include ':app:libraries:Overt:Control'
You need this:
dependencies {
compile 'com.android.support:appcompat-v7:19.+'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':app:libraries:Overt:Visible')
compile project(':app:libraries:Overt:Control')
}
In the build script you posted in your question, there's a typo: it says complie instead of compile. If that's a typo in your build script and not just a typo in your question here, that will be a problem.