Saturday, July 2, 2016

GoogleAuthException: INVALID_AUDIENCE

I've been having some problems getting an Android app to properly authenticate with my app engine backend. For like weeks, spending the evenings looking through every single google result and trying out different combinations of peoples experience. Today, I finally figured out what my mistake was and I have to write this down.

The problem lies on this page and in this statement.
You need to specify your Android app's package name and SHA1 fingerprint.
  1. In the Package name field, enter your Android app's package name.

This is WRONG! It is in fact the applicationId in the build.gradle file that should be used. The package name in the manifest and the applicationId is most of the time the same, but in my it was not. And I never got the app to properly authenticate. But now it does and I'm happy again!

Thursday, June 30, 2016

Linux on Z83 mini PC

In my search for a replacement for my boxeebox that is closing in on its final days, the Z83 mini PC (sometime branded beelink) came up as a really cheap mini PC with great performance. Or maybe not so great, but for the price it is great. You get the point.

Anyway. It comes prepared with a windows 10 installation but I have no interest in using that. I intend to use a NFS share to deliver media to the box and that takes windows out of  the game fairly quickly.

It turns out putting Ubuntu on this machine is tricky, possibly impossible. It has a 32-bit UEFI system and Ubuntu does not distribute 32-bit UEFI installers. In fact, the particular chipset configuration based on the Intel Atom X5 Cherry Trail has quite a few pages about linux if you start searching for info. It seems mainly destined for tablets, but this Mini PC is a good application as well I suppose.

The closest I got to completing the install was using these instructions. By building this Ubunty/Debian 32/64-bit hybrid Live USB the system would actually boot from it. And work quite well. However, the installation failed giving an error about how uefi-boot-32 failed to install (quite accurate for an error message for once).

I turned away from Ubuntu for the first time in many years. And turned to Debian. Debian which provided the uefi capability to let the Ubuntu image boot in the instructions above. I used the amd64/i386 netinst image. And it just works. I installed the MATE desktop environment. It is fast, and it just works. A bit ugly, but that's ok.

Now, my only problem is that the projected screen doesn't fit the TV screen which makes menus invisible. But I'll get to that. Oh, and the wireless network doesn't work either.

Monday, June 6, 2016

Android studio upgrade to 2.1 broke my project

I decided to try out the new (and still in beta) Android studio 2.1 today. Easy peasy as usuall, just download and unzip and run studio.sh and everything starts up.

I suspected that it would not be as easy thou. I spend a lot of time (hobbytime) with bugs and issues in Android studio, the SDK management and the emulator. No changes in the dev environment comes without pain. And sure enough, I got a question about updating the gradle build files which probably broke the project.

I started getting some weird compilation errors regarding the appcompat style definitions.

Error retrieving parent for item: 
No resource found that matches the given name "Theme.AppCompat.Light.NoActionBar".

Google didn't help me much and I started trying to fix things. I spent maybe an hour trying to figure it out before I turned to source control. Which I should have done right away. Checking the git diff was all I needed. There, right before my eyes Android studio had simply washed away my project dependencies. This list was empty!

I took it all back. The only change I let Android studio have was the updated gradle version. That's it. And it was all that was needed. It works now, enough bleeding on the edge today.

Friday, April 22, 2016

Unity broke again, how to fix it.

Updated to Ubuntu 16.04 today. I always update as soon as I can. OS updates, as well as regular updates, does however have a tendency to break Unity. I bit too often I think. When it happens, there are millions of articles online on how to debug and try to fix it. I've come to a simple solution that always fixes this constantly regressing piece of software.

Step 1: Always accept the default settings. This makes step 2 easier.

Step 2: When it breaks:

sudo apt-get install unity-tweak-tool
unity-tweak-tool --reset-unity

Now you can keep using your Ubuntu like nothing happened. This method saves half a day of googling a few times a year.

Update 2016-04-30:

Seems that Xenial might not have been ready for release just yet. Further updates has broken unity once again. But, as previously stated, --reset-unity will fix it.

Thursday, April 21, 2016

Bleeding on the edge, Android development with DELETE_FAILED_INTERNAL_ERROR

I've been spending some time in Android Studio learning to develop android apps the last few weeks. And it is so extremely frustrating to consider how much time the development environment is stealing from me!

  • At home the emulator is really fast, but at work, with similar hardware and same OS it refuses to use acceleration.
  • The projects "break" every now and then. The "app" module is lost and nothing can be done but recreating the project again.
  • I forget to uncheck all those useless image updates when installing modules in the SDK. And have to wait for ever for them to download. Why are they checked by default every time?
And the last one. The one where the app refuses to install and you get the message
DEVICE SHELL COMMAND: pm uninstall your.package.name
DELETE_FAILED_INTERNAL_ERROR
Google has so many answers to this issue. Cleaning, restarting, reinstalling, deleting directories in Android and what not. Nobody seems to know why or what to do and yet it happens to me twice a week.

In the end there is only one solution that works, works fast and works every time. Go into the virtual device manager, click the drop down on your device and hit "Wipe Data"!


Stop spending time and try to fix this and just bite the bitter android until your lips start bleeding on the rough edges of the robot!