Android Build Problems and Workarounds

Windows did a sneaky update last week for me, and then never rebooted, forcing a complete wipe of windows and starting from scratch.

Upon installing Windows, Unity, Java, Android Studio and getting all the code back from the git repo, it wouldn’t build on android like it would before, giving me many many AndroidManifest errors (probably relevant to mention at this point I’m using the Ultimate Mobile asset from the asset store):

Attribute application@icon value=(@drawable/app_icon) from AndroidManifest.xml is also present at [:adnroidnative:] AndroidManifest.xml value=(@drawable/ic_launcher)

Suggestion: add 'tools:replace="android:icon" to <application> element at AndroidManifest.xml

First attempt was take the suggestion, add tools:replace where it suggested (note this also means adding
xmlns:tools=“http://schemas.android.com/tools” to the manifest tag if it doesn’t already exist. This didn’t work, same error.

Second attempt - I figured ok these all want to be ic_launcher instead of app_icon (I couldn’t figure where ic_launcher is being written at the time but was easy to see where app_icon was being written). I changed app_icon to ic_launcher and it seemed to work! Apart from some similar issues in the androidmanifest.xml files it seemed to now build. However it was somehow getting the app name in dialogue windows of the app as AndroidNative and my icon was being overwritten somewhere. I knew that apk files are basically zip files so download APK Icon Editor, edited the APK’s icons and saved it (using the keystore file from unity to sign it again, not the default from APK Icon Editor) and then reuploaded. The app did not work well at all.

I tried going back months in my git repo, rolling back android build tools, building with gradle, ilcpp and each seemed to bring new and different problems.

Finally I got round to realising that .aar files are another thing thats just a compressed file and can be opened with WinRar with no dramas, after a failed build the Temp folder of my Unity Project is filled with all the android manifest files so used Notepad++ to search in all files for all occurences of any errors that were occuring and fixed them one by one (everywhere got converted to app_icon for example, removed any icons from the .aar files that weren’t wanted in android native, so many other small issues that I found but were relatively straight forward to fix from the error messages).

Great, no more AndroidManifest.xml errors, but a new error:

Something went wrong when parsing the generated resources - couldn't find a directory matching Temp/StagingArea\gen

For me, what this meant was that I had broken one of the AndroidManifest.xml files, specifically a the “package” attribute was missing from a manifest tag. Easy to sort that one out after finding exactly what was wrong.

Next build error:
Building Error: Not a file %Path to projec5

Another not a very helpful error message by itself, but what this was trying to tell me is that I need to click “Browse” in publish settings and reselect my keystore file.

Next Build Error:

Facebook telling me my settings were incorrect… Ok, specifically: missing the debug keystore for facebook, telling me to start a new project in eclipse to create one. I have eclipse, but not for Android stuff, so I assumed starting a new project in Android Studio is what it really meant. I see it created a new debug.keystore in C:\Users\MyName.android\ . I’m not even sure this is right but I just copied the debug.keystore from my project across to there without even attempting a build first.

And now it works :slight_smile: 26 hours of sitting here trying to figure this out, not sure if any of this makes sense or will ever be useful to anyone (or myself if I get stuck again), but wanted to write it out incase anyone else ever suffers the misery that is android build issues.

For anyone experiencing such issues, please be aware that i provide a professional service for fixing this kind of issues.
While i am still remaining active on the forums, trying to help out other developers, sometimes, in urgent cases where a project must be delivered, getting paid help is the better option. In case anyone is interested - check out the link in my signature below.

I have the same error here. I’m using Ultimate mobile plugin from Assets Store. After remove the plugin, project builds and installs 100% on android.
Don’t know what the problem is, but i’m sure has something with android libs incopatibility.

My setup is unity 2017.1.0.f1, Android minimum API level 16, and target API level 25.
Android SDK configured/update by Android Studio (sdk manager) with Android Tools 26.0.2, and SDK 26,25 and 22 instaled.

Problem solved downgrading Android tools to 25.2.3.

1 Like