im getting error in my android project The import android.support.v7.app cannot be resolved and even i import library from properties .
which i downloaded from https://github.com/koush/android-support-v7-appcompat.
and added in project from properties but still getting error
You need to add the appropriate dependency to your module gradle.build file as follows:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.2'
}
Make sure to synchronize your build.gradle file (Right click on file --> Synchronize 'build.gradle') and Clean your project (Build --> Clean Project) after the change.
Related
I have an Android project in which I have been using ACRA 4.6.0 with a static jar file, all working fine. I have tried to change this to use the latest ACRA by the maven dependency in build.gradle:
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
testCompile 'junit:junit:4.12'
compile 'ch.acra:acra:4.8.5'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
}
in my build.gradle. However this causes the build to fail with errors like:
CJApp.java:13: error: cannot find symbol
import org.acra.ACRAConfiguration;
^
symbol: class ACRAConfiguration
location: package org.acra
So far as I can tell gradle is not downloading anything for acra. I have tried adding mavenCentral() to the repositories list with no effect.
What else do I need to do, and is there any way of determining just what gradle has downloaded?
Are you sure that the class org.acra.ACRAConfiguration is included in the new version: acra:4.8.5 which you're suddenly linking to? If not, this is a simple matter of incompatibility. In that case, it should be resolved if you step the version back to 4.6.0.
Have you checked that the build downloads the file from Maven Central? This should be clearly visible when giving gradle the -i flag - it will print every URL as it downloads them.
ACRAConfiguration has moved to org.acra.config. Just adjust your import.
So, I followed this tutorial to create a ListView with images using Volley but I am having this issue with the com.android.volley.xxxx import statements in LruBitmapCache.java, AppController.java, CustomListAdapter.java, and MainActivity.java. It shows as Unused import statements and its extension are in red saying Cannot resolve symbol xxxx. Volley.jar is already aded to app -> libs section.
Would appreciate any help.
I'd double check to make sure your build.gradle includes:
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
...
}
And also make sure you've ran a sync.
Add
compile 'com.mcxiaoke.volley:library:1.0.6#aar'
to your Gradle dependencies...
Add this in your build.gradle of your app
https://developer.android.com/training/volley/
implementation 'com.android.volley:volley:1.1.1'
I Added a External Library to my project by following
this method. and tried this method too this method too.
Gradle build got Finished and i got this line added to my build.gradle
compile 'com.github.castorflex.smoothprogressbar:library-circular:1.0.1'
Now i am trying to import this library in my class. But i can't do this. I took a look at the files and they are located in the build directory under the exploded-aar. so i added #aar to the compile line. Still there are no changes.
How can i import this library to my class or where i am going wrong?
Thanks in Advance
Well, you don't need to download anything or point your dependency to a file.
This dependency, as most of the dependencies you use, can automatically fetched from JCenter, biggest repository for Java and Android components.
All you need to do is:
Add JCenter as your dependencies repository.
Declare that you need the library-circular dependency. This can be found and copy/pasted from the file icon in particular package/version in JCenter.
Resync your Android Studio project with your Gradle build file. This is the 'sync' button in Gradle pane in Android Studio.
Here's what your build.gradle should include:
repositories {
jcenter()
}
dependencies {
compile(group: 'com.github.castorflex.smoothprogressbar', name: 'library-circular', version: '1.0.1', ext: 'aar')
}
in build. gradle put following code
dependencies {
compile fileTree (dir: 'libs', include: ['*.jar'])
}
Did you add the dependencies?
You can do so in the following way -
dependencies {
compile files('insert ParentFolder/external_library_name with the extension here')
}
Add it to build.gradle based in the app folder
1.Put the jar file into the libs folder.
2.Right click it and hit 'Add as library'.
3.Ensure that compile files('libs/abcdef.jar') is in your build.gradle file and Finally add the dependencies.
Eg.
dependencies {
compile fileTree(dir: '../jar', include: '*.jar')
compile project(':pull-to-refresh')
compile files('libraries/abcdef.jar')
}
Hope this helps :)
I have imported successfully from Maven Repository the com.actionbarsherlock:actionbarsherlock:4.4.0 and com.android.support:support-v4:20.0.0. But when i try to import
import com.actionbarsherlock.app.SherlockActivity;
it doesnt import and also if i try to run the application i get a similar error to:
Multiple dex files define Android studio error when trying to import Google Maps into Google Maps project
I dont get the point here why the action bar sherlock library is not imported correctly even that the maven repository is added to dependency correctly .
The problem is solved. I found out the solution by changing build.gradle of my app and adding the #aar part in the compile section of actionbarsherlock
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:20.0.0'
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0#aar'
}
This solved the problem and i found out the solution reading this:
https://code.google.com/p/maven-android-plugin/wiki/ApkLib
I am new to android studio.I am developing an app which uses Facebook SDK.I have downloaded Facebbok SDK and imported it as a module to my android project.I am using latest version of android studio.So I simply imported it and did not make any change in other files for this.First I am trying to use facebook login functionality.But when I build the app I am getting following error.
error: package com.facebook.android does not exist
I could see one solution as an answer to someone's question. But i could not understand it.Please somebody help me.
check you build.gradle
it should got this dependency
if you got library project:
dependencies {
compile project(':facebook');
}
if you got jar files in libs folder:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
}
or just add maven central dependency to:
dependencies {
compile 'com.github.asne.facebook:facebook:3.17.2'
}
You need to add dependencies on your gradle file :-
compile 'com.facebook.android:facebook-android-sdk:4.1.0'
above is path you need to add dependencies {} like below :-
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.facebook.android:facebook-android-sdk:4.1.0'
}
Is the facebook library is jar file or library project?
If is jar file, you just need to add jar file in libs folder and dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
} in build.gradle.
If is library project, you should modify your setting.gradle and build.gradle files.
Adding this line of code to the dependencies in the build.gradle file helped me get rid of the same error.
dependencies {
...
compile 'com.facebook.android:facebook-android-sdk:4.0.0'
}
From platform=android facebook developers
-the last line of the section "Add Facebook SDK to Your Project")