Building an android bundle with VS19Comunity

JKnottJKnott Member ✭✭✭
Hello, I've been trying to build my app as a bundle as Google wants, but every time I try to upload the package, I get an error saying that it is not signed. My APK's work fine but I guess the archive tool is not smart enough to apply the apk signing process to the bundle package.
Does anyone have it working?
Do I need to write some shell scripts to run post build?
I could probably toss together something with perl or python easily enough...

Any advice is greatly appreciated!

Cheers!
Jesse

Best Answers

  • WendyZangWendyZang Xamurai
    Accepted Answer

    Did you sign the package before you get error?
    You could try sign the aab package with some extra msbuild arguments.
    Please check the link. https://progrunning.net/create-xamarin-forms-android-aab-and-release-to-google-play-store-with-devops/

  • JKnottJKnott ✭✭✭
    Accepted Answer

    @GrahamMcKechnie , Sadly all I can do with the project settings is APK signing. I found out that I can manually sign the AAB using the following steps
    1) Set the build target to AAB in the project file.
    2) Uncheck signing from the APK signing option in the project options.
    3) Archive the build using VS normally.
    4) Perform an Ad-Hoc Distribution signing the AAB that way.
    5) Upload in the Google portal normally.

    In the past I was having the problem that the Archive process from VS was not signing the AAB (it was only able to sign the APK, but no option for the AAB). When I would attempt to upload the AAB built on in VS Google would report that the bundle was not signed.

    Thankfully I was able to figure this out (actually felt kinda dumb not realizing that's all I had to do)....

    I have to admit that I am glad I got the tutorial on setting up the Azure devops, I tried setting that up, but for some reason the build process was failing on the keystore file. Telling me that the keystore could not be opened and was probably password protected. I did implement it properly as best I can tell, but I will work on that again later since I have my local build environment working.

    If anyone is familiar with the particular error with the keystore (Google searches show it's not terribly uncommon evidently) I would love any recommendations on how to fix that issue.
    I was getting the error

    Error: "Cannot import the following key file: mykey.pfx. The key file may be password protected."
    Cannot import the following key file: mykey.pfx. The key file may be password protected. To correct this, try to import the certificate again or manually install the certificate to the Strong Name CSP with the following key container name: VS_KEY_C1D3ACB8FBF1AGK4

    As per one of the articles I read, I did try using x:\sn.exe -i keystore.pfx VS_KEY_C1D3ACB8FBF1AGK4
    But there was no change in my results.

    I will continue to work the issue on my own, having a distributed build environment has it's advantages after all, but since I have my local environment it's no longer pressing...

    Thanks again everyone for the assistance!

Answers

  • WendyZangWendyZang Member, Xamarin Team Xamurai
    Accepted Answer

    Did you sign the package before you get error?
    You could try sign the aab package with some extra msbuild arguments.
    Please check the link. https://progrunning.net/create-xamarin-forms-android-aab-and-release-to-google-play-store-with-devops/

  • JKnottJKnott Member ✭✭✭
    Excellent! Thanks, that looks exactly like what I'm looking for!
  • JKnottJKnott Member ✭✭✭

    @WendyZang I just realized that this was not exactly what I was looking for. The article seems to be using cloud services and azure to do the build. I am just using my local visual studio environment.
    Is it possible to build the AAB from VS directly?

  • GrahamMcKechnieGrahamMcKechnie AUMember ✭✭✭

    You put your signing information in your project settings - Android Package Signing.

  • JKnottJKnott Member ✭✭✭

    Please disregard, I realized I was not performing a simple step that was a part of the process.
    Thanks again for the article. I am trying to setup an azure portal, but am having issues with the keystore I may be back with questions on that, but thanks again for the tutorial, it helped immensely with getting an azure portal together.

  • JKnottJKnott Member ✭✭✭
    Accepted Answer

    @GrahamMcKechnie , Sadly all I can do with the project settings is APK signing. I found out that I can manually sign the AAB using the following steps
    1) Set the build target to AAB in the project file.
    2) Uncheck signing from the APK signing option in the project options.
    3) Archive the build using VS normally.
    4) Perform an Ad-Hoc Distribution signing the AAB that way.
    5) Upload in the Google portal normally.

    In the past I was having the problem that the Archive process from VS was not signing the AAB (it was only able to sign the APK, but no option for the AAB). When I would attempt to upload the AAB built on in VS Google would report that the bundle was not signed.

    Thankfully I was able to figure this out (actually felt kinda dumb not realizing that's all I had to do)....

    I have to admit that I am glad I got the tutorial on setting up the Azure devops, I tried setting that up, but for some reason the build process was failing on the keystore file. Telling me that the keystore could not be opened and was probably password protected. I did implement it properly as best I can tell, but I will work on that again later since I have my local build environment working.

    If anyone is familiar with the particular error with the keystore (Google searches show it's not terribly uncommon evidently) I would love any recommendations on how to fix that issue.
    I was getting the error

    Error: "Cannot import the following key file: mykey.pfx. The key file may be password protected."
    Cannot import the following key file: mykey.pfx. The key file may be password protected. To correct this, try to import the certificate again or manually install the certificate to the Strong Name CSP with the following key container name: VS_KEY_C1D3ACB8FBF1AGK4

    As per one of the articles I read, I did try using x:\sn.exe -i keystore.pfx VS_KEY_C1D3ACB8FBF1AGK4
    But there was no change in my results.

    I will continue to work the issue on my own, having a distributed build environment has it's advantages after all, but since I have my local environment it's no longer pressing...

    Thanks again everyone for the assistance!

  • GrahamMcKechnieGrahamMcKechnie AUMember ✭✭✭

    @JKnott. I gave up on the archive process years ago.

    All I do with my Release build is Clean, Deploy. That produces the aab in the Release/bin folder and deploys an apk to the connected device at the same time. I then just manually upload the aab to Google Play. All done in the time it takes to upload.

    All this presumes that you had previously enrolled in the aab process by uploading your original .pepk file

Sign In or Register to comment.