Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error signing and uploading APK on Xamarin.Android 9 and Visual Studio for Mac Beta

Just updated to the Beta Channel of VS4Mac and now when I'm attempting to upload the new APK this erros occurs.

Error: uploading 'package.name' APK signature is invalid or does not exist. Error from apksigner: ERROR (Jar signer APPNAME.RSA): Jar signature META-INF/APPNAME.SF indicates the APK is signed using APK Signature Schema v2 but no such signature was found. Signature stripped?

enter image description here

like image 383
Cássio Avatar asked Aug 03 '18 19:08

Cássio


People also ask

Does Xamarin work on Mac?

With Xamarin. Forms, you can use C# or XAML to build cross-platform user interfaces for iOS, Android, and macOS.

How do I install Xamarin app on Android?

Manual InstallationCopy the file to your Android device's physical memory or an SD card and then run the file from your device. Android, by default, blocks installation of Apps that are not from PlayStore. To install your App, you must enable it to accept the App installation from the Settings.

Does Xamarin support Android 12?

Forms. Android recently changed how splash screens work in Android v12. 0 (API Level 31).


1 Answers

I've run into this issue myself today. After spending the entire day trying to resolve it, I decided to try and manually sign the cert, which works. I can only guess that the latest build of Xamarin has some issue around apk siging.

Anyway, to manually sign the apk, here is a good article https://docs.microsoft.com/en-us/xamarin/android/deploy-test/signing/manually-signing-the-apk

In my case, I took the APK that was built and archived and then ran the following commands:

  1. zipalign -f -v 4 yourapk.apk yournewapk.apk
  2. apksigner sign --ks yourkeystore.keystore --ks-key-alias YourKeyStoreAlias yourapk.apk

You might need to add zipalign to your bash profile.

Anyway, it's not ideal but at least I can now deploy my apk and head to bed :)

like image 122
Click Ahead Avatar answered Oct 20 '22 11:10

Click Ahead