27.2,我想将我的项目 pkg for android,但每次它都以:
结尾PackagingResults: Error: Unknown Error
操作系统:Windows 10 (64x)
SDK:29.0.2 和 28.0.3
NDK:21.1.6352462
JDK:Eclipse Termurin JDK 热点 17.0.5+8 (x64)
UATHelper: Packaging (Android (ASTC)): Z:\app\src\main\java\com\epicgames\ue4\WebViewControl.java:122: error: cannot find symbol
UATHelper: Packaging (Android (ASTC)): webView.getSettings().setAppCacheMaxSize( 10 * 1024 * 1024 );
UATHelper: Packaging (Android (ASTC)): ^
UATHelper: Packaging (Android (ASTC)): symbol: method setAppCacheMaxSize(int)
UATHelper: Packaging (Android (ASTC)): location: class WebSettings
UATHelper: Packaging (Android (ASTC)): Z:\app\src\main\java\com\epicgames\ue4\WebViewControl.java:123: error: cannot find symbol
UATHelper: Packaging (Android (ASTC)): webView.getSettings().setAppCachePath(GameActivity._activity.getApplicationContext().getCacheDir().getAbsolutePath() );
UATHelper: Packaging (Android (ASTC)): ^
UATHelper: Packaging (Android (ASTC)): symbol: method setAppCachePath(String)
UATHelper: Packaging (Android (ASTC)): location: class WebSettings
UATHelper: Packaging (Android (ASTC)): Z:\app\src\main\java\com\epicgames\ue4\WebViewControl.java:125: error: cannot find symbol
UATHelper: Packaging (Android (ASTC)): webView.getSettings().setAppCacheEnabled( true );
UATHelper: Packaging (Android (ASTC)): ^
UATHelper: Packaging (Android (ASTC)): symbol: method setAppCacheEnabled(boolean)
UATHelper: Packaging (Android (ASTC)): location: class WebSettings
UATHelper: Packaging (Android (ASTC)): Note: Some input files use or override a deprecated API.
UATHelper: Packaging (Android (ASTC)): Note: Recompile with -Xlint:deprecation for details.
UATHelper: Packaging (Android (ASTC)): 3 errors
UATHelper: Packaging (Android (ASTC)): > Task :app:compileDebugJavaWithJavac FAILED
UATHelper: Packaging (Android (ASTC)): FAILURE: Build failed with an exception.
UATHelper: Packaging (Android (ASTC)): * What went wrong:
UATHelper: Packaging (Android (ASTC)): Execution failed for task ':app:compileDebugJavaWithJavac'.
UATHelper: Packaging (Android (ASTC)): > Compilation failed; see the compiler error output for details.
UATHelper: Packaging (Android (ASTC)): * Try:
UATHelper: Packaging (Android (ASTC)): Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
UATHelper: Packaging (Android (ASTC)): * Get more help at https://help.gradle.org
UATHelper: Packaging (Android (ASTC)): BUILD FAILED in 19s
UATHelper: Packaging (Android (ASTC)): 32 actionable tasks: 3 executed, 29 up-to-date
UATHelper: Packaging (Android (ASTC)): ERROR: cmd.exe failed with args /c "D:\UEPro\MyProject2\Intermediate\Android\armv7\gradle\rungradle.bat" :app:assembleDebug
UATHelper: Packaging (Android (ASTC)): (see C:\Users\frans\AppData\Roaming\Unreal Engine\AutomationTool\Logs\C+Program+Files+Epic+Games+UE_4.27\Log.txt for full exception trace)
UATHelper: Packaging (Android (ASTC)): AutomationTool exiting with ExitCode=1 (Error_Unknown)
UATHelper: Packaging (Android (ASTC)): BUILD FAILED
PackagingResults: Error: Unknown Error
在 Android SDK 33 中,
setAppCacheMaxSize
、setAppCachePath
、setAppCacheEnabled
已删除:https://developer.android.com/sdk/api_diff/33/changes
Unreal Engine 有一个错误,它使用 sdkmanager 中安装的最高可用 Android SDK 版本。您可能没有使用 SDK 29.0.2 或 28.0.3,而是使用 SDK 33+ 构建它。
您有 2 个选择:
$UNREAL_INSTALL_DIR/Engine/Build/Android/Java/src/com/epicgames/ue4/WebViewControl.java
并删除(注释掉)这些行:webView.getSettings().setAppCacheMaxSize( 10 * 1024 * 1024 );
webView.getSettings().setAppCachePath(GameActivity._activity.getApplicationContext().getCacheDir().getAbsolutePath() );
webView.getSettings().setAppCacheEnabled( true );