Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

failed to open APK: Iteration ended.

DileepKumar.2077DileepKumar.2077 USMember ✭✭
edited February 17 in Xamarin.Forms

I'm working in Xamarin forms project from past 6 months. Till now the development went well and after my windows 10 updated yesterday, My xamarin forms android is not getting build successfully. Its throwing error as "failed to open APK: Iteration ended."

Below are the two lines from output window

1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Aapt2.targets(155,3): warning APT2258: W/ziparchive(18668): Zip: Entry at offset zero has invalid LFH signature 929c1a24
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Aapt2.targets(155,3): error APT2096: failed to open APK: Iteration ended.

Please help in resolving this asap.

Posts

  • batmacibatmaci DEMember ✭✭✭✭✭

    how do you try to open an apk? please describe your problem better.

  • DileepKumar.2077DileepKumar.2077 USMember ✭✭

    I'm not opening the APK, I'm just building my Xamarin forms project which throws this error.

  • batmacibatmaci DEMember ✭✭✭✭✭

    sorry your title was confusing and i misunderstood. thats why titles are important. I read here 100s of questions and try to answer everyday. I think i read it too quick but did you really have to flag it?
    anyway, one of the older versions of VS 2019 had problem with appt2 as reported here but it should be solved with the latest releases. I have just tried on a test project and it seems to be working. I would suggest you to update to the latest if you hadnt. Otherwise please share your project configuration.

  • DileepKumar.2077DileepKumar.2077 USMember ✭✭
    edited February 27

    I'm using MS Visual Studio community 2019 16.4.5

    This issue was happening for all my android projects from my machine. I tried below things.

    1. I though may be some files of android got corrupted, so uninstalled and reinstalled VS completely.
    2. Changed the project path to a shorter path
    3. Created a new project and tried to build and got the same error
    4. Cleaning the project before build, but got the same error
    5. Tried the same project in some other machine, which is working perfectly.
  • DileepKumar.2077DileepKumar.2077 USMember ✭✭

    Finally after many trials I found the root cause for the issue. The issue is caused due to Android Platform Version 29. I deleted the folder
    C:\Program Files (x86)\Android\android-sdk\platforms\android-29
    and reinstalled SDK 29 and it worked.

    I had done this by reading in some blogs like Google had updated their SDK terms and conditions. While installing the updated terms and conditions date is mentioned as Jan 16 2020. Not sure this is the exact issue or not. But now everything works fine.

  • HowardBaylissHowardBayliss USMember ✭✭

    Hi @Dilipkumar.7949 - thanks for posting this - it helped me.

Sign In or Register to comment.