Xamarin Android: FreshChat SDK Implementation in xamarin forms giving exception - android

I have downloaded Android SDK 5.1.0 from url https://github.com/freshworks/freshchat-android/releases
of SDK Documentation:
https://support.freshchat.com/en/support/solutions/articles/50000000207-freshchat-android-sdk-integration-steps#4.1-Conversations
to implement it in xamarin.android project and this sdk is using handlers for click and some other events.
I converted this jar file into .dll using Xamarin Android Class Library. (jar build action is InputJar).
When I rebuild this class library project then no errors came and it released .dll successfully
Then I referenced this dll into my project and I rebuild it.
Here, I got some handler related issues that these handlers are not registered/missing in activity.
(1) error: package com.freshchat.consumer.sdk does not exist
com.freshchat.consumer.sdk.FreshchatWebViewListener
(2) error: package com.freshchat.consumer.sdk does not exist
com.freshchat.consumer.sdk.FreshchatUserInteractionListener
(3) error: package com.freshchat.consumer.sdk does not exist
com.freshchat.consumer.sdk.FreshchatActionListener
This is Android Class Library where I added sdk
Here, I referenced ClassLibrary .dll
handlers from sdk is appeared as a interface
MainActivity.cs
Errors when I rebuild
When I click on one of these error then it shows some definition in referenced sdk:
com.freshchat.consumer.sdk.FreshchatWebViewListener
Codewise I have not consumed sdk function in the mainactivity.
It looks like sdk is using some handlers which need to define in the MainActivity.cs
Am I defining in a wrong way or path is wrong for this sdk implementation.
Please suggest how to fix these errors while class library implementation.

Related

How to effectively add dependency .aar file in Xamarin project?

I am trying to create a Xamarin project using PayTM android library. Since PayTM doesn't have a direct Xamarin binding I have added the appinvokesdk-1.2.aar in the Xamarin Android Biding library project. The build action for appinvoke is "LibraryProjectZip". Now the appinvoke library also have a runtime dependency on easypay-8.7.3-appinvoke.aar (I found this after checking the pom file for appinvoke.aar file). I have set the build action for the easypay aar file as "EmbdedJar". I have also tried setting it to "LibraryProjectZip","ReferenceJar" and "EmbeddedReferenceJar". During runtime I am getting the error as
Java.Lang.ClassNotFoundException: Didn't find class "easypay.listeners.WebClientListener" on path: DexPathList[[zip file "/data/app/com.edmatix.poc.paytmdemo1-WQf3uMctjbNHoAG_ZfsH3A==/base.apk"],nativeLibraryDirectories=[/data/app/com.edmatix.poc.paytmdemo1-WQ…}
Here is my environment details
Visual Studio for Mac 8.5.4 (Build 12)
AndroidX assemblies
Xamarin.Form 4.6.0.726
Android Minimum API version 22
Android Target API 28 (Android 9)
the class easypay.listeners.WebClientListener is only required during run time and not during compile time.
Can you please help about how to properly embed the dependency library?
Thanks
so this is what I did to solve the issue of missing .aar file during runtime. I added the second .aar file (easypay-8.7.3-appinvoke.aar) into another Xamarin binding project (as shown in here) and set the compile type as LibraryProjectZip. And that solved my issue with not finding the class in runtime.
Thanks
Please try to install Xamarin.Kotlin.StdLib in your Xamarin Android project. Installing the Kotlin package worked for me because I was using the .aar file which contains Kotlin code.
Install-Package Xamarin.Kotlin.StdLib -Version 1.3.50.1

GoogleMaps.LocationServices NuGet package says namespace could not be found

