Twilio: Android dependencies issue - android

I'm currently implementing two Twilio SDKs:
Programmable Video
IP Messaging Client
I'm realizing that one dependency affects the other, or at least so I believe, since I first implemented the IP Messaging Client and it worked flawlessly, and now that I've added the dependency for Programmable Video, when I try to run the project, it says it cannot find 3 of the used classes for IP Messaging Client in the package com.twilio.common, but those for Programmable Video are found. Here's part of the gradle (Module):
dependencies {
compile 'com.koushikdutta.ion:ion:2.1.7'
compile 'com.twilio:ip-messaging-android:0.8.1'
compile 'com.twilio:conversations-android:0.12.2'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
}
Also the classes that I have the conflict with of IP Messaging Client (they aren't in the package, the other clases are):
import com.twilio.common.TwilioAccessManager;
import com.twilio.common.TwilioAccessManagerFactory;
import com.twilio.common.TwilioAccessManagerListener;
And the classes of Programmable Video that I'm using:
import com.twilio.common.AccessManager;
import com.twilio.conversations.IncomingInvite;
import com.twilio.conversations.LogLevel;
import com.twilio.conversations.TwilioConversationsClient;
import com.twilio.conversations.TwilioConversationsException;
Note that class AccessManager from Programmable Video is the same and it's at the same level that class TwilioAccessManager used for IP Messaging Client, which in theory work equally. But the other classes can't be found.
I'm hoping anyone can help me! Regards!

Twilio Developer Evangelist here.
We had a dependency conflict with com.twilio:ip-messaging-android:0.8.1, but have now fixed that and the fact that they use two different AccessManagers in 0.9.0. this should solve the problem you're encountering.
So please update your gradle file to be:
dependencies {
compile 'com.koushikdutta.ion:ion:2.1.7'
compile 'com.twilio:ip-messaging-android:0.9.0'
compile 'com.twilio:conversations-android:0.12.2'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
}
More information about this update can be found here. Hope this helps you

Related

Error with import statement for FloatingActionButton and Snackbar

I'm working on an assignment for an online course on Udacity. The starter code can be found here.
The only thing I've done to the starter code was to add a new Activity with New > Activity > Basic Activity. I then got import errors in the two lines
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
Specifically, I get a Cannot resolve symbol 'FloatingActionButton' and same for Snackbar.
I've spent the past hour here (was having another problem before this one, also with import statements but in the MainActivity), and have tried the following:
Changing the appcompat on build.gradle file
File > Invalidate caches / restart
Build > Rebuild project
Sync project with Gradle files
Re-installing Android Studio
None of this worked.
The build.gradle file is
dependencies {
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:support-v4:23.3.0'
compile 'com.android.support:design:23.3.0'
}
I'm not really sure what started the error(s) to begin with since it's been a complete rabbit whole but I think it was after doing some update to Android Studio.
Can anyone please point me to the solution?
While adding dependencies, just use the same dependency version (which is available on local machine) across similar dependency packages so use
compile 'com.android.support:design:23.4.0'
instead of
compile 'com.android.support:design:23.3.0'
Note : I also recommend to work with latest dependencies and android studio which improved and thus more helpful (there's been some great improvement in latest android studio IDE to handle build errors)

How do I identify and import only specific libraries from Google Play Services?

I currently have the following line in my dependency:
compile 'com.google.android.gms:play-services:4.2.42'
I put this in longn back when I was just starting out to code my app and now I realize that this is what is probably causing my app to bloat at about 20 MB
Is there a way to identify and specifically import only necessary services to reduce my app size? I am pretty sure there are ways to import only specific modules, but also pointers on how I can identify which modules I need will be appreciated
From version 6.5, you can instead selectively compile Google Play service APIs into your app,
For example, to include only the Google Fit and Android Wear APIs, replace the following line in your build.gradle file:
compile 'com.google.android.gms:play-services:8.4.0'
with these lines:
compile 'com.google.android.gms:play-services-fitness:8.4.0'
compile 'com.google.android.gms:play-services-wearable:8.4.0'
please check this link
First, you need to check your project & identify which Play Services Modules are used. Then, You can selectively add the play services APIs which are necessary to your project.
For Ex : The below will be add Google Analytics and Maps modules to your app.
dependencies {
compile 'com.google.android.gms:play-services-base:8.4.0'
compile 'com.google.android.gms:play-services-analytics:8.4.0'
compile 'com.google.android.gms:play-services-maps:8.4.0'
}
You can use something like this
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.google.android.gms:play-services-location:8.4.0'

Where exactly to put gradle dependecies in Android Studio?

i created a fresh project in the Android studio and i would like to add this logging plugin.
https://github.com/orhanobut/logger
So i copied all into ProjectDirectory/app/build.gradle go get something like this.
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.orhanobut:logger:1.11'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.0.0'
compile 'com.squareup.okhttp:okhttp:2.0.0'
}
But after the rebuild process Android studio is still import wrong class:
import java.util.logging.Logger;
So i think, that dependency was not imported correctly.
How can i do it it the right way please?
Well it worked in mine just fine,type Logger. and it will give a suggestion window with 2 types of logger like it always does when multiple import types are available and select the one which belong to your lib.
The line 'com.orhanobut:logger:1.11' assumes that you have declared a repository that hosts the artifact it identifies.
If you have declared a valid repository, you've most likely been tricked by auto-import. Remove the import and be sure to select the proper logger import when prompted.
If gradle build completed successfully without errors, then the import was completed correctly. However in your java classess, if you have 2 libraries with the same name (as in your case, there is 2 logger libraries) you can type logger then press ctrl + space to open a menu that lets you choose which logger library to use.

Android Smack MessageEventManager not compiling

I am using smack API with openfire server to make an android app. I am trying to implement a MessageEventManager and MessageEventProvider to my app so it will tell me if the message was delivered or not though when i try to declare it a MessageEventManager, it is not compiling and tells me to create that class, What can i do? i have the following dependencies in my gradle:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'org.igniterealtime.smack:smack-android:4.1.0-rc1'
compile 'org.igniterealtime.smack:smack-tcp:4.1.0-rc1'
compile 'org.igniterealtime.smack:smack-im:4.1.0-rc1'
compile 'org.igniterealtime.smack:smack-extensions:4.1.0-rc1'
compile 'org.igniterealtime.smack:smack-android-extensions:4.1.0-rc1'
}
Do i need an extra for it? I would appreciate any help Thanks.
IMG:
Well, I might be wrong, but it seems it's not included in Smack4.1, I can't tell if it's deprecated or not since I haven't seen it on the deprecated lists, and the documentation exists here and here for the parent class.
But... what I did find is this SO answer by the Author of Smack, that clearly states that
Message events in SMACK are done via the now obsolete XEP-22. There is a good chance that the other side does not implement this out-dated mechanism.
Since this is dated 3 years back, it might be a good idea to look for another solution, or (depending on your needs, might not be recommended) use an older version Smack or aSmack.
Message event manager (XEP-22) are obsolete now, but smack team still maintain it. You can use smack legacy library throgh gradle
compile "org.igniterealtime.smack:smack-legacy:4.1.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