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

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.

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.

Imported type defined multiple times on Xamarin Android

I'm getting the following error in my Xamarin.Android project:
The imported type Android.Support.v4.view.ViewPager is defined multiple times
I found this solution, but doesn not work. In fact I need to use the Google Play Store binding library and it uses both support v4 and v7. If I try to remove the v4 I get an error like this:
Unable to uninstall 'Xamarin.Android.Support.v4 20.0.0.4' because 'Xamarin.GooglePlayServices 19.0.0.1' depends on it.
ps: I'm using Facebook Android SDK and Crittercism components
The only working solution I found is the following:
remove the Xamarin.GooglePlayServices package (and its dependencies)
remove the Facebook component
install the Facebook component first
then install again the Xamarin.GooglePlayServices package
I don't know why this process is required, but it works

Using serial for android library

I'm trying to implement this https://github.com/mik3y/usb-serial-for-android/blob/master/UsbSerialExamples/src/com/hoho/android/usbserial/examples/SerialConsoleActivity.java in my project but there is something wrong with this sample.
Line 121:
sDriver.setParameters(115200, 8, UsbSerialDriver.STOPBITS_1, UsbSerialDriver.PARITY_NONE);
Why I can't see this method setParameters()?
I had the same problem when I tried to use the example project. The problem I had was that I was using usb-serial-for-android-v010.jar that you can download from the git repository. I think it was created using an older version of the project and doesn't support some of the newer features like setParameters. If you downloaded the example project there should be a folder inside called UsbSerialLibrary. Import that into your IDE and add it to your build path: (Eclipse) Properties>Java Build Path>Projects>Add. This should let you use setParameters.
Also, the API was recently refactored so you may want to look at that.

xmlvm - import errors compat libs in xcode

Does anyone know where the android compat libary is
located in xmlvm so I could copy it by myself to the project folder because this is
what I guess is missing, also would be provided by target=android-on-iphone but as mentioned below this target isn't available in the current build.
I had absolutely no problem installing xmlvm and getting in touch with the
demo/samples also all the demos worked perfectly for me.
But now im stuck at the last 4 errors in xcode, i migrated my android project via --
skeleton=android:migrate then cross-compiled it via --target=iphone and opened
up the project in Xcode. after few project setup changes the errors went down from
72 to 4 errors ;)
however the errors are importing file not found errors of compat libs, so this
should somehow get to be solved i think...
is it because --target=android-on-iphone wasnt used by me because this option
will copy the android compat libary to the project folder.. well i tried to use this
target mentioned in 2 documentations of xmlvm but in the actual build of xmlvm
this target however does not exist..
How to solve these errors?
Screenshots:
http://img526.imageshack.us/img526/8957/bildschirmfoto20120620u.png
http://imageshack.us/f/138/bildschirmfoto20120620u.png/
From what I can see, it looks like you are using part of the Android API which is not yet implemented.
Unfortunately it seems that you either need to rewrite your application or implement the API yourself.

Referencing Android custom library cause runtime class not found error in Application

I am working on a custom Android library. I start off with a java project (in Eclipse) with another UI testing Android project.
In my UI testing project, I reference the library project in build path, and everything is good and I can test the library codes in the UI.
Later on, I decided I need to have the 'Gen' code (for custom styles attributes), so I try to change my library to an Android project (via Android-tools -> convert.. ), and disasters happens! After fixing up all the compile time problems, it finally 'let' me start the UI testing application, and bangs! When I try to create any objects from the library class, it said (in the Log) that Class not found.
Two questions:
Any idea how to fix this? I tried but seems it is for referencing another .apk that need to install separately.
If I just keep it to be java project (not android) for my library, can I use the resource generator? and how?
PS: the dependency (my library) is installed before the UI test application, according to the Console of Eclipse said.
Update: I tried to compile the library project to jar and reference it from the UI testing, and in this way, it works. But I don't want to use this approach since it is very slow in terms of testing.
for those who are doing same mistake like me
when library project is an android project
got to
properties > android > click add button at bottom of the popup inside
library section
and add project, instead of
properties > java build path > project > add
later approach is for pure java projects only .
Finally I found the answer to my own question. This is actually mentioned in official documentation.

Categories

Resources