2016-03-06 18:32:49 qq_22033759 阅读数 6410

如果电脑里没有androidsdk的话,可以使用官方推荐的Nvidia的 Android Works ,安装虚幻4时自带,在虚幻4 安装根目录下的Engine\Extras\Android中 源码版的也有。

然后就是在虚幻4中配置安卓,在项目设置里找到这个
这里写图片描述
如果是用Android Works装的话应该会有一部分是有内容的。
如果不是,就要自己制定路径,这里的jdk要求为64位的
配置完就可以了。

打包前最好把目标硬件改为 移动设备/平板电脑 和 可缩放的2D或3D。

打包的格式:
DXT 桌面计算机和 Tegra 设备所用的格式。
ATC 用于 Qualcomm Snapdragon 设备。
PVR 用于 ImgTec PowerVR 设备。
ETC1 得到了所有设备的支持,但不支持带有 alpha 通道的纹理,因此这些纹理将不采取压缩,导致游戏下载大量数据并占用更多的运行内存资源。
ETC2 用于 MALI 设备和其他一些设备。

2019-11-01 11:55:44 zhangmei126 阅读数 149

虚幻引擎:4.22

VS:2017

1、AndroidSDK配置

  • 虚幻集成了Android打包需要的SDK,在虚幻引擎安装目录下:

  •  安装时,需要设置安装目录和下载目录(比如我的设置):

下载目录:D:\NVIDIA\CodeWorksforAndroid

安装目录:D:\NVPACK

  • 因为国内网络限制,基本上下载都会失败,给个百度网盘地址:

链接:https://pan.baidu.com/s/1BFi0Y9hXbumbTz6fw8nfrQ 
提取码:bu0u 

  • 下载后放到对应的目录下面,再次打开Chooser.exe,将检查已经下载的SDK,并安装配置系统环境变量。

2、UE4中打包配置

  • 先在Project Settings->Android SDK中配置需要的SDK:

  • 检查Android->APK Packaging中是否配置Android平台:

  • 不勾选"Package game data inside .apk?",运行应用时会提示“No obb found or store key to try download” ,因为缺少obb。

3、打包格式

4、打包后安装

  • 一般使用ADB命令安装(可以看下ADB的帖子):

https://blog.csdn.net/zhangmei126/article/details/102798041

2015-05-09 15:11:48 lqpgfz 阅读数 8218

首先必须使用虚幻4指定的版本的SDK和NDK,被这个问题困扰了很久,最后发现是版本问题。

