1
Answer

Xamarin deployment failing with zipalign.exe error

Photo of rasika patil

rasika patil

7y
136
1
I am using Visual studio 2017 and xamarin android forms for development. A simple nw app is failing to get deployed with zipalign.exe error. below are my build logs
 
1>C:\Program Files\Java\jdk1.8.0_152\\bin\jarsigner.exe -keystore
"C:\Users\\AppData\Local\Xamarin\Mono for
Android\debug.keystore" -storepass android -keypass android -digestalg
SHA1 -sigalg md5withRSA -signedjar bin\Debug\\App5.App5-Signed-
Unaligned.apk C:\Users\
\source\repos\App5\App5\obj\Debug\android\bin\App5.App5.apk
androiddebugkey
 
1>No -tsa or -tsacert is provided and this jar is not timestamped. Without a timestamp, users may not be able to validate this jar after the signer certificate's expiration date (2048-01-09) or after any future revocation date.
 
1>C:\Program Files (x86)\Android\android-sdk\build-
tools\25.0.3\zipalign.exe 4 "C:\Users\
\source\repos\App5\App5\bin\Debug\App5.App5-Signed-
Unaligned.apk" "bin\Debug\\App5.App5-Signed.apk"
1>"zipalign.exe" exited with code -1073741819

Answers (1)

1
Photo of Vulpes
NA 98.3k 1.5m 13y
You should be able to do it as follows:

       foreach(int outerKey in outerDictionary.Keys)
       {
          Dictionary<int, List<int>> outerValue = outerDictionary[outerKey];
 
          foreach(int innerKey in outerValue.Keys)
          {
              List<int> innerValue = outerValue[innerKey];
              foreach(int item in innerValue)
              {
                 // do something with item
              }
          }
       } 
Accepted
0
Photo of Vulpes
NA 98.3k 1.5m 13y
OK, to iterate it now, the following should work.

As I'm not sure whether the two lists within each MyValue struct correspond to each other and therefore have the same number of items, I've iterated them separately for now:

       foreach(int outerKey in outerDictionary.Keys)
       {
          MyDictionary outerValue = outerDictionary[outerKey];
 
          foreach(int innerKey in outerValue.Keys)
          {              
              MyValue innerValue = outerValue[innerKey];

              foreach(int item in innerValue.lstPayPeriodID)
              {
                  // do something with item
              }

              foreach(DateTime item in innerValue.lstPaymentDate)
              {
                 // do something with item
              }            
          }
       } 


0
Photo of Dorababu Meka
NA 8.2k 1.2m 13y
Hi vulpes I am having an issue i.e for the first loop through first dictionary I am unable to get the Items for the first time

This is my code

Dictionary<int, MyDictionary> outerDictionary = new Dictionary<int, MyDictionary>();

This is how MyDictionary defined

public struct MyValue
    {
        public List<int> lstPayPeriodID;
        public List<DateTime> lstPaymentDate;
    }


    public class MyDictionary : Dictionary<int, MyValue>
    {
        public void Add(int key, List<int> lstpayID, List<DateTime> lstPaymntDate)
        {
            MyValue v1 = new MyValue();
            v1.lstPayPeriodID = lstpayID;
            v1.lstPaymentDate = lstPaymntDate;
            this.Add(key, v1);
        }
    }

This is how i added keys and values to the dictionary

for (int iempIdcnt = 0; iempIdcnt < EmpIDs.Length; iempIdcnt++)
        {
            if (!outerDictionary.TryGetValue(EmpIDs[iempIdcnt], out dictAddValues))
            {
                dictAddValues = new MyDictionary();
                outerDictionary.Add(EmpIDs[iempIdcnt], dictAddValues);
            }
        }


        for (int iDictCnt = 0; iDictCnt < iPayYear.Length; iDictCnt++)
        {
            if (!(dictAddValues.ContainsKey(iPayYear[iDictCnt])))
            {
                List<int> lstiPayperiodID = new List<int>();
                List<DateTime> lstiDateTime = new List<DateTime>();
                dictAddValues.Add(iPayYear[iDictCnt], lstiPayperiodID, lstiDateTime);
            }
            dictAddValues[iPayYear[iDictCnt]].lstPaymentDate.Add(dtPaymentDates[iDictCnt]);
            dictAddValues[iPayYear[iDictCnt]].lstPayPeriodID.Add(iPayPeriodID[iDictCnt]);
        }

As per your code I do this as follows

foreach (int outerKey in outerDictionary.Keys)
        {
            MyDictionary outerValue = outerDictionary[outerKey]; // Here I am not getting the values for first time..
            foreach (int innerKey in outerValue.Keys)
            {
                -------------------
                ------------------- My Code
                ------------------- 
             }
         }
           


0
Photo of Dorababu Meka
NA 8.2k 1.2m 13y

I expected the answer from you and you only replied, thanks for your quick answer vulpes.. You rock...