How to make a Call in Android Studio using Twilio android sdk? - android-studio

I am trying to integrate twilio android SDK in android Studio for implementing the outgoing call.Its Working fine in Eclipse but after I added the TwilioClientService in manifest.xml file, App is crashing in Android Studio so that i could not able to connect the call.Could you please any one tell the solution for this.
This is the Error I got,
STACK_TRACE=java.lang.UnsatisfiedLinkError:
dalvik.system.PathClassLoader[DexPathList[[zip file
"/data/app/com.iw.infowave-1/base.apk"],nativeLibraryDirectories=[/vendor/lib64,
/system/lib64]]] couldn't find "libtwilio-native.so" at
java.lang.Runtime.loadLibrary(Runtime.java:366) at
java.lang.System.loadLibrary(System.java:988) at
com.twilio.client.impl.useragent.UserAgent.(UserAgent.java:16)
at
com.twilio.client.impl.CallControlManager.initialize(CallControlManager.java:189)
at
com.twilio.client.impl.CallControlManager.getInstance(CallControlManager.java:131)
at
com.twilio.client.impl.TwilioClientServiceImpl.initialize(TwilioClientServiceImpl.java:169)
at
com.twilio.client.TwilioClientService.onCreate(TwilioClientService.java:50)
at
android.app.ActivityThread.handleCreateService(ActivityThread.java:2761)
at android.app.ActivityThread.access$1800(ActivityThread.java:151)
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1386)
at android.os.Handler.dispatchMessage(Handler.java:102) at
android.os.Looper.loop(Looper.java:135) at
android.app.ActivityThread.main(ActivityThread.java:5254) at
java.lang.reflect.Method.invoke(Native Method) at
java.lang.reflect.Method.invoke(Method.java:372) at
com.android.internal.os.ZygoteInit$MethodAndArgsCaenter code
hereller.run(ZygoteInit.java:903) at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)

Twilio developer evangelist here.
It looks like you haven't imported the library into your project.
See where it says:
couldn't find "libtwilio-native.so" at
java.lang.Runtime.loadLibrary(Runtime.java:366) at
You need to have the twilioclient-android.jar in your libs folder and have it properly referenced.
If you want to see how to do that, the easiest way is to follow the docs here or have a look at this sample project I put together here.
UPDATE
Also, as a side-note, you have to absolutely make sure the .so files are accessible by your project. If you're using Gradle, all you need to do is create a new folder under src/main called jniLibs and add all the contents of the lib folder there. This will make sure all the native SDK files are correctly referenced. You can see that on the sample project i posted earlier
Let me know how it goes.

Related

Android studio sdk does not contain any platforms

I downloaded Android studio from their website for windows. It contained 790 Mb. But there is a message shown like
SDK is missing
I followed answers for this issue of missing android studio SDK in here. But my problem is not solved yet.
I have another problem. There is a message shown
SDK does not contain any platforms
when I chose the SDK location by going to configure > project defaults > project structure.
May be some files are not downloaded,try again with your internet connection.It will ask to download some additional files, press allow.
this problem faced by almost everyone due to network problem .
You can easily resolve this error. I suggest you ,if any of your friends already installed android studio then copy sdk from him/her and paste into your sdk path and don't forget to delete sdk.
In this process ,your internet should work so that rest of the things it can download .
this is the best and easy way to resolve sdk error.After that you can download platform tools easily by going to settings>>Android sdk>> sdk tools.
Open the SDK Manager to download the NDK bundle.When your download completed, maybe there'r two different folders you have. One is ndk-bundle the other is ndk/22.0.7026061(the version you choose to download). And just use the behind one
As the log said before. Make sure you have config the ndk.dir in local.properties or the system global path variable.Or you also can open the project structure dialog to choose the Ndk location.Still use the behind folder( ndk/22.0.7026061).
If you have config it and still have the same problem.you can use the SDK Manager to download the NDK lower version one(like 21.0.6113669).Cause it may not match to your AS version
Then repeat the step two
That's work nice for me

Android studio - Unable to add library from outside folder

