I'm trying to use glide in Android Studio to deal with Gif animation from a resource stored in R.drawable but i get "cannot resolve sysmbol 'Glide'".
I've added glide to my dependencies in the builde.gradle
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
}
and i'm using the following code to set the image view to the gif.
ImageView img=(ImageView)findViewById(R.id.catImg);
int resourceId = R.drawable.gangrycat;
Glide.with(this.context)
.load(resourceId)
.into(img);
I solved this problem by removing dependency from builde.gradle and sync my project, then again add glide dependency to project builde.gradle and sync again.
I have also solved this problem by removing dependency and then again add glide dependency to project builde.gradle and sync again
I was also having the same problem. Initially, I added the following dependencies:
dependencies {
...
implementation 'com.github.bumptech.glide:glide:4.14.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.14.0'
...
}
I just downgraded the glide dependencies version to 4.12.0 and synced again
and it worked for me.
dependencies {
...
implementation 'com.github.bumptech.glide:glide:4.12.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
...
}
Below Dependency should be Used
/**
* Glide :- https://github.com/bumptech/glide
*/
implementation 'com.github.bumptech.glide:annotations:4.14.2'
annotationProcessor 'com.github.bumptech.glide:compiler:4.14.2'
implementation ("com.github.bumptech.glide:glide:4.14.2#aar") {
transitive = true
}
Related
After I updated the Android studio to 4.0 version, the color picker dependency is not working: "implementation 'uz.shift:colorpicker:0.5#aar'". I also try another dependencies but same issue.
build.gradle
repositories {
maven { url "https://dl.bintray.com/dasar/maven" }
maven { url "https://s3.amazonaws.com/repo.commonsware.com" }
maven { url "https://jitpack.io" }
maven { url "http://dl.bintray.com/dasar/maven" }
mavenCentral()
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//rate alert
implementation 'com.github.hotchemi:android-rate:1.0.1'
implementation "androidx.exifinterface:exifinterface:1.0.0"
implementation "androidx.appcompat:appcompat:1.0.0"
implementation "androidx.cardview:cardview:1.0.0"
implementation "androidx.recyclerview:recyclerview:1.0.0"
implementation "com.google.android.material:material:1.0.0"
implementation "androidx.palette:palette:1.0.0"
implementation "androidx.browser:browser:1.0.0"
implementation "androidx.legacy:legacy-support-v4:1.0.0"
implementation 'uz.shift:colorpicker:0.5#aar'
implementation 'com.github.jetradarmobile:desertplaceholder:1.1.1'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.github.yalantis:ucrop:2.2.2'
implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.10.0'
implementation 'jp.wasabeef:recyclerview-animators:2.2.7'
implementation 'com.github.HoraApps:Liz:-SNAPSHOT'
implementation 'com.github.lzyzsd:circleprogress:1.2.1'
// TODO check them out
implementation 'com.turingtechnologies.materialscrollbar:lib:10.0.3'
implementation 'de.psdev.licensesdialog:licensesdialog:1.8.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
}
Error
Failed to resolve: uz.shift:colorpicker:0.5
Show in Project Structure dialog
Affected Modules: app
Downgrade the version of gradle as of now, No proper solution is available.
It will work fine in ( Gradle Version - 5.6.4)
I've tried everything still it won't go away. As the problem struck when I downloaded the latest version. I simply switched back to the previous version of gradle and It's working fine now.
I have updated my Android studio to 3.2.1 since then am getting error as below
Unable to resolve dependency for ':app#debug/compileClasspath': Could
not resolve com.android.support:appcompat-v7:28.0.0.
hence unable to build my application
I have unchecked offline too
my dependencies in gradle file
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
kindly suggest a solution for this
Regards.
Nagendra
I think you are using old version of build tool in project level build.gradle.
Try
classpath 'com.android.tools.build:gradle:3.2.1'
Update your Android Gradle plugin
1- Upade the classpath in top-level build.gradle to:
buildscript {
....
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
}
2- Update the Gradle version to 4.6 in the gradle-wrapper.properties file by changing the distributionUrl to:
...
distributionUrl = https\://services.gradle.org/distributions/gradle-4.6-all.zip
...
3- Go to ReBuild Project
classpath 'com.android.tools.build:gradle:3.2.1'
add this to the dependencies of buildscript. then Sync the project.
Thanks for the response,
Isuue was with proxy blocking the downloads,i have commented the proxy in gradle.properties then its started working, i was trying in the office network.
Regards.
Nagendra
I am creating a new Android application that using Firebase. I followed goolge guide to add Firebase SDK to my project.
below are my project gradle:
buildscript {
repositories {
jcenter(){
url "http://jcenter.bintray.com/"
}
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
And application build.gradle
....
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
/* For Google Play Services */
//Firebase
//addd firebase notification - messaging.
//add firbaes dynamic link:
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.google.android.gms:play-services-safetynet:9.0.2'
compile 'com.google.android.gms:play-services-auth:9.0.2'
compile 'com.firebaseui:firebase-ui:0.2.2'
compile 'com.google.firebase:firebase-messaging:9.0.2'
compile 'com.google.firebase:firebase-invites:9.0.2'
compile 'com.google.android.gms:play-services:9.0.2'
}
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'
I checked in External library of my project. There are too many library that I don't not need such as: play-service-location-9.0.2, play-service-maps-9.0.2, play-service--nearby-9.0.2...
enter image description here
Could you explain and help me reduce unused library that I don't added into my project ?
Try removing the dependencies you don't need by deleting the dependency from the build.gradle one by one, if you get an error after removing one of your dependencies, add the dependency you just removed back.
As long as you get no errors or problems when removing the dependencies you don't need, everything will be fine.
I am requested to add a few dependencies. I know They should be added on build.gradle, but in the dependencies section is written:
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
I am new to android so from my small experience and googling there are supposed to be two build.gradle files, and only in one of them I should add dependencies, but I can not find an extra build.gradle file!?
I will be happy for help! Where should I add my dependencies and where did my second build.gradle disappear?
Gradle is a bit of an odd tool.
https://docs.gradle.org/current/userguide/artifact_dependencies_tutorial.html
They state here how it works. There is only one build.gradle per project that will pull and manage dependencies for you.
Android Studio extends this. There is one 'main' build.gradle for the entire project, and then for each submodule there is a build.gradle since they are run as separate programs. in the master project build.gradle, put dependencies that effect everything you are doing in the build process, and then for each module dependencies specific for those modules. That's what it's saying.
http://developer.android.com/tools/building/configuring-gradle.html
**EDIT: **
Android Studio docs:
Declare dependencies
The app module in this example declares three dependencies:
dependencies {
// Module dependency
compile project(":lib")
// Remote binary dependency
compile 'com.android.support:appcompat-v7:19.0.1'
// Local binary dependency
compile fileTree(dir: 'libs', include: ['*.jar']) }
Each of these dependencies is described below. The build system adds all the compile
dependencies to the compilation classpath and includes them in the
final package.
Gradle docs:
Example 7.1. Declaring dependencies
build.gradle
apply plugin: 'java'
repositories {
mavenCentral()
}
dependencies {
compile group: 'org.hibernate', name: 'hibernate-core', version: '3.6.7.Final'
testCompile group: 'junit', name: 'junit', version: '4.+'
}
Dependencies can be listed in a bunch of different ways.
I try to use Mockito from within Android Studio 1.2.2 but I get the following error:
Error:(50, 17) Failed to resolve: org.mockito:mockito-core:1.10.19
The error occurs when I sync Gradle after adding the dependency manually. This is the dependency in my module Gradle file:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.0'
testCompile 'org.mockito:mockito-core:1.10.19'
}
Could anyone help my resolve this issue?
Related questions:
Do I first need to download Mockito manually?
If so, where should I put it?
Note: the comments were helpfull to solve the above problem. However, it got me into another problem which I could not solve. But updating to Android Studio 1.3 solved it. I am now running Mockito from within Android Studio.
Try replacing testCompile with androidTestCompile, it works for me when importing Mockito libs.
However, you may run to a runtime error if you include only mockito-core. You'll need to add into your gradle:
androidTestCompile "org.mockito:mockito-core:1.10.19"
androidTestCompile "com.google.dexmaker:dexmaker:1.2"
androidTestCompile "com.google.dexmaker:dexmaker-mockito:1.2"
If you have error with dexcache, put this line into your setUp() (Assuming you are using InstrumentalTestCase)
System.setProperty("dexmaker.dexcache", getInstrumentation().getTargetContext().getCacheDir().getPath());
I was stuck into a similar problem, and adding the mockito jar file manually did the thing for me.
To do that, first create a directory called "libs" in your app directory. Take note that this directory should be in the same level as that of the src/main and build directories.
Next, download the mockito jar file and paste it into the libs directory.
Include that into your dependencies in the app level build.gradle file:
dependencies {
compile files('libs/add-your-jar-file-name-here')
}
Sync the gradle and that should do the job.
Refer to this answer for more detailed answer with snapshots.
androidTestCompile has now been replaced with androidTestImplementation
dependencies {
androidTestImplementation 'junit:junit:4.12'
androidTestImplementation 'org.mockito:mockito-core:1.10.19'
}
Make sure the test file is located under $your_module/src/test/java or $your_module/src/androidTest/java directory.