unity安卓游戏怎么unity签名打包apk成apk

I'm trying to compile a simple game without any additional plugin, but I am facing the errors below:
CommandInvokationFailure: Failed to re-package resources. See the Console for details.
C:\Program Files (x86)\Android\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:/Program Files (x86)/Android/android-sdk\platforms\android-23\android.jar" -F bin/resources.ap_
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
mand.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.pileResources (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()
Error building Player: CommandInvokationFailure: Failed to re-package resources. See the Console for details.
C:\Program Files (x86)\Android\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:/Program Files (x86)/Android/android-sdk\platforms\android-23\android.jar" -F bin/resources.ap_
I have the latest versions of the Android SDK and JDK (Image updated after
Answer of @Programmer):
I do not include any plugin or Google service, what might be happening?
UnityVersion: 5.3.4f1 Personal
On Unity 5.4.0b15, We have another error:
UnityException: Build failure
Failed to re-package resources. See the Console for details.
UnityEditor.Android.PostProcessor.CancelPostProcess.AbortBuild (System.String title, System.String message)
UnityEditor.Android.PostProcessor.CancelPostProcess.AbortBuildPointToConsole (System.String title, System.String message)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context)
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.Android.AndroidBuildPostprocessor.PostProcess (BuildPostProcessArgs args)
UnityEditor.PostprocessBuildPlayer.Postprocess (BuildTarget target, System.String installPath, System.String companyName, System.String productName, Int32 width, Int32 height, System.String downloadWebplayerUrl, System.String manualDownloadWebplayerUrl, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.BuildReporting.BuildReport report) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:176)
UnityEditor.HostView:OnGUI()
Thank you in advance!
解决方案 It could be the spaces in the Android SDK and NDK path. Unity's update logs always says that this problem is fixed but that is not true. It fails sometimes.
Make sure that there are no spaces in your SDK and NDK path. So create a folder called AndroidSDK and AndroidNDK in the C directory.
Copy your Android-sdk folder to the C:/AndroidSDK directory. Copy your Android-ndk to the
C:/AndroidNDK folder.
Now, your SDK path should look like this:
C:/AndroidSDK/Android-sdk
C:/AndroidNDK/Android-ndk
No spaces more.
Update your Android SDK and NDK paths in the Unity Editor.
If that fails, download .
Re-download . Then Build the Project for Android, it will show an error and ask you to update SDK. click on the "Update Android SDK" buttom. Unity will Automatically update your SDK. Your SDK should then look like something below.
本文地址: &
我试图编译一个简单的游戏没有任何额外的插件,但我面临的错误如下:
CommandInvokationFailure :无法重新打包资源。有关详细信息,请参阅控制台。
C:\Program Files(x86)\Android\android-sdk\build-tools\24.0.0-preview\aapt.exe软件包--auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S“res”-I“C:/ Program Files(x86)/Android/android-sdk\platforms\android-23\android.jar”-F bin / resources.ap_
stderr [ ]
-------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- --------------------------------------------------
mand.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.pileResources(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选项,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选项,UnityEditor.RuntimeClassRegistry usedClassRegistry) UnityEditor.HostView:OnGUI()
构建Player时出错:CommandInvokationFailure:无法重新打包资源。有关详细信息,请参阅控制台。
C:\Program Files(x86)\Android\android-sdk\build-tools\24.0.0-preview\aapt.exe软件包--auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S“res”-I“C:/ Program Files(x86)/Android/android-sdk\platforms\android-23\android.jar”-F bin / resources.ap_
stderr [ ]
stdout [ ]
我有Android SDK和JDK的最新版本(@Programmer的答案后图片更新):
我不包含任何插件或Google服务,可能发生什么情况?
Unity version:5.3.4f1个人
.0b15 ,我们还有另一个错误:
UnityException:构建失败无法重新打包资源。有关详细信息,请参阅控制台。
UnityEditor.Android.PostProcessor.CancelPostProcess.AbortBuild(System.String title,System.String消息) UnityEditor.Android.PostProcessor.CancelPostProcess.AbortBuildPointToConsole(System.String title,System.String message) UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks(UnityEditor.Android.PostProcessor.PostProcessorContext context) 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.Android.AndroidBuildPostprocessor.PostProcess(BuildPostProcessArgs args) UnityEditor.PostprocessBuildPlayer.Postprocess(BuildTarget目标,System.String installPath,System.String companyName,System.String productName,Int32 width,Int32 height,System.String downloadWebplayerUrl,System.String manualDownloadWebplayerUrl,BuildOptions options,UnityEditor.RuntimeClassRegistry usedClassRegistry,UnityEditor.BuildReporting.BuildReport report)(at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:176) UnityEditor.HostView:OnGUI()
提前谢谢!
解决方案 它可能是Android SDK中的空格和NDK路径。 Unity的更新日志总是说这个问题是固定的,但这不是真的。
确保SDK和NDK路径中有无个空格。因此在C目录中创建一个名为 AndroidSDK 和 AndroidNDK 的文件夹。
将 Android-sdk 文件夹复制到目录。将 Android-ndk 复制到 C:/ AndroidNDK文件夹。
现在,您的SDK路径应如下所示:
C:/ AndroidSDK / Android-sdk
C:/ AndroidNDK / Android-ndk
没有空格。
更新您的Android SDK和NDK路径Unity编辑器。
如果失败,请下载。
重新下载。然后,为Android构建项目,将显示错误,并要求您更新SDK。点击“更新Android SDK ”按钮。 Unity将自动更新您的SDK。您的SDK应该如下所示。
本文地址: &
扫一扫关注官方微信程序写累了,就来玩玩酷跑小游戏吧,嘿嘿。
雨松MOMO送你一首歌曲,嘿嘿。
Unity3D研究院之Android使用ANT自动打包(七十九)
Unity3D研究院之Android使用ANT自动打包(七十九)
围观16363次
编辑日期: 字体:
好久没有写博客了,并不是我不想写,而真是没有时间写。感谢这段时间大家的留言,如果我没有回复的请见谅。最近做了一段时间Android渠道包的接入也算积累了点经验,希望可以帮助以后的朋友们,嘿嘿。
Unity打Android渠道包的传统步骤是,先把SDK放在plugins目录下,设置好证书后最后用unity直接生成.apk。 这是的确是正确的打包方式,但是这样做非常容易出错,SDK不能直接放在plugins目录下,必须要先编译。有些渠道的SDK TMD不是编译好的.jar 而是一个android工程,你必须要让你的unity工程去依赖它。。。所以这样做一不小心就会出错。。
为了彻底解决容易出错的问题,那么我们一定要使用Android的Ant来打包。结合到Unity的工作原理就是,先把unity工程导出成一个android工程,然后在把渠道的 assets lib 依赖 以及icon 拷贝进去,最后通过ant直接生成apk来。
1.先将unity导出成android工程,大家可以看我以前的文章。
2.拷贝assets lib 依赖 以及icon
其实无非也就是shell脚本的 cp命令,多余的我也就不说了。这里我需要说一下splash启动图,unity不允许在android工程里面设置启动图,必须要在unity里设置。可以提前把一张启动图放在unity里面,然后在ProjectSetting里面关联上启动图,自动打包的时候根据不同的渠道将splash图片覆盖一下unity工程里面的图片,然后导出即可。
3.Android 与 ant 环境搭建
建议你直接下载ADT ,这里不仅包含SDK也包含开发编辑器。如下图所示eclipse就是ADT开发编辑器,sdk就是android的sdk
如下图所示,记得要SDK都更新到最新,不然ant打包会报错。
打开ADT(Eclipse)在导航菜单栏中选择Help -& Install New Software
Work with中输入
如下图所示,在下拉列表中选择General Purpose Tools 找到Eclipse Plug-in Development Environment (因为我已经装过了,所以这里不显示) 安装即可。
安装完毕后,打开终端直接输入 open -e .bash_profile
如下图所示,将ANT 和Android的环境变量都配置完毕。记得要关闭一下本文以及终端,方可生效。
到这一步ant的环境已经配置完毕。如下图所示,在ANT打包前我们要先把android工程生成出来。
AndroidManifest.xml 游戏名 包名 activity service都在这里,这里不做过多的解释了。。
assets:unity的.so放在这里。如果渠道包assets下面有文件也一并放在这里。
bin:就不用管了,他是android编译生成出来的。
build.xml:ant打包必备的资源文件,之前我们配置的环境变量就是为了它。下面我在贴出来内容。
gen:生成出来的,不用管了。
keystore.properties:证书的描述文件,证书的路径、密码啊啥的都在这里。
libs:将渠道libs文件夹下的拷贝机进来。
project.properties:如果渠道包是一个工程,那么就必须在这里进行依赖。这里写的就是依赖工程的路径。
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
&?xml version="1.0" encoding="UTF-8"?&&project name="Game" default="help"&&&&&&&!-- The local.properties file is created and updated by the 'android' tool.&&&&&&&& It contains the path to the SDK. It should *NOT* be checked into&&&&&&&& Version Control Systems. --&&&&&&!--&property file="local.properties" /&--&&&&&&!--&condition property="sdk.dir" value="D:\\android\\android-sdk"&
&os family="windows"/&&&&&&/condition& &condition property="sdk.dir" value="/Users/dev/android-sdk"&
&os family="mac"/&&&&&&/condition&--&&&&&&&!-- The ant.properties file can be created by you. It is only edited by the&&&&&&&& 'android' tool to add properties to it.&&&&&&&& This is the place to change some Ant specific build properties.&&&&&&&& Here are some properties you may want to change/update:&&&&&&&&& source.dir&&&&&&&&&&&& The name of the source directory. Default is 'src'.&&&&&&&& out.dir&&&&&&&&&&&& The name of the output directory. Default is 'bin'.&&&&&&&&& For other overridable properties, look at the beginning of the rules&&&&&&&& files in the SDK, at tools/ant/build.xml&&&&&&&&& Properties related to the SDK location or the project target should&&&&&&&& be updated using the 'android' tool with the 'update' action.&&&&&&&&& This file is an integral part of the build system for your&&&&&&&& application and should be checked into Version Control Systems.&&&&&&&&& --&&&&&&property file="keystore.properties" /&&&&&&&!-- if sdk.dir was not set from one of the property file, then&&&&&&&& get it from the ANDROID_HOME env var.&&&&&&&& This must be done before we load project.properties since&&&&&&&& the proguard config can use sdk.dir --&&&&&&property environment="env" /&&&&&&condition property="sdk.dir" value="${env.ANDROID_SDK}"&&&&&&&&&&isset property="env.ANDROID_SDK" /&&&&&&/condition&&&&&&&!-- The project.properties file is created and updated by the 'android'&&&&&&&& tool, as well as ADT.&&&&&&&&& This contains project specific properties such as project target, and library&&&&&&&& dependencies. Lower level build properties are stored in ant.properties&&&&&&&& (or in .classpath for Eclipse projects).&&&&&&&&& This file is an integral part of the build system for your&&&&&&&& application and should be checked into Version Control Systems. --&&&&&&loadproperties srcFile="project.properties" /&&&&&&&!-- quick check on sdk.dir --&&&&&&fail&&&&&&&&&&&&message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."&&&&&&&&&&&&unless="sdk.dir"&&&&/&&&&&&&!-- Import the actual build file.&&&&&&&&& To customize existing targets, there are two options:&&&&&&&& - Customize only one target:&&&&&&&&&&&& - copy/paste the target into this file, *before* the&&&&&&&&&&&&&& &import& task.&&&&&&&&&&&& - customize it to your needs.&&&&&&&& - Customize the whole content of build.xml&&&&&&&&&&&& - copy/paste the content of the rules files (minus the top node)&&&&&&&&&&&&&& into this file, replacing the &import& task.&&&&&&&&&&&& - customize to your needs.&&&&&&&&& ***********************&&&&&&&& ****** IMPORTANT ******&&&&&&&& ***********************&&&&&&&& In all cases you must update the value of version-tag below to read 'custom' instead of an integer,&&&&&&&& in order to avoid having your file be overridden by tools such as "android update project"&&&&--&&&&&&!-- version-tag: 1 --&&&&&&import file="${sdk.dir}/tools/ant/build.xml"/&&&/project&
最后就是ant打包的指令了。
tempEclipsePath:是android 工程路径,先clean在release。
ant -buildfile ${tempEclipsePath}/build.xml clean
ant -buildfile ${tempEclipsePath}/build.xml release
这样包就打在了bin目录下面,可以mv把apk拷贝到你需要的目录下面就好了。
mv -f ${tempEclipsePath}/bin/Game-release.apk ${out}
本文固定链接:
转载请注明:
雨松MOMO提醒您:亲,如果您觉得本文不错,快快将这篇文章分享出去吧 。另外请点击网站顶部彩色广告或者捐赠支持本站发展,谢谢!
作者:雨松MOMO
专注移动互联网,Unity3D游戏开发
如果您愿意花10块钱请我喝一杯咖啡的话,请用手机扫描二维码即可通过支付宝直接向我捐款哦。
您可能还会对这些文章感兴趣!如何用 android把ipa格式转化成apk格式
全部答案(共1个回答)
满意,请点击左下角“好评”,谢谢您的采纳。)
可以使用软件做
如果是的话 你这样,你点开设置 里面有一个 itunes store 那上面写有的 apple id 你点一下,然后惦记查看的id里面有一个转换国家 你把国家改...
建议你下载个转换软件吧。
基本没有,你只能选择该软件的安卓版本。
这个是不行的 转换了就不能使用了
大家还关注
确定举报此问题
举报原因(必选):
广告或垃圾信息
激进时政或意识形态话题
不雅词句或人身攻击
侵犯他人隐私
其它违法和不良信息
报告,这不是个问题
报告原因(必选):
这不是个问题
这个问题分类似乎错了
这个不是我熟悉的地区不怨天,不尤人,下学而上达,知我者其天乎!
Unity命令行打包
一、在Assets\Editor目录下放个脚本
using UnityE
using UnityE
using System.IO;
using System.Collections.G
/// &summary&
/// 命令行批处理工具类
/// &/summary&
public class Batchmode {
static List&string& levels = new List&string&();
static string keystoreFile = @"D:\keystore.txt";
public static void BuildAndroid() {
if(!File.Exists(keystoreFile))
throw new Exception("Not find keystore file");
StreamReader sr = File.OpenText(keystoreFile);
string password = sr.ReadToEnd().Trim();
PlayerSettings.Android.keystorePass =
PlayerSettings.Android.keyaliasPass =
foreach ( EditorBuildSettingsScene scene in EditorBuildSettings.scenes ) {
if ( !scene.enabled )
levels.Add( scene.path );
EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTarget.Android);
string res = BuildPipeline.BuildPlayer( levels.ToArray(), "android.apk", BuildTarget.Android, BuildOptions.None );
if (res.Length & 0)
throw new Exception("BuildPlayer failure: " + res);
二、写个批处理(路径改成自己的工程路径)
@set unity="C:\Program Files\Unity\Editor\Unity.exe"
echo 正在生成APK文件...
-batchmode -quit -nographics -executeMethod Batchmode.BuildAndroid
-logFile D:\Editor.log -projectPath "D:\China\_client_wushen_android"
echo APK文件生成完毕!
Flash游戏设计:
Unity游戏设计:unity3d发布apk在android虚拟机中运行的详细步骤(unity3d导出android apk)
字体:[ ] 类型:转载 时间:
这篇文章主要介绍了unity3d发布apk在android虚拟机中运行的详细步骤,需要的朋友可以参考下
unity3d发布apk在android虚拟机中运行的详细步骤(unity3d导出android apk),总的流程分为以下6个步骤:
1、安装java_jdk
2、配置java环境变量
3、更新android的sdk
4、从Unity3d中发布出apk文件
5、创建android虚拟机并运行
6、将apk文件安装到android虚拟机中
(为方便新手,在下面对每个步骤的具体操作及可能遇到的问题详细提一下)
1、安装java_jdk
官网(),免费,我安装的文件的名字是jdk-7u10-windows-i586.exe,版本有新旧,你下载到的版本号可能与我不同,不碍事;
2、配置java环境变量
右键我的电脑→属性→高级系统设置→高级→环境变量,点击下面的系统变量中的新建按钮
输入变量名JAVA_HOME
输入变量值是上一步中java_jdk的安装路径,我的是C:\Program Files (x86)\Java\jdk1.7.0_10
点击确定;
&再次新建一个变量,变量名为CLASSPATH,变量值如下:
.;%JAVA_HOME%\lib\tools.%JAVA_HOME%\lib\dt.%JAVA_HOME%\bin
(别落下最前面的那个点)这里用的是相对路径,所以你可以复制我的,点击确定;
找到一个已有的系统变量Path,编辑它的值,别改变原有的内容,在末尾加上
;C:\Program Files (x86)\Java\jdk1.7.0_10\bin
(注意这是随着你的java_jdk的安装路径来的,和我写的内容不一定一样)
至此,java的环境变量配置结束;
3、更新android的sdk
运行android的sdk文件夹中的SDK Manager.exe,按需更新你所要的android版本;
4、从Unity3d中发布出apk文件
Build之前,在Player Settings中进行必要的设置,以下几个是必须的:
①Bundle Identifier*中的pany.ProductName中的Company必须改成别的名字
②Install Location设置为Automatic,否则在android虚拟机中会运行失败,提示“Unfortunately,*** has stopped.”如下图
③Minimum API level中的android版本一定要低于或等于你要创建的android虚拟机中的android版本
然后Build就可以了,第一次Build的话,会提示你选择android的sdk的路径,注意选到sdk那级(我的是“E:\Tools\Android\adt-bundle-windows-x86\sdk”);
5、创建android虚拟机并运行
运行android的sdk文件夹中的AVD Manager.exe,点击New...按钮来创建虚拟机,各种选项填好,比较简单,有一点要注意,一定要打上Emulation Options中的Use Host GPU的勾,否则往虚拟机中安装apk文件时会报错,提示“failure install_failed_container_error”;
创建好虚拟机后,一定要在安装apk文件之前把虚拟机运行起来;
6、将apk文件安装到android虚拟机中
将发布好的apk文件移至android的sdk路径中的platform-tools文件夹中,然后打开cmd控制台,先进入到android的sdk路径中的platform-tools路径中,命令是“cd +具体路径”,我的是“cd E:\Tools\Android\adt-bundle-windows-x86\sdk\platform-tools”,然后回车;
进入后,输入adb install +apk文件名,回车等一会就好了,如果安装成功,会提示success,如下图
然后,在虚拟机中找到自己的apk,玩去吧。(下面附上我自己的)
您可能感兴趣的文章:
大家感兴趣的内容
12345678910
最近更新的内容
常用在线小工具}

我要回帖

更多关于 unity 5.3打包apk闪退 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信