2
Error building Player: CommandInvokationFailure: Failed to re-package resources. See the Console for details.
C:\Users\4story\AppData\Local\Android\sdk\build-tools\24.0.0-preview\aapt.exe package --auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S "res" -I "C:/Users/4story/AppData/Local/Android/sdk\platforms\android-23\android.jar" -F bin/resources.ap_

stderr[

]
stdout[

]

Please help me fix this. Why can't I build my project? I'm new to unity.

EDIT: UNITY VERSION: 5.3.4f1 64 bit Minimum api 10 aka 2.3.3 gingerbread (Note on sdk manager downloading sdk platform for gingerbread is not available for windows so I didnt download it... should I use higher api?) android sdk tools 25.1.1

Can I build empty project for android? I mean ive been making games with android studio and everything was working like a charm but unity cant build. Am I using a plugin? What's that?

There. Can you help me now?

EDIT2: I wasnt expecting anything to change and it didn't Empty project doesn't matter, repackaging resources still fails. Does the minimum API matter? (on the blank project I tried 2.3.1 (which was in by itself) and 6.0 (because I have everything installed there with sdk manager))

Does SDK platforms installed matter? Would It help to say that I get 2 Error messages, the above and one more which is exactly LIKE the above but below everything has this

UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.PostProcessAndroidPlayer.Exec (System.String command, System.String args, System.String workingdir, System.String[] progress_strings, Single progress_value, System.String errorMsg)
UnityEditor.Android.PostProcessAndroidPlayer.CompileResources (System.String stagingArea, System.String packageName, UnityEditor.Android.AndroidLibraries androidLibraries)
UnityEditor.Android.PostProcessAndroidPlayer.PostProcessInternal (System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry)
UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry)
UnityEditor.HostView:OnGUI()

Might aswell mention that I have to update bundle identifier every time I create a new project.

Thanks for the help thus far however. Really appreciated.

EDIT3 Android sdk folder looked more like [...]/appdata/local/android/sdk and now it looks like C:\AndroidSDK\Android\sdk (not Android-sdk unless thats what you meant). So first part didn't do anything

However when I downloaded the sdk you provided me I could build the project just fine! Thanks for your help. Alot. I even tested it on a real device and everything was working. Didn't even have to download unity 5.4 beta I guess it was just a wrong sdk. Thanks again.

Paris Opl
  • 35
  • 1
  • 1
  • 5

1 Answers1

6

I don't know what is causing this problem but do the following below. The problem will be fixed by the time you are done.

1. Make sure that there are no spaces in your SDKpath. So create a folder called AndroidSDK in the C directory.

2. Copy your Android-sdk folder to the C:/AndroidSDK directory.

Now, your SDK path should look like this:

C:/AndroidSDK/Android-sdk

3. Update your Android SDK path in the Unity Editor.

Now, check if it works by trying to Build for Android again.

If it fails, continue from below

4. Download Unity 5.4 beta.

5. Re-download SDK then copy the file to C:/AndroidSDK/Android-sdk.

6. Go back to Unity and Update the path

enter image description here

7. Build the Project for Android again, it will show an error and ask you to update SDK.

enter image description here

Click on the "Update Android SDK" buttom. Unity will Automatically update your SDK. Your SDK should then look like something below. Your problem should be gone by now.

enter image description here

Programmer
  • 121,791
  • 22
  • 236
  • 328