=================================================================
 MainFrameActions: Packaging (Android (ETC2)): UEDeployAndroid.RunCommandLineProgramAndThrowOnError: Preparing native code for debugging...
 MainFrameActions: Packaging (Android (ETC2)): UEDeployAndroid.MakeApk:
 MainFrameActions: Packaging (Android (ETC2)): ====17/2/2015 5:55:41 PM====PERFORMING FINAL APK PACKAGE OPERATION================================================
 MainFrameActions: Packaging (Android (ETC2)): UEDeployAndroid.RunCommandLineProgramAndThrowOnError: Making .apk with Ant... (note: it's safe to ignore javac obsolete warnings)
 MainFrameActions: Packaging (Android (ETC2)):     [javac] Note: D:\Mantri\Explorer\Intermediate\Android\APK\src\com\android\vending\licensing\LicenseChecker.java uses or overrides a deprecated API.
 MainFrameActions: Packaging (Android (ETC2)):     [javac] Note: Recompile with -Xlint:deprecation for details.
 MainFrameActions: Packaging (Android (ETC2)): BUILD FAILED
 MainFrameActions: Packaging (Android (ETC2)): D:\NVPACK_Full\android-sdk-windows\tools\ant\build.xml:892: The following error occurred while executing this line:
 MainFrameActions: Packaging (Android (ETC2)): D:\NVPACK_Full\android-sdk-windows\tools\ant\build.xml:894: The following error occurred while executing this line:
 MainFrameActions: Packaging (Android (ETC2)): D:\NVPACK_Full\android-sdk-windows\tools\ant\build.xml:906: The following error occurred while executing this line:
 MainFrameActions: Packaging (Android (ETC2)): D:\NVPACK_Full\android-sdk-windows\tools\ant\build.xml:283: null returned: 1
 MainFrameActions: Packaging (Android (ETC2)): Total time: 5 seconds
 MainFrameActions: Packaging (Android (ETC2)): BuildCommand.Execute: ERROR: BUILD FAILED
 MainFrameActions: Packaging (Android (ETC2)): Program.Main: ERROR: AutomationTool terminated with exception:
 MainFrameActions: Packaging (Android (ETC2)): Program.Main: ERROR: Exception in UnrealBuildTool: ERROR: cmd.exe failed with args /c "D:\NVPACK_Full\apache-ant-1.8.2/bin/ant.bat" -quiet debug
 MainFrameActions: Packaging (Android (ETC2)): Stacktrace:    at UnrealBuildTool.Android.UEDeployAndroid.RunCommandLineProgramAndThrowOnError(String WorkingD
 MainFrameActions: Packaging (Android (ETC2)): irectory, String Command, String Params, String OverrideDesc, Boolean bUseShellExecute)
 MainFrameActions: Packaging (Android (ETC2)):    at UnrealBuildTool.Android.UEDeployAndroid.MakeApk(String ProjectName, String ProjectDirectory, String OutputPath, String EngineDirectory, Boolean bForDistribution, String CookFlavor, Boolean bMakeSeparateApks, Boolean bIncrementalPackage)
 MainFrameActions: Packaging (Android (ETC2)):    at UnrealBuildTool.Android.UEDeployAndroid.PrepForUATPackageOrDeploy(String ProjectName, String ProjectDirectory, String ExecutablePath, String EngineDirectory, Boolean bForDistribution, String CookFlavor)
 MainFrameActions: Packaging (Android (ETC2)):    at AndroidPlatform.Package(ProjectParams Params, DeploymentContext SC, Int32 WorkingCL)
 MainFrameActions: Packaging (Android (ETC2)):    at Project.Package(ProjectParams Params, Int32 WorkingCL)
 MainFrameActions: Packaging (Android (ETC2)):    at BuildCookRun.DoBuildCookRun(ProjectParams Params)
 MainFrameActions: Packaging (Android (ETC2)):    at BuildCommand.Execute()
 MainFrameActions: Packaging (Android (ETC2)):    at AutomationTool.Automation.Execute(List`1 CommandsToExecute, CaselessDictionary`1 Commands)
 MainFrameActions: Packaging (Android (ETC2)):    at AutomationTool.Automation.Process(String[] CommandLine)
 MainFrameActions: Packaging (Android (ETC2)):    at AutomationTool.Program.MainProc(Object Param)
 MainFrameActions: Packaging (Android (ETC2)):    at AutomationTool.InternalUtils.RunSingleInstance(MainProc Main, Object Param)
 MainFrameActions: Packaging (Android (ETC2)):    at AutomationTool.Program.Main()
 MainFrameActions: Packaging (Android (ETC2)): Program.Main: ERROR: ERROR: cmd.exe failed with args /c "D:\NVPACK_Full\apache-ant-1.8.2/bin/ant.bat" -quiet debug
 MainFrameActions: Packaging (Android (ETC2)): ProcessManager.KillAll: Trying to kill 0 spawned processes.
 MainFrameActions: Packaging (Android (ETC2)): Program.Main: AutomationTool exiting with ExitCode=1
 MainFrameActions: Packaging (Android (ETC2)): Domain_ProcessExit
 MainFrameActions: Packaging (Android (ETC2)): ProcessManager.KillAll: Trying to kill 0 spawned processes.
 MainFrameActions: Packaging (Android (ETC2)): copying UAT log files...
 MainFrameActions: Packaging (Android (ETC2)): RunUAT.bat ERROR: AutomationTool was unable to run successfully.
 MainFrameActions: Packaging (Android (ETC2)): BUILD FAILED
今天被这个问题困扰了很久,

解决方案是在Intermediate/android/APK文件夹里面用命令行       运行   ANT CLEAN


真是无奈了这个问题。


最后奉上已经下载完成的虚幻4打包安卓的所有资源下载链接:

http://download.csdn.net/detail/lqpgfz/8894997


上面是打包不成功,还有编译不通过的问题

虚幻4 打包安卓失败 cannot find -l*** || ant.bat" debug


http://blog.csdn.net/lqpgfz/article/details/52463310





2018-05-10 13:34:45 qq_21153225 阅读数 552

虚幻4打包安卓出现NDK_DEBUG=1,安装NVPACK,重启,环境变量也都配了,android选项也都填了,就是不好使。。。一直出现NDK_DEBUG=1

解决了,原因是,NVPACK不能安装到文件夹中,必须是硬盘的根目录(总感觉这是个Bug啊),打包成功。

AndroidSDK配置

 

2016-08-18 01:07:45 lqpgfz 阅读数 6527

参考GoogleVRHMD的编写:

1.Java 调用CPP的函数大概是都是这个样子:
extern "C" void Java_com_epicgames_ue4_GameActivity_native**********(JNIEnv* jenv, jobject thiz)
{
}

前面是Java对应函数声明的位置。

在xml也要定义一下:

public native void nativeOnUiLayerBack();



2.CPP调用Java一般大概是这样:

void AndroidThunkCpp_UiLayer_SetEnabled(bool bEnable)
{
  if (JNIEnv* Env = FAndroidApplication::GetJavaEnv())
  {
  static jmethodID UiLayerMethod = FJavaWrapper::FindMethod(Env, FJavaWrapper::GameActivityClassID, "AndroidThunkJava_UiLayer_SetEnabled", "(Z)V", false);
  FJavaWrapper::CallVoidMethod(Env, FJavaWrapper::GameActivityThis, UiLayerMethod, bEnable);
  }
}



3.虚幻有一个xml文件比较有意思:

GoogleVRHMD_APL.xml

大概是这个意思,虚幻打包安卓钱,先遍历一遍这个xml文件,把所有的xml文件里面的标注gameActivityClassAdditions的添加的类里面,还有一堆其他的,可以拷贝文件,可以gameActivityImportAdditions。


在打包玩安卓以后,在Intermediate\Android文件夹下其实是一个安卓工程,
Intermediate\Android\APK\src\com\epicgames\ue4\GameActivity.java
这个文件就是生成之后的,可以看到xml里面填写的那些代码在各个函数里面。

没有更多推荐了,返回首页