
#ANDROID STUDIO BUILD APK FAILURE HOW TO#
Happy coding.This page contains instructions on how to build your Unity application for Android as well as considerations to be aware of when you do. If you want to add any more points, please comment below. I hope you were able to learn something new today. Try running the app again and verify that no errors are present. It will regenerate with the correct file contents once you rebuild the project. Go to the destination folder and then delete the output-metadata.json file. As you can see, the file you shared here is describing the released APK.

This file is actually nothing but a description of the source APK. For every flavor dimension, whenever you sign an APK, it will have a separate folder with a corresponding output.json file in it. From the latest release of Android Studio 3.0 (canary and stable), they have organized this file structure. Even If you had multiple flavor dimensions for your APK, all of them could be located at the same directory, which was the output folder. So, what is an output-metadata.json? As explained here,įor older versions, what Android Studio did was generate a signed APK and put it in the “output” folder. It couldn’t really analyze it properly and hence this error occurred. So, Android studio was stunned at the speed at which these changes happened. "path": "app-type1-development-debug.apk", "outputFile": "app-type_1-development-debug.apk", The contents will be still that of the type_1 flavors. Now, if you check the above output-metadata.json. All of a sudden, you had to move to branch_2 and work on the flavor, type_2. Think you were working on branch_1 and your current flavor was type_1. And branch_2 flavor list contains type_2, and type_3 flavors. Imagine if branch_1 flavor list contains type_1, type_2, and type_3 flavors. And two different git branches have got different flavors as well. Which means, we are changing the logic or working of the application according to it’s flavors. Our project is running on multiple flavors. Before that, I will just explain the structure of the project/app I was working. I’ll explain the contents inside the output-metadata.json in a few minutes. "path": "app-type2-development-debug.apk", "outputFile": "app-type_2-development-debug.apk", output=D:\sample projects\sample_app\app\build\outputs\apk\debug\output-metadata.json So I went to the location shown in the error. Then again, will a change in the git branch can cause such an error? Probably not. I checked out from one git branch to another. When I thought about it carefully, I did change something. Because when the developer is troubled, the IDE will collapse. Then I realized there is no point in scrambling and letting the Android studio know I’m scared.

Such as, clean the project, restart the IDE, rebuild it, etc. I tried many other known troubleshoot methods. It should because it is the equivalent of a task manager in windows. So what happened?Īs every other Android developer does, I tried the mighty ‘Invalidate Cache/Restart.’ Hoping that this will solve the issue.
#ANDROID STUDIO BUILD APK FAILURE CODE#
And I was pretty sure I didn’t make any code changes. It was running without any errors all the while. Invalid main APK outputs : EarlySyncBuildOutput(type=c 1fdc3a85, apkType=MAIN, filtersData=, version=0, output=D:sample projects\sample_app\app\build\outputs\apk\debug\app-debug.apk),EarlySyncBuildOutput(type=c 1fdc3a85, apkType=MAIN, filtersData=, version=0, output=D:\sample projects\sample_app\app\build\outputs\apk\debug\output-metadata.json)

I was sipping my coffee, watching the Gradle building my app, and all of a sudden, an error popped up in the build window. Or maybe Android studio is still learning. Sometimes I feel like the world of Android development is funny. How to fix the error invalid main APK outputs in Android
