Answered by:
Building an android bundle with VS19Comunity

Question
-
User387004 posted
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
Friday, January 24, 2020 2:52 AM
Answers
-
User387683 posted
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/
- Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
Friday, January 24, 2020 4:56 AM -
User387004 posted
@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: VSKEYC1D3ACB8FBF1AGK4
As per one of the articles I read, I did try using x:\sn.exe -i keystore.pfx VSKEYC1D3ACB8FBF1AGK4 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!
- Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
Saturday, January 25, 2020 6:04 AM
All replies
-
User387683 posted
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/
- Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
Friday, January 24, 2020 4:56 AM -
User387004 posted
Excellent! Thanks, that looks exactly like what I'm looking for!
Friday, January 24, 2020 5:08 AM -
User387004 posted
@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?
Friday, January 24, 2020 3:09 PM -
User1773 posted
You put your signing information in your project settings - Android Package Signing.
Friday, January 24, 2020 9:27 PM -
User387004 posted
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.
Friday, January 24, 2020 9:49 PM -
User387004 posted
@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: VSKEYC1D3ACB8FBF1AGK4
As per one of the articles I read, I did try using x:\sn.exe -i keystore.pfx VSKEYC1D3ACB8FBF1AGK4 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!
- Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
Saturday, January 25, 2020 6:04 AM -
User1773 posted
@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
Sunday, January 26, 2020 5:30 AM -
User1814 posted
Everything I've found via Google search on signing a .aab bundle file is unintelligible to me. The Google instructions for enrolling in their app signing is unintelligible to me. Why can't DevStudio just do it for me as part of the build process? Are there some intelligible instructions somewhere? I have a .aab file. I have a key store file. What to do?
Edit:
Changing my batch file for signing to this seems to work:
cd C:\MySolution\MyProjectAndroid\bin\Release copy com.MySolution.MyProjectAndroid.aab com.MySolution.MyProjectAndroid.tmp.aab del /f com.MySolution.MyProjectAndroid.aab "C:\Program Files (x86)\Android\android-sdk\build-tools\29.0.2\zipalign" -f -v 4 com.MySolution.MyProjectAndroid.tmp.aab com.MySolution.MyProjectAndroid.aab jarsigner -verbose -sigalg SHA256withRSA -digestalg SHA-256 -keystore c:\Licenses\MyProjectAndroid.keystore com.MySolution.MyProjectAndroid.aab KeyAlias
Is that right?
Friday, April 10, 2020 4:33 PM -
User381617 posted
@JTSoftware said: Everything I've found via Google search on signing a .aab bundle file is unintelligible to me. The Google instructions for enrolling in their app signing is unintelligible to me. Why can't DevStudio just do it for me as part of the build process? Are there some intelligible instructions somewhere? I have a .aab file. I have a key store file. What to do?
@JTSoftware - Did you ever get to solve this? I don't know why it is so complex.
Friday, December 11, 2020 10:21 AM