xamarin android native library - No Packages Found - android

A few days ago I was able to create an android bindings library for a particular .jar without issue.
I attempted to make a new library in order to post a question sample on github, now JarToXml won't generate anything:
1>JARTOXML : warning J2X9001: Couldn't load class device/scanner/ScanConst : java.lang.ClassNotFoundException: device.scanner.ScanConst
1>JARTOXML : warning J2X9001: Couldn't load class device/scanner/ScannerService : java.lang.ClassNotFoundException: device.scanner.ScannerService
.... (Same error for all classes in .Jar)
1>BINDINGSGENERATOR : warning BG8601: No packages found.
I'm totally confused because in one project I can generate the bindings, yet in another I can't.
Jar file: https://github.com/mribbons/PM_Scanner/blob/master/device.scanner.jar?raw=true

Turns out the problem was the path of the 2nd binding library project - Java doesn't like #.

Related

Xamarin Android: FreshChat SDK Implementation in xamarin forms giving exception

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.

Xamarin Forms, Android - Java.Lang.ClassNotFoundException

I'm currently updating a Xamarin Forms App and suddenly experiencing this error on Android:
Exception {Java.Lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.GooglePlayServicesUtil" on path: DexPathList[[zip file "/data/app/com.alphacoreconsulting.tflmetrosound-Ek3U1cNyzLe9Jayp9enzXQ==/base.apk"],nativeLibraryDirectories=[/data/app/c…} Java.Lang.ClassNotFoundException
It triggers on this line:
Xamarin.FormsMaps.Init(this, bundle);
I've researched and I've ensured all packages are the same version:
Please would anyone be able to offer some help on this?
UPDATE:
I have since updated the proguard.cfg file and added this line:
-keep public class com.google.android.gms.common.GooglePlayServicesUtil
After adding this I am now experiencing this error:
no static method "Lcom/google/android/gms/common/GooglePlayServicesUtil;.isGooglePlayServicesAvailable(Landroid/content/Context;)I"
You will see this exception at runtime when code has been stripped from the executable usually by the linker or R8/Proguard. You can provide a configuration file to both tools allowing you to keep code the linker or R8/Proguard think you are not using. These tools are not able to properly detect code you use at runtime via reflection for example.
Here is the documentation for the linker configuration file. Another approach is to use a "LinkerPleaseInclude.cs" file manually referencing the code you do not want to be linked out.
Here is the documentation for the R8/Proguard configuration file.

Xamarin Android Binding Library NoClassDefFoundError google/protobuf/GeneratedMessageLite

we're making an Android Binding Library for the Polar SDK. Everything works well except for one method call (setLocalTime() - all other methods work) that fails with the following error:
Java.Lang.Throwable: Failed resolution of: Lprotocol/PftpRequest$PbPFtpSetLocalTimeParams; ---> Java.Lang.ClassNotFoundException: protocol.PftpRequest$PbPFtpSetLocalTimeParams ---> Java.Lang.NoClassDefFoundError: Failed resolution of: Lcom/google/protobuf/GeneratedMessageLite; ---> Java.Lang.ClassNotFoundException: Didn’t find class “com.google.protobuf.GeneratedMessageLite”
Does anyone know what could be the cause of this and how to fix it? Any help would be appreciated.
Turns out we were missing dependencies. Not sure why they aren't packaged with the SDK's .aar file. I re-read the SDK's readme and added the right protobuf jar downloaded from the maaven site. The missing jars were marked as EmbeddedReferenceJar in the Xamarin project.

Android project complaining "The type bolts.Task cannot be resolved. It is indirectly referenced from required .class files"

I'm trying to go through the Parse Mealspotting tutorial, but after adding the Parse library I'm getting weird errors. I've found other similar errors while googling, but nothing that has worked. Here's one. I also read to look at Adding the Support Libraries, but that didn't fix it.
Exact text is:
Multiple markers at this line
- The type bolts.Task cannot be resolved. It is indirectly referenced from required .class files
- The class file Task<?> contains a signature 'Ljava/util/Set<Lbolts/Task<*>.TaskCompletionSource;>;' ill-formed at
position 30
I don't care about the support libraries or what devices the app will work on, all I want is for this to work so I can go through the tutorial. Has anyone dealt with this before?
I have also tried creating a project that only supports Kit Kat and removed the support libraries, but it's still throwing the same error.
Try to add the bolts-android-1.1.3 lib in your project. You can find it in the Parse SDK zip file.
First, be sure that you have the Parse library in your lib folder.
I had the same problem and solved it by adding the bolts-android-1.1.3.jar (right click on your project properties and then java build path , tab libraries, add jars or externals jars) that i found in Parse-1.7.1.
Then clean your project and it should work.

Android - Could not find class ... referenced from

I'm writing my 4th year project and I am trying to add an external library but for some reason I can't seem to get this running. I have been Googling for days and I still can't seem to fix this problem.
I have tried the following:
1) I have added the jar file to the "libs" folder
2) I have added the jar file as a library
3) I've checked the library off in the "Build Path" > "Order and Export"
Anyone else have any possible suggestions?
dalvikvm(4015) : Could not find class 'org.ejml.data.DenseMatrix64F', referenced from method com.makarintosh.voweltutor.FormantTracker.findRoots
dalvikvm(4015) : VFY: unable to resolve new-instance 805 (Lorg/ejml/data/DenseMatrix64F;) in Lcom/makarintosh/voweltutor/FormantTracker;
dalvikvm(4015) : DexOpt: unable to opt direct call 0x17e3 at 0x05 in Lcom/makarintosh/voweltutor/FormantTracker;.findRoots
AndroidRuntime(4015) : at com.makarintosh.voweltutor.FormantTracker.findRoots(FormantTracker.java:157)
AndroidRuntime(4015) : at com.makarintosh.voweltutor.FormantTracker.doLPC(FormantTracker.java:122)
AndroidRuntime(4015) : at com.makarintosh.voweltutor.Recorder.processData(Recorder.java:61)
AndroidRuntime(4015) : at com.makarintosh.voweltutor.Recorder$1.run(Recorder.java:80)
The library I am trying to add is this:
https://code.google.com/p/efficient-java-matrix-library/
EDIT
I also forgot to mention that the error seems to occur only with the specified class, "DenseMatrix64F". Although other classes that I am using from the library seem to run just fine.
The error occurs during RUNTIME.
First, you need to Read the Liberary manual because it is the best reference for your liberary
You have two ways in Android to add liberaries. First, to add a liberary project from Project>Preferences(Properties)> Android> Add Liberary project. Second to have a .Jar file and copy it into your project in Libs directory.
Sometimes you need to Clean and Build the project again after importing your liberary.
Look for this link and examples for your lib, it will help https://code.google.com/p/efficient-java-matrix-library/wiki/EjmlManual

Categories

Resources