I am trying to develop an android library and an app using Android Studio. For this, I need to use the library directly in my app project, so I can modify both the library sources and app sources easily.
I am using versions: Android Studio 3.1.2 and Gradle 4.4
First of all, I have tried both methods described in the documentation, but both methods duplicate the library.
Second, I tried to add the library from outside folder as described here, but I get the error:
Unable to find module with Gradle path ':mytestlibrary3-release' (needed by module 'app'.)
My test structure is like this:
In "Workspace" folder I have the app folder "MyApplication4" and library folder "MyTestLib3" containing the library module "mytestlibrary3" (I attached screens)
The application settings.gradle:
include ':app'
include ':mytestlibrary3-release'
project(':mytestlibrary3-release').projectDir = new File(settingsDir, '../MyTestLib3/mytestlibrary3')
and the application build.gradle:
...
dependencies {
...
implementation project(':mytestlibrary3-release')
}
What am I doing wrong here? My purpose is to use the code directly (similar to Eclipse "Add Project to Build Path" or link src folder to source) or to build and use the library as simple and elegant as possible.

Using Zxing Library in my aplication

I have seriously tried to find a method to integrate zxing library for my barcode scanning application and found some examples and tutorials, but they mostly concentrate on the code of integrating the project library. I have understood how to use it but my only issue is I cant seem to find a correct way to copy the new zxing library. Please can anyone guide me through which files to copy where or how to bind the project in Android Studio.
I believe you want to 'add' the zxing library in your Android Studio project.
If you are comfortable with using Gradle, just add the below line in your app's build.gradle file under dependencies.
compile 'com.google.zxing:core:3.2.0'
Build your project and then start integrating zxing by importing the required classes.
I hope this answers your question and solves your problem.

Rendering Android Studio

I'm a absolute beginner in programming but I'd love to create my own Apps to make my (and someone else's) everyday life a little easier. I just downloaded the latest version of Android Studio and installed it with all tools.
I wanted to create a "Hello World" App as shown in many tutorials on YouTube. I followed them step by step but there is always this Rendering Problem directly after I finished creating a blank activity.
Rendering Problems
The following classes could not be instantiated:
-android.support.design.widget.FloatingActionButton (Open Class, Show Exception, Clear Cache)
Tip: Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE
Exception Details
android.content.res.Resources$NotFoundException: Unable to find resource ID #0x1080029 at ....
I have no clue what the problem could be and how I solve it and all the answers on google and here on stackoverflow.com to a already existing Rendering Problem couldn't help me.
It's a bug in the Android Studio and Android Design Support Library (ver 23.2.0) that is solved in Dev/Canary channel.
For now, if you use the Stable update channel, you have to edit by hand the build.gradle file.
Under Project tool window -> Gradle Scripts open and edit the file build.gradle (Module: app).
Search for dependencies and make sure the com.android.support.design line looks like this:
compile 'com.android.support:design:23.1.1'
Save
Tools -> Android -> Sync Project with Gradle Files
Build -> Rebuild

Project is targeting frameworks not installed or are included as part of future updates to Visual Studio

I am attempting to convert the Microsoft.Health C# class library that is installed as part of the HealthVault SDK, using instructions provided here. After following these instructions, I get the following error when attempting to load the project into Visual Studio 2013.
"The project is targeting frameworks hat are either not installed or
are included as part of future updates to Visual Studio. See
http://go.microsoft.com/fwlink/?LinkId=287985"
Visiting the link takes me to .NET SDKs and Downloads. Once there, I have no clue on what needs to be done.
I do realize that one will have to leverage the Portable Class Library Contrib project to fill in some missing bits, especially code related to System.Security. This, I will deal with later.
Any one run into a similar problem?
Maybe so late but for those who have the same problem.
I had the same error in a project which was working perfect before updating VS2013 and finally after 3 hours looking for the source of the error I found that the error is about TargetFrameworkProfile.
In my case I sloved it like so:
Right click in the unloaded project in your solution and click Edit.
Find the TargetFrameworkProfile tag and set it as below:
<TargetFrameworkProfile>Profile78</TargetFrameworkProfile>
At a guess, this is because you need to specify the TargetFrameworkVersion and TargetFrameworkProfile properties in the project file. Compare the .csproj you are trying to create to a newly created PCL project file, and make sure that everything that's not specific to your project matches.
I ran into the same issue and got it resolved by installing the latest Visual Studio Update

Resources