I'm doing the beginner android course on udacity and the code that they make you put in the MainActivity.java file is full of errors and keeps saying build failed in the console. Here is a link to a screenshot of android studio after failed build
http://postimg.org/image/6etcu6ldz/
I think support library is missing.
Go to your build.gradle (Module:app) and check if support library is in dependencies section.
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:21.+'
}
In addition, you have to install it in SDK Manager.
I hope this answer will help you!
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
what can i do my Android studio show this Gradle model version=5.4.1, NDK version Unknown.So What Cane I do Sir Please Help me.......
I just installed the newest of Android Studio, and I opened my project and started to sync and this error showed up: NDK Resolution Outcome: Project settings: Gradle model version=5.4.1, NDK version is UNKNOWN What's going wrong?
Something similar happened to me.
It is solved almost by magic.
In the files build.gradle, comment the dependencies:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
...
}
"Comemnt with block Comment" and "Sync Now".
And then, I replaced the dependencies.
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.
i need to include this library but i ve got several problems.
project library on github
i tried to follow the instructions on the github project but they did not work for me. I have to include the library in android studio.
i tried to:
1) copy the whole code in my project but i had a lot of conflicts about package, and, once solved, i began to have problems about lacks of functions not defined
2) i tried to use mvn install command, but it did not work, something like 100 errors displayed
3) i tried to open that project with intelliJ and then i tried to export jar file, but intelliJ told that it s an android project
does anyone have any idea about the procedure to include this library?
Thanks a lot in advance
you could give Jitpack a try. At least it worked for me..
See https://jitpack.io/
In essence: add following code to the build.gradle file of your project:
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
and add the following line to the dependencies section in the build.gradle file of your app:
`compile 'com.github.gturri:aXMLRPC:master-SNAPSHOT'`
here is what the dependency section looks like for me:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.github.gturri:aXMLRPC:master-SNAPSHOT'
compile 'com.android.support:support-v4:23.4.0'
}
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() }