Android Studio - Can't Resolve Dependencies - android

I've updated my android studio to v1.1.0 and since then i have a problem.
when i try to import for example this lib: compile 'com.nispok:snackbar:2.10.2' this error appears to me:
Error:(28, 13) Failed to resolve: com.nispok:snackbar:2.10.2
I noticed that i cant import every custom library that recently uploaded to jcenter.
For example i can compile this lib:
compile 'com.github.traex.rippleeffect:library:1.2.3'
because not updated recently. but i cant use this lib:
compile 'com.github.chenupt.android:springindicator:1.0.1#aar'
because updated recently. Can anyone help me plz?

I've find the problem. When I've updated Android Studio, the IDE automatically checked offline mode, and that was the reason why i couldn't import new version of libs :)

Related

Cannot resolve symbol 'androidx.constraintlayout.widget.ConstraintLayout'

Cannot resolve symbol 'androidx.constraintlayout.widget.ConstraintLayout'
I made an empty activity in Android Studio, ahead of nothing added, in activity_main.xml, there were so many red lines,and the prompt was: Cannot resolve symbol'
while, these code was generated by Android Studio, I tried file->invalidate cashes/restart... and installed all the SDK tools but Google series. The error was still there.
Gradle was successful, and JDK was installed.
Has anyone a solution ?
Make sure constraint layout is updated to latest version:
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
This is because your project support android legacy version, check this out in build.gradle, search for this key:
implementation 'com.android.support:appcompat-v7:28.0.0'
If confirmed, you should use the compatible version instead of the androidx version.
That is android.support.constraint.ConstraintLayout.
BTW, are you trying to follow the https://developer.android.com/guide demo? This tutorial sucks.

Unable to resolve imports from external dependencies in Android Studio 2.0 Preview 5 + Preview 6

After upgrading from the last Android Studio 2.0 preview to Preview 5 I'm having trouble with the imports from the android.support.wearable package.
Both the main app and Wear app builds and run just fine, but the editor in Android Studio complains that it can't resolve the these imports
import android.support.wearable.activity.WearableActivity;
import android.support.wearable.view.CircledImageView;
import android.support.wearable.view.WearableListView;
In the Wear module's build.gradle I have the following dependencies:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':common')
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:support-v13:23.1.1'
compile 'com.google.android.support:wearable:1.3.0'
provided 'com.google.android.wearable:wearable:1.0.0'
compile 'com.google.android.gms:play-services-wearable:8.4.0'
}
As I understand from http://developer.android.com/training/wearables/apps/always-on.html#EnableAmbient this should work when using the provided statement. And it has worked well until the Android Studio upgrade. Am I missing something?
Update:
This isn't just a problem with the Wear library, it's general for what seems to be any external dependency. (Topic originally was Unable to resolve package android.support.wearable in Android Studio 2.0 Preview 5.)
It seems like the problem can occur at any time, but in practice it happens mostly whenever I do lotsa changes in a class (maybe changes to the imports?). Just now it suddenly was unable to resolve the imports of Play Services and Facebook ads (while still working for other dependencies).
I accidentally found a workaround of the problem: If I open and build the project in Android Studio 1.5 which I also have installed, all the imports are fixed. Going back to Android Studio 2.0 I can continue programming without the imports becoming unresolvable for a long while.
For anyone googling the problem, the error message in Android Studio is the usual Cannot resolve symbol '[package]'.
I had this problem even before with AS 1.5, the easiest way for me to fix it was to use the Terminal inside Android Studio and execute:
./gradlew assembleDebug
This will work if you're not using flavors if not just use the name of the flavor, for e.g:
./gradlew assembleFlavorNameDebug
that should work too as a workaround without leaving your current instance of AS, and then the compiler recognizes your imports if everything is setup properly.
For more references please look: http://tools.android.com/build/gradleplugin
https://stackoverflow.com/a/21307568/799162

Failed to resolve appcompat-v7:15.+ in Android studio 1.4

I have installed android studio 1.4 on MAC 10.10.3 successfully. Now when I try to for demo app. development I see two errors in the main IDE, both of them are marked with arrow in the below figure
I clicked on the links (near the bottom arrow), it did some installations, but again errors were there. Now when I click on the links again it shows
Apart from this I followed other answers on stackoverflow, but with no success. Can anyone guess what can be the possible reason for both of these problems
Try this:
Change dependencies on your build.gradle your Support library.
compile 'com.android.support:appcompat-v7:22.2.0'
Try this:
compile 'com.android.support:appcompat-v7:23.1.1'
You should use the latest AppCompat library.
I also had the same problem, and after looking myself, I managed to resolve the error without accumulating any more errors by entering:
compile 'com.android.support:appcompat-v7:20.+'
My thinking is that it'll now just check for versions 7:20 and above.
Hope that helps.

I can't import card library in my Android Studio

Today I install Android Studio in my new Pc, I tried to start a new project but I couldn´t because I have this error when I try to compile some new library of Material Design as CardView or RecyclerView, I was reading about this problem and I tried to do everything, I installed all SDK, I change the library versions a lot times, but I cant resolve this =(.
This is the picture of my error:
Please, any help will be greatfully. I can´t program if I dont resolve this.
Import with compile 'com.android.support:recyclerview-v7:22.2.1' , this should work with API 22.
Click on Sync now in the warning on top of the code window.
If it doesn't work, try Build -> Rebuild Project. Seems that your gradle file doesn't refresh automatically
If it doesn't work check in the SDK Manager that you have install all the SDK pachages needed for those libraries and rebuild again.
Add card view lib from Open module settings-> app -> dependencies-> + -> Library dependency. It will be perfect . this happens you have updated version 22 installed in your sdk and not the previous version 21 .
or use
compile 'com.android.support:cardview-v7:22.2.1'
just use
compile 'com.android.support:recyclerview-v7:22.2.1'
as the popup says the library you try to import doesn't work with android version 22
and to make sure you don't import outdated libraries like this import them that way.
1-
2-
3-

Cannot resolves symbol packetInterceptor

I am trying to run the XMPP-based App Server based on Smack library
I'v added the required dependencies based on smack 4.1.0. I have problem with one Import:
import org.jivesoftware.smack.PacketInterceptor;
I experience the error message
Cannot resolves symbol PacketInterceptor
How do I resolve this?
If you are using gradle, use following dependencies
compile "org.igniterealtime.smack:smack-java7:4.0.1"
compile "org.igniterealtime.smack:smack-extensions:4.0.6"
compile "org.igniterealtime.smack:smack-tcp:4.0.6"
Or download the jar for the smack 4.0.6
Apparently, in the latest 4.1.0-Beta version they made some change to API but lack of enough clear documents.

Categories

Resources