How to fix Xamarin.Android errors when updating Xamarin.Forms

AgredoAgredo USMember ✭✭
edited March 11 in Xamarin.Forms

I just updated to Xamarin.Forms 3.6. Now it is necessary to use as Target Version in Android 8.1.

Now I can not build the Android project anymore.

I want to make my App available for min, Android 7.1.

Here are some information:




How can I fix this issue?

Thanks

Agredo

Tagged:

Answers

  • jezhjezh Member, Xamarin Team Xamurai
    edited March 12

    You can try to update the Xamarin.Android.Support.x to the latest version (v28.0.0.1), and then try again.

  • ShantimohanElchuriShantimohanElchuri USMember ✭✭✭✭✭

    @Agredo When you updated XF to 3.6 in NuGet manager, that also should have updated the Android Support packages. It appears that didn't happen. So update them first.

    Also check if you have downloaded the Android API 27 SDK.

  • AgredoAgredo USMember ✭✭

    @ShantimohanElchuri @jezh Thank you for the answers. Should I first downgrade XF and then update the Android Libraries?

  • AgredoAgredo USMember ✭✭

    Here are my SDKs:

  • AgredoAgredo USMember ✭✭

    @ShantimohanElchuri @jezh I cant downgrade XF or Update the libraries because of the same error.

  • AgredoAgredo USMember ✭✭

    The error shows here up:

    package md51558244f76c53b6aeda52c8a337f2c37;

    public class FormsAppCompatActivity
    extends android.support.v7.app.AppCompatActivity
    implements
    mono.android.IGCUserPeer
    {
    /** @hide */
    public static final String __md_methods;
    static {
    __md_methods =
    "n_onBackPressed:()V:GetOnBackPressedHandler\n" +
    "n_onConfigurationChanged:(Landroid/content/res/Configuration;)V:GetOnConfigurationChanged_Landroid_content_res_Configuration_Handler\n" +
    "n_onOptionsItemSelected:(Landroid/view/MenuItem;)Z:GetOnOptionsItemSelected_Landroid_view_MenuItem_Handler\n" +
    "n_onActivityResult:(IILandroid/content/Intent;)V:GetOnActivityResult_IILandroid_content_Intent_Handler\n" +
    "n_onCreate:(Landroid/os/Bundle;)V:GetOnCreate_Landroid_os_Bundle_Handler\n" +
    "n_onDestroy:()V:GetOnDestroyHandler\n" +
    "n_onNewIntent:(Landroid/content/Intent;)V:GetOnNewIntent_Landroid_content_Intent_Handler\n" +
    "n_onPause:()V:GetOnPauseHandler\n" +
    "n_onRestart:()V:GetOnRestartHandler\n" +
    "n_onResume:()V:GetOnResumeHandler\n" +
    "n_onStart:()V:GetOnStartHandler\n" +
    "n_onStop:()V:GetOnStopHandler\n" +
    "";
    mono.android.Runtime.register ("Xamarin.Forms.Platform.Android.FormsAppCompatActivity, Xamarin.Forms.Platform.Android", FormsAppCompatActivity.class, __md_methods);
    }

    public FormsAppCompatActivity ()
    {
        super ();
        if (getClass () == FormsAppCompatActivity.class)
            mono.android.TypeManager.Activate ("Xamarin.Forms.Platform.Android.FormsAppCompatActivity, Xamarin.Forms.Platform.Android", "", this, new java.lang.Object[] {  });
    }
    
    
    public void onBackPressed ()
    {
        n_onBackPressed ();
    }
    
    private native void n_onBackPressed ();
    
    
    public void onConfigurationChanged (android.content.res.Configuration p0)
    {
        n_onConfigurationChanged (p0);
    }
    
    private native void n_onConfigurationChanged (android.content.res.Configuration p0);
    
    
    public boolean onOptionsItemSelected (android.view.MenuItem p0)
    {
        return n_onOptionsItemSelected (p0);
    }
    
    private native boolean n_onOptionsItemSelected (android.view.MenuItem p0);
    
    
    public void onActivityResult (int p0, int p1, android.content.Intent p2)
    {
        n_onActivityResult (p0, p1, p2);
    }
    
    private native void n_onActivityResult (int p0, int p1, android.content.Intent p2);
    
    
    public void onCreate (android.os.Bundle p0)
    {
        n_onCreate (p0);
    }
    
    private native void n_onCreate (android.os.Bundle p0);
    
    
    public void onDestroy ()
    {
        n_onDestroy ();
    }
    
    private native void n_onDestroy ();
    
    
    public void onNewIntent (android.content.Intent p0)
    {
        n_onNewIntent (p0);
    }
    
    private native void n_onNewIntent (android.content.Intent p0);
    
    
    public void onPause ()
    {
        n_onPause ();
    }
    
    private native void n_onPause ();
    
    
    public void onRestart ()
    {
        n_onRestart ();
    }
    
    private native void n_onRestart ();
    
    
    public void onResume ()
    {
        n_onResume ();
    }
    
    private native void n_onResume ();
    
    
    public void onStart ()
    {
        n_onStart ();
    }
    
    private native void n_onStart ();
    
    
    public void onStop ()
    {
        n_onStop ();
    }
    
    private native void n_onStop ();
    
    private java.util.ArrayList refList;
    public void monodroidAddReference (java.lang.Object obj)
    {
        if (refList == null)
            refList = new java.util.ArrayList ();
        refList.add (obj);
    }
    
    public void monodroidClearReferences ()
    {
        if (refList != null)
            refList.clear ();
    }
    

    }

  • ShantimohanElchuriShantimohanElchuri USMember ✭✭✭✭✭

    @Agredo I know about a folder where all these packages are downloaded to but don't know its name and location. Usually I have seen advise to delete all in that folder and just reload the solution and start the project. That will reload all required packages. Since I can't point you to that location, there is an alternative.

    Just uninstall XF for all projects and all remnant Android Support packages. Then clean install XF 3.6 to all projects. That should install the correct required support packages. Even if it installs API 28 packages, I remember, it should not matter as I experienced earlier before I installed API 28 SDK.

  • AgredoAgredo USMember ✭✭

    I uninstalled all Android libraries and XF. Now I can not install it anymore because of 104 Warnings

    and XF intsallation skips Android

  • jezhjezh Member, Xamarin Team Xamurai

    I have created a new app and tested the problem.
    When I uninstalled the Xamarin.Forms Nuget by checking the android checkButton as followings:

    After that operation, I try to install the Xamarin.Forms Nuget, I faced the same condtion of you

    In this condition, you just click the Install button , then the Xamarin.Forms Nuget will be installed totally.

    After several times tested , I think we should install Xamarin Android Nuget first, so we should uninstall the Xamarin Form.
    Then we can install the Xamarin.Android.Support.XX Nuget , (eg. Xamarin.Android.Support.Desigh) one by one
    after that we can install the Xamarin.Forms Nuget.

    Note: if you encounter some problem , you can try to delete the bin and obj folders , then restart VS.
    If you fail in installing the nuget, try it a few more times. (I have tested 6 times, 2 times failed)

    hope it can help you.

Sign In or Register to comment.