I am creating an android application using Xamarin on Visual Studio 2017. I am trying to use the NuGet package GoogleMaps.LocationServices using this guide (http://www.c-sharpcorner.com/blogs/find-latitude-and-longitude-using-c-sharp1). I have installed the package fine
But when I try to use the package on my code like the guide I following does I just get an error saying it can't find the namespace:
This means that I cannot create a GoogleLocationService() object which is what I need to do to create a Google Maps pin point using a list of location addresses.
Anyone got any idea why I'd be getting this error? Unsure if I just need to use a different namespace now as this guide was from 2013.
The GoogleMaps.LocationServices 1.2.1 NuGet package contains an assembly for .NET 4.0 and no other target frameworks. So it does not support Android projects. NuGet will not add a reference to the GoogleMaps.Gelocation assembly since it is in the lib/net40 directory so it not considered compatible.
Instead I would take a look at the Xamarin.GooglePlayServices.Location NuGet package.
Looking at the content of the NuGet package it has a content file GoogleMaps.LocationServices.readme.txt which seems to be why you can install it into a Android project. This GoogleMaps.LocationServices.readme.txt file is added to your project.
Ideally the NuGet package should have a readme.txt file in the root of the NuGet package and not add a file to the project. Such a readme.txt file would be automatically opened on installation by Visual Studio without the need to add anything to the project. Removing the content file would also prevent the NuGet package from being installed into an Android project, or any other unsupported project type.
The older GoogleMaps.LocationsServices 0.9.0 can be installed into an Android project but that seems to be because the NuGet package is not packaged correctly. The GoogleMaps.Gelocation assembly in this version of the NuGet package is in the lib directory and does not indicate any target framework so it is allowed in all project types, which does not seem to be correct.
It's hard to trace what a new signature of the methods are in 2017, but from my brief look if you change the version on a package to
0.9.0 and use namespace
using GoogleMaps.Geolocation;
The example should work.

Xamarin Forms references the wrong version of mscorlib (FSharp.Core)

Create a new blank solution in Visual Studio 2015.
Add a new Blank App (Android) under the F# menu.
Add the Xamarin.Forms NuGet package, Version 2.3.3.175.
The following warning message appears as a popover in MainActivity.fs:
The referenced or default base CLI library 'mscorlib' is
binary-incompatible with the referenced F# core library 'C:...\packages\Xamarin.Forms.2.3.3.175\lib\MonoAndroid10\FormsViewGroup.dll'. Consider recompiling
the library or making an explicit reference to a version of this
library that matches the CLI version you are using.
Later, when I try to instantiate a viewmodel (using ReactiveUI as my MVVM provider), I get this runtime error:
This usually happens because the wrong version of FSharp.Core is being referenced. It appears that this is a bug.
Are there any workarounds?

Change Android Studio doclet version

I need to generate the javadoc for a Library in Android Studio.
The problem is that, when I start to create the doc, I see the following logs:
Constructing Javadoc information...
Standard Doclet version 1.8.0_31
Building tree for all the packages and classes...
[...]
1 error
javadoc: error - com.sun.tools.doclets.internal.toolkit.util.DocletAbortException: com.sun.tools.javac.code.Symbol$CompletionFailure: class file for java.lang.FunctionalInterface not found
I don't know exactly what is the problem. I think it is the doclet version (it takes by default 1.8.0_31); I tried to modify it but I did not succeed... any help?
I am using Mac OSX and Android Studio 1.2.2

"Package does not exist" error using Android v4 Compatibility Library

I'm using MonoDroid 4.2 in Visual Studio 2010, and I'm trying to use ViewPager, Fragments, and other things from the Android v4 Compatibility Library.
I was able to add the project reference to Mono.Android.Support.v4.dll and at design time I get no errors and intellisense works fine.
But when I build, I get errors like this:
package android.support.v4.view.ViewPager does not exist
android.support.v4.view.ViewPager.OnPageChangeListener
If I double-click on the error, it opens the source java file that MonoDroid creates on the fly, and goes to the line with the problem:
public class ViewPagerTestActivity_MyPagerAdapter
extends android.support.v4.view.PagerAdapter
So it looks like Java can't find the library package, but I'm not sure why. Do I need to install that manually, and how do I tell MonoDroid where to find it?
After some research, I learned that I needed to actually install the support library. MonoDroid has .NET bindings for it, but the underlying java can't build without it, of course. Here are instructions for getting the support library and instructions for hooking it up to a MonoDroid project.

Categories

Resources