dotnetco.de

To upload an Android App Bundle you must be enrolled in App Signing by Google Play.

You get the following error message when uploading your Xamarin Forms .aab file to Google Play Store?

To upload an Android App Bundle you must be enrolled in App Signing by Google Play.

For me, it happened when I switched from APK to AAB. General explanation for switching to AAB could be found in Publish smaller apps with the Android App Bundle in Microsofts DevBlogs. But which key do you need to upload to Google Play Store?

In your Play Console, go to Release Management -> App signing. After agreeing on Googles Terms, you will find 3 options:

  1. Upload a key exported from Android Studio
  2.  Export and upload a key from a Java keystore
  3. Export and upload a key (not using a Java keystore)

As I use Visual Studio for Mac instead of Android Studio, Option 1 could be skipped.

Option 2 offers a command-line version and includes the necessary file, so let’s do this. Download the pepk.jar . I’ve copied it directly into the directory where my keystore is located so I do not need to take care of file paths. Now copy the command line proposed by Google Play Console, and modify it to your needs. In the end, it should look like this:

java -jar pepk.jar –keystore=mykey.keystore –alias=mykey –output=mykey_encrypted_private_key_PlayStore –encryptionkey=…
Of course you need to modify the “mykey” which is shown 3 times in the line.
If you are unsure about the file path of your keystore or the alias, you could find out in Visual Studio for Mac: Open Preferences -> Publishing -> Android Signing Keys. Right-click on the key and select “Show Alias Info“. Alias name is shown at the top, File Path at the bottom (typically it’s in Users/username/Library/Developer/Xamarin/Keystore/keyname).
After executing above java command, you should have a new file “mykey_encrypted_private_key_PlayStore” in the same folder.
Now upload this new file and publish your app 🙂
NLog Logo

Logging in Xamarin Forms using NLog

For exception logging you could use online services like Microsofts AppCenter but sometimes you need a more detailled log and more flexibility, like changing log target and log level on the fly. Therefore here is an overview how to do logging in Xamarin Forms apps using NLog. The summary is based on several other existing articles so you will find a link list at the end of this article.

What is NLog?

NLog already exists for years (first release was in January 2011). It’s a universal logger for .net applications. NLog is maintained on Github and released under BSD License so you could do nearly everything, like using in private and commercial applications etc. Configuration is done within config files and could be changed on the fly. You have different log levels (like debug, info, error) and different log targets (currently 89 different targets like file, console, etc). Check the NLog Wiki for more details.

Continue reading…

Some more tips for Grav and Twig

4 Years ago I already blogged some tips for using Grav. Here are now some more tips for using Grav and Twig. Of course you also should make sure to have a look at the official Grav Documentation which is very helpful!

Get all pages from a certain date range

One of the default values you typically set on a page is the date. If you need to count all the pages within a certain date range, here is an example counting all documents within subfolder ‘live’ from today:

{% set startdate = "today"|date("m/d/Y") %}
{% set enddate = "today"|date_modify("+1 day")|date("m/d/Y") %}
{% set currentmatches = page.find('/live').children.dateRange(startdate, enddate) %}
<p>{{ currentmatches|length }} pages found</p>

 

Continue reading…

Create Images for iOS and Android automatically

Android and iOS support using images in different sizes automatically. So to use this feature, you need to provide images in several formats. For Android (as defined in Android Developers Doc) it’s:

  • xxxhdpi: 4x (640dpi)
  • xxhdpi: 3x (480dpi) (75% of xxxhdpi)
  • xhdpi: 2x (320dpi) (50% of xxxhdpi)
  • hdpi: 1.5x (240dpi) (37.5% of xxxhdpi)
  • mdpi: 1x (160dpi) (25% of xxxhdpi)
  • ldpi: 0.75x (120dpi) (18.75% of xxxhdpi)

For iOS (as defined in Apples Human Interface Guidelines) it’s:

  • @3x
  • @2x (67% of @3x)
  • standard (33% of @3x)

Of course it’s best to get each file in each solution from your designer. But if you’re working on your own project, you might not have a designer. Nevertheless you should supply all these different image formats at least for performance reasons.

As I have already a Mac OS shell script for Automatic creation of App Logos in different sizes, here is an updated version for all images.

Continue reading…

Tips on Performance for Xamarin Forms Android and iOS

As I had to search around how to speed up Start Time of Xamarin Forms Android app, I’ve searched some blogs for general tips. As I know I need it probably later on again, I’ve wrapped some tips here.

These sources used are. If you want to know more about it, I’ve added the number of the reference to the tip so have a look there if you want to know more:

  1. Xamarin.Forms Performance from Microsoft, including Optimizing App Performance with Xamarin.Forms – Jason Smith from Evolve 2016.
  2. 5 Ways to Boost Xamarin.Forms App Startup Time from David Ortinau
  3. Xamarin.Forms Performance on Android by Jonathan Peppers
  4. Dual Splash Screen by Issac Kramer

Continue reading…

PushAsync is not supported globally on iOS, please use a NavigationPage

Ever ran into this problem? Easiest fix: Check your App.xaml.cs. Did you set your MainPage directly like MainPage = new StartPage(); ? If so, just change it to MainPage = new NavigationPage(new StartPage());

But it also appears where you cannot change it easily, e.g. if you are on a carousel page and want to open a new page using await Navigation.PushAsync(new myPage());

So instead of using PushAsync, the easiest solution is to use PushModalAsync, like

await Navigation.PushModalAsync(new myPage()); 

Now you might run into another problem: In some cases, myPage might be called via PushAsync and in some cases via PushModalAsync. So if you have a Back-Button on myPage, it might call PopAsync or PopModalAsync.

Continue reading…