2
votes

When I try to build a .apk file it gives me the following 2 errors:

Error building Player: Win32Exception: ApplicationName='C:/Users/Teodor/AppData/Local/Android/android-sdk/platforms/android-18\aapt.exe', CommandLine='package -v -f -m -J gen -M AndroidManifest.xml -S "res" -I "C:/Users/Teodor/AppData/Local/Android/android-sdk/platforms/android-18\android.jar" -F bin/resources.ap_', CurrentDirectory='Temp/StagingArea' UnityEditor.HostView:OnGUI()

and

Exception: Error building Player: Win32Exception: ApplicationName='C:/Users/Teodor/AppData/Local/Android/android-sdk/platforms/android-18\aapt.exe', CommandLine='package -v -f -m -J gen -M AndroidManifest.xml -S "res" -I "C:/Users/Teodor/AppData/Local/Android/android-sdk/platforms/android-18\android.jar" -F bin/resources.ap_', CurrentDirectory='Temp/StagingArea' UnityEditor.BuildPlayerWindow.BuildPlayerWithDefaultSettings (Boolean askForBuildLocation, BuildOptions forceOptions) (at C:/BuildAgent/work/842f9557127e852/Editor/Mono/BuildPlayerWindow.cs:367) UnityEditor.BuildPlayerWindow.GUIBuildButtons (Boolean enableBuildButton, Boolean enableBuildAndRunButton, Boolean canInstallInBuildFolder) (at C:/BuildAgent/work/842f9557127e852/Editor/Mono/BuildPlayerWindow.cs:972) UnityEditor.BuildPlayerWindow.ShowBuildTargetSettings () (at C:/BuildAgent/work/842f9557127e852/Editor/Mono/BuildPlayerWindow.cs:953) UnityEditor.BuildPlayerWindow.OnGUI () (at C:/BuildAgent/work/842f9557127e852/Editor/Mono/BuildPlayerWindow.cs:726) System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation. System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/BuildAgent/work/842f9557127e852/Editor/Mono/GUI/DockArea.cs:225) UnityEditor.HostView.Invoke (System.String methodName) (at C:/BuildAgent/work/842f9557127e852/Editor/Mono/GUI/DockArea.cs:218) UnityEditor.HostView.OnGUI () (at C:/BuildAgent/work/842f9557127e852/Editor/Mono/GUI/DockArea.cs:119)

and I dont know how to fix it.

In Unity 4.2.0 it doesn't give me any errors, but in 3.4.2 even if the project contains just the main camera and a cube it gives me these errors and the .apk file is not built. How can I resolve this?

3
Have you set the Android SDK path in preferences? Have you ever been able to build for Android? Can you build Android applications using Eclipse? Have you switched to Android using "switch platform"?Sunkas

3 Answers

1
votes

Try to search the Android SDK directory for the file aapt.exe. In the later versions, it was moved to android-sdk/build-tools/18.0.0/. Look there and, if you find it, copy it from there to your android-sdk/platforms/android-18 folder.

1
votes

I had an error very similar to this. What solved it for me was installing the Android SDK Build Tools using the Android SDK Manager.

0
votes

There are some new Tools introduced in Android sdk -18 so the old unity version will not work with new android tools as most of them are changed.