2

I started a new default working project in xamarin and I added the dll references for Xamarin.Android.Support.V4 and Xamarin.Android.Support.V7.AppCompat and I am getting errors.

Error: package android.support.v4.app.FragmentManager does not exist
android.support.v4.app.FragmentManager.OnBackStackChangedListener

Error: package android.support.v4.content.Loader does not exist
android.support.v4.content.Loader.OnLoadCompleteListener

...

enter image description here What have I done wrong?

Antonio Papa
  • 1,596
  • 3
  • 20
  • 38

3 Answers3

2

You 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.

See also http://developer.xamarin.com/Guides/Android/Platform_Features/Fragments/Part_4_-_Providing_Backwards_Compatibility_with_the_Android_Support_Package/#Adding_The_V4_Libraries_to_a_Mono_for_Android_Project

This might be related to this or this, which were solutions to common problems in the rev. 22 update.

Community
  • 1
  • 1
Endri
  • 714
  • 13
  • 34
  • You can specify more accurate solution instead of refering to other links – Faizan Mubasher Mar 08 '16 at 11:54
  • @Endri: When you take an answer AS IS from another question (http://stackoverflow.com/questions/13361613/package-does-not-exist-error-using-android-v4-compatibility-library) you should give credit and not pass it as your own. – Tipx Jun 05 '16 at 23:30
-1

try calling it with this:

using Android.Support.V4;
CDrosos
  • 2,418
  • 4
  • 26
  • 49
-1

I was reading another post in the xamarin forms with the same issue and this worked for me. I spent maybe an hour trying to figure out what to do and the guy I ran into said just to:

clean the solution, rebuild it, then it should be fixed.

Assuming the packages are still installed

  • This does not really answer the question. If you have a different question, you can ask it by clicking [Ask Question](https://stackoverflow.com/questions/ask). You can also [add a bounty](https://stackoverflow.com/help/privileges/set-bounties) to draw more attention to this question once you have enough [reputation](https://stackoverflow.com/help/whats-reputation). - [From Review](/review/low-quality-posts/17579407) – Vorsprung Oct 10 '17 at 09:45
  • @Vorsprung why do you think that this does not answer the question? _"clean the solution, rebuild it, then it should be fixes"_. It is maybe bad explained and a bit cluttered (the first sentence is useless), but it clearly indicates a solution, so I think this _is_ a perfectly legit answer. – Massimiliano Kraus Oct 10 '17 at 10:04
  • @MassimilianoKraus please see the community guidelines for answers here https://stackoverflow.com/help/how-to-answer . In particular, "do try to mention any limitations, assumptions or simplifications in your answer. Brevity is acceptable, but fuller explanations are better" Hope this helps – Vorsprung Oct 10 '17 at 11:54
  • @Vorsprung if an answer gives a solution, even if partial, not explained, badly formatted, or too brief, it remains an _answer_. A very poor one, but in this case you can simply downvote it. The flag "not-an-answer" applies in cases where the answer doesn't try to give a solution _at all_, deviating from the question, or giving just lateral thoughts, or trying to answer to other answers, or writing useless things or spam. See [this discussion on Meta](https://meta.stackexchange.com/questions/185073/how-do-i-properly-use-the-not-an-answer-flag/185074#185074). – Massimiliano Kraus Oct 10 '17 at 12:16
  • I don't agree with your analysis. We'll have to differ in our opinion – Vorsprung Oct 10 '17 at 18:35
  • Well to settle this because it seemed to have ended sour, I didn't answer the question: "What did I do wrong?" So Vorsprung isn't wrong. However, what I fail to understand is the purpose of arguing such a position when the purpose of asking "what's wrong?" is an underlying search for a solution. – Naoki95957 Aug 16 '18 at 07:24