0

刚开始 GearVR 的 Unreal 开发,经过几天的 IDE 设置和配置后,在 hello-world 教程上遇到一个奇怪的错误。希望互联网的力量可以指导我。

完成本教程: https ://docs.unrealengine.com/latest/INT/Platforms/GearVR/QuickStart/index.html

当我在 Android ETC2 上构建时,我得到一个相当长的构建错误列表,并以无用的错误结束:

UATHelper: Packaging (Android (ETC2)): UnrealBuildTool: [buildconfig] Generating BuildConfig class.
UATHelper: Packaging (Android (ETC2)): UnrealBuildTool: 
UATHelper: Packaging (Android (ETC2)): UnrealBuildTool: -pre-compile:
UATHelper: Packaging (Android (ETC2)): UnrealBuildTool: 
UATHelper: Packaging (Android (ETC2)): UnrealBuildTool: -compile:
UATHelper: Packaging (Android (ETC2)): UnrealBuildTool:     [javac] Compiling 78 source files to C:\Users\User\Documents\VR\GearVR_test\Intermediate\Android\APK\bin\classes
UATHelper: Packaging (Android (ETC2)): UnrealBuildTool:     [javac] C:\Users\User\Documents\VR\GearVR_test\Intermediate\Android\APK\src\com\android\vending\licensing\APKExpansionPolicy.java:20: error: package org.apache.http does not exist
UATHelper: Packaging (Android (ETC2)): UnrealBuildTool:     [javac] import org.apache.http.NameValuePair;
UATHelper: Packaging (Android (ETC2)): UnrealBuildTool:     [javac]                       ^
UATHelper: Packaging (Android (ETC2)): UnrealBuildTool:     [javac] C:\Users\User\Documents\VR\GearVR_test\Intermediate\Android\APK\src\com\android\vending\licensing\APKExpansionPolicy.java:21: error: package org.apache.http.client.utils does not exist
UATHelper: Packaging (Android (ETC2)): UnrealBuildTool:     [javac] import org.apache.http.client.utils.URLEncodedUtils;
UATHelper: Packaging (Android (ETC2)): UnrealBuildTool:     [javac]                                    ^
...
UATHelper: Packaging (Android (ETC2)): UnrealBuildTool: BUILD FAILED
UATHelper: Packaging (Android (ETC2)): UnrealBuildTool: C:\Users\User\AppData\Local\Android\sdk\tools\ant\build.xml:716: The following error occurred while executing this line:
UATHelper: Packaging (Android (ETC2)): UnrealBuildTool: C:\Users\User\AppData\Local\Android\sdk\tools\ant\build.xml:730: Compile failed; see the compiler error output for details.
UATHelper: Packaging (Android (ETC2)): UnrealBuildTool: 
UATHelper: Packaging (Android (ETC2)): UnrealBuildTool: Total time: 29 seconds
UATHelper: Packaging (Android (ETC2)): UnrealBuildTool: UnrealBuildTool Exception: System.IO.FileNotFoundException: Could not find file 'C:\Users\User\Documents\VR\GearVR_test\Intermediate/Android/APK/bin/GearVR_test-debug.apk'.
UATHelper: Packaging (Android (ETC2)): UnrealBuildTool: File name: 'C:\Users\User\Documents\VR\GearVR_test\Intermediate/Android/APK/bin/GearVR_test-debug.apk'
UATHelper: Packaging (Android (ETC2)): UnrealBuildTool:    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
UATHelper: Packaging (Android (ETC2)): UnrealBuildTool:    at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)
UATHelper: Packaging (Android (ETC2)): UnrealBuildTool:    at UnrealBuildTool.UEDeployAndroid.MakeApk(AndroidToolChain ToolChain, String ProjectName, String ProjectDirectory, String OutputPath, String EngineDirectory, Boolean bForDistribution, String CookFlavor, Boolean bMakeSeparateApks, Boolean bIncrementalPackage, Boolean bDisallowPackagingDataInApk)
UATHelper: Packaging (Android (ETC2)): UnrealBuildTool:    at UnrealBuildTool.UEDeployAndroid.PrepTargetForDeployment(UEBuildTarget InTarget)
UATHelper: Packaging (Android (ETC2)): UnrealBuildTool:    at UnrealBuildTool.UnrealBuildTool.DoPostStartupStuffThatCanAccessConfigs(String[] Arguments)
UATHelper: Packaging (Android (ETC2)): CommandUtils.Run: Run: Took 112.6859102s to run UnrealBuildTool.exe, ExitCode=5
UATHelper: Packaging (Android (ETC2)): Program.Main: ERROR: AutomationTool terminated with exception: AutomationTool.CommandUtils+CommandFailedException: Command failed (Result:5): C:\Program Files (x86)\Epic Games\4.13\Engine\Binaries\DotNET\UnrealBuildTool.exe GearVR_test Android DebugGame -p
UATHelper: Packaging (Android (ETC2)): repfordeploy -project="C:\Users\User\Documents\VR\GearVR_test\GearVR_test.uproject" -NoHotReload -ignorejunk. See logfile for details: 'UnrealBuildTool-2016.09.04-17.16.25.txt' 
UATHelper: Packaging (Android (ETC2)):    at AutomationTool.CommandUtils.RunAndLog(String App, String CommandLine, String Logfile, Int32 MaxSuccessCode, String Input, ERunOptions Options, Dictionary`2 EnvVars, SpewFilterCallbackType SpewFilterCallback)
UATHelper: Packaging (Android (ETC2)):    at AutomationTool.CommandUtils.RunAndLog(CommandEnvironment Env, String App, String CommandLine, String LogName, Int32 MaxSuccessCode, String Input, ERunOptions Options, Dictionary`2 EnvVars, SpewFilterCallbackType SpewFilterCallback)
UATHelper: Packaging (Android (ETC2)):    at AutomationTool.CommandUtils.RunUBT(CommandEnvironment Env, String UBTExecutable, String CommandLine, String LogName, Dictionary`2 EnvVars)
UATHelper: Packaging (Android (ETC2)):    at AndroidPlatform.PostBuildTarget(UE4Build Build, FileReference UProjectPath, String TargetName, String Config)
UATHelper: Packaging (Android (ETC2)):    at AutomationTool.UE4Build.BuildWithUBT(String TargetName, UnrealTargetPlatform TargetPlatform, String Config, FileReference UprojectPath, Boolean ForceMonolithic, Boolean ForceNonUnity, Boolean ForceDebugInfo, Boolean ForceFlushMac, Boolean DisableXGE, String InAddArgs, Boolean ForceUnity, Dictionary`2 EnvVars)
UATHelper: Packaging (Android (ETC2)):    at AutomationTool.UE4Build.Build(BuildAgenda Agenda, Nullable`1 InDeleteBuildProducts, Boolean InUpdateVersionFiles, Boolean InForceNoXGE, Boolean InUseParallelExecutor, Boolean InForceNonUnity, Boolean InForceUnity, Boolean InShowProgress, Dictionary`2 PlatformEnvVars, Nullable`1 InChangelistNumberOverride, Dictiona
ry`2 InTargetToManifest)
UATHelper: Packaging (Android (ETC2)):    at Project.Build(BuildCommand Command, ProjectParams Params, Int32 WorkingCL, ProjectBuildTargets TargetMask)
UATHelper: Packaging (Android (ETC2)):    at BuildCookRun.DoBuildCookRun(ProjectParams Params)
UATHelper: Packaging (Android (ETC2)):    at AutomationTool.BuildCommand.Execute()
UATHelper: Packaging (Android (ETC2)):    at AutomationTool.Automation.Execute(List`1 CommandsToExecute, CaselessDictionary`1 Commands)
UATHelper: Packaging (Android (ETC2)):    at AutomationTool.Automation.Process(String[] Arguments)
UATHelper: Packaging (Android (ETC2)):    at AutomationTool.Program.MainProc(Object Param)
UATHelper: Packaging (Android (ETC2)):    at AutomationTool.InternalUtils.RunSingleInstance(Func`2 Main, Object Param)
UATHelper: Packaging (Android (ETC2)):    at AutomationTool.Program.Main()
UATHelper: Packaging (Android (ETC2)): Program.Main: AutomationTool exiting with ExitCode=5 (5)
UATHelper: Packaging (Android (ETC2)): BUILD FAILED
PackagingResults:Error: Error Unknown Error

我可以做些什么来修复上面的错误来制作一个 APK,我应该怎么做才能理解和更好地谷歌诊断这些错误?

与此错误类似的谷歌搜索结果的参考:

4

1 回答 1

0

我没有为您提供完整的解决方案,但我确实认为我对这个问题有一个诊断(我也遇到过)。

出于某种原因,Codeworks Android SDK 设置包含依赖于过时版本的 org.apache.http 的元素。如果您使用的是 SDK 23 或更高版本,则此依赖项不再包含在构建设置中(旧版本存储在“可选”文件夹中),但 Unreal 构建/打包过程仍会尝试包含它。

我正在尝试找出 Unreal 构建的修复方法......到目前为止,我发现的最好的方法是将所有构建和打包设置更改为针对 Android SDK 和 NDK 21 或更低版本(很多人推荐 19,但是21似乎对我有用)。

不幸的是,这意味着您无法利用更新的 Android SDK 中包含的大量 VR 优化,因此我仍在寻找更好的解决方案。

以下是针对一般 Android 应用程序开发的这个问题的深入讨论:

Android Gradle Apache HttpClient 不存在?

...但是由于使用 Unreal,很多 Android 构建过程都被引擎混淆或自动处理,我还不知道是否有办法自定义 app.gradle 之类的文件来处理这个问题。

无论如何,希望这会有所帮助。

于 2016-10-10T21:53:00.880 回答