Cannot resolves symbol packetInterceptor - android

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.

Related

How to avoid migrating to AndroidX in react-native?

As Google APIs for Android introduced breaking changes as here I found my self un able to compile my react native android app, there are two things I need to know about:
How to avoid migrating to AndroidX and compile my project as I did before?
For example, when I have this error:
node_modules/react-native-firebase/android/src/main/java/io/invertase/firebase/ReactNativeFirebaseAppRegistrar.java:20: error: package android.support.annotation does not exist
import android.support.annotation.Keep;
how would include that missing package into build.gradle of that module?
I tried:
dependencies {
compile 'com.android.support:support-annotations:27.1.1'
}
but it did not help..
You can disable or avoid androidX with the following step
go to your android/gradle.properties file and paste or update the following
android.useAndroidX=false
android.enableJetifier=false
Although it does not update libraries we import or install, So all the libraries should be in AndroidX support otherwise project will not compile with this change I'm also having the same issue in my case project is fine but the problem is with the library called mapbox which have not support androidx I post the issue here you can check issue and comments.

installing repository for com.android.support.recyclerview-v7 for Android Studio error

I'm a beginner in android studio and I try to use a recyclerView. When I try to add compile 'com.android.support.recyclerview-v7:21.0.+' to my gradle file, I get the error:
failed to resolve com.android.support.receyclerview-v7v7:21.0.+.
It proposes me to install repository and sync project. when I click it, i get this error:
SDK Path C:\User\userName\AppData\Local\Android\sdk1
loading SDK information
ignoring unknown package filter 'extra-android-m2repository' warning: The package filter removed all packages. There is nothing to install. Please consider trying to update again without a package filter.
install failed, please check your network connection and try again. You may continue with creating your project, but it will not compile correctly without the missing components.
I mention that I'm using sdk 23.0.0 on a windows system, and when installing android studio for the first time I got an error message that concern proxy (that i unfortunately skipped)!!
Any idea to solve this problem ??!!!
First of all, run the SDK Manager and check if your support libraries repository is updated.
Then open your build.gradle (not the top level file) and add:
dependencies{
//....
compile 'com.android.support:recyclerview-v7:23.0.0'
}
Pay attention. You report in your question a typo in your library (compile 'com.android.support.recyclerview-v7:21.0.+')
Using the v23 you have to compile with API23.
Of course you can use a "old" version using:
compile 'com.android.support:recyclerview-v7:22.2.1'
compile 'com.android.support:recyclerview-v7:21.1.3'

How to import GcmListenerService in android studio?

I am creating android application 'GoogleCloudMessaging'. I Have found many that 'GcmListenerService' is being used and the old method 'GCMIntentService' is now deprecated.
I have already install the Google Play service and add it into the dependency.
But when i try to import
import com.google.android.gms.gcm.GcmListenerService;
it gives error "cannot resolve symbol."
How can I import the Class?
I refer https://developers.google.com/android/reference/com/google/android/gms/gcm/GoogleCloudMessaging and
https://developers.google.com/android/reference/com/google/android/gms/gcm/GcmListenerService.html#GcmListenerService()
and follow the things but still unable to solve the problem.
If you have already added Google Play Services to your dependencies, the issue might be its version.
Try to update the line(in your build.gradle) to:
compile 'com.google.android.gms:play-services:7.5.0'
Then sync your project.
You must include
compile 'com.google.android.gms:play-services-gcm:11.0.4'
in your build.gradle file.

Download smack4.1 from maven via Gradle fails

I am trying to migrate to smack 4.1. I followed the instructions provided at https://github.com/igniterealtime/Smack/wiki/Smack-4.1-Readme-and-Upgrade-Guide to add smack android to my project.
I get the following error when gradle syncs
4.1.1 is the latest version.
This is what I am using in dependencies section of my current project -
compile 'org.igniterealtime.smack:smack-android:4.1.1'
// Optional for XMPPTCPConnection
compile 'org.igniterealtime.smack:smack-tcp:4.1.0'
// Optional for XMPP-IM (RFC 6121) support (Roster, Threaded Chats)
compile 'org.igniterealtime.smack:smack-im:4.1.0'
// Optional for XMPP extensions support
compile 'org.igniterealtime.smack:smack-extensions:4.1.0'
This should solve your issue.
The error reported by Android Studio is that, it isn't able to find the smack-android-extensions and smack-tcp packages.
The reason was because, grade was configured in Offline Mode. It means that it won't go to the network to resolve dependencies.
Go to Preferences > Gradle and uncheck "Offline work" to disable offline mode. This solves the problem

Android Studio - Can't Resolve Dependencies

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 :)

Categories

Resources