Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Aaryam · Oct 26, 2019 at 01:16 AM · android2dbuildandroid buildandroid-sdk

Run by run on android building

I have a problem that I have been having with building 64 bit games with unity (this is required to upload games onto the play store). I have tried using IL2CPP backend, as well as using ARM64 but always come up with errors.

I was wondering if someone could just write up an answer which contains all the instructions required to build an android project which will be accepted by Google.

Unity editor version: 2019.3.0b7

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by naviln · Oct 29, 2019 at 01:35 PM

It can be a bit of a moving target, as things can change on either end.

It also depends on what libs you are using in your project - some are difficult to link and need some custom attention, especially if you are going to use IL2CPP. Firstly, I would avoid using a Beta build of Unity for getting something to a store front (don't use 2019.3.0b7).


Get the latest stable build, and build it manually until you get it right, create a bug report if you get stuck (to the Unity team), once it starts working then invest some time to automate it with a build server (I use teamcity).


I am currently building an android bundle using command line, configured on my team city server, and works pretty well. I manually upload the android bundle to google play using the google play console. I have a few builds up on Google Play at the moment.


I don't have time to go through the entire setup, but here is my command line call to invoke the build:

  • cd "C:\Program Files\Unity\Hub\Editor\2019.2.10f1\Editor\Unity.exe" "%keystorepass%" -username example@gmail.com -password examplepassword -projectPath %cd%\WildWar3Client -quit -batchmode -executeMethod BuildPlayers.AndroidBuild -logFile "C:\Logs\UnityAndroidBuidLog.txt"

where %keystorepass% is the password i used for my keystore and alias, and %cd% is the project directory.


And here is the code in my project for building the android bundle. I only have one scene, you could add your own names, or do it dynamically, add better error handling, etc etc.

 #if UNITY_EDITOR
 using UnityEditor;
 #endif
 using UnityEngine;
 using UnityEditor.Build.Reporting;
 using System.IO;

 //Build scripts
 public class BuildPlayers : MonoBehaviour
 {
 
 #if UNITY_EDITOR
     [MenuItem("Build/Build Android")]
 #endif
     public static void AndroidBuild()
     {        
         BuildPlayerOptions buildPlayerOptions = new BuildPlayerOptions();
         buildPlayerOptions.scenes = new[] { "Assets/Resources/Scenes/MainScene.unity" };
         buildPlayerOptions.locationPathName = "WW3ClientAndroid.aab";
         buildPlayerOptions.target = BuildTarget.Android;
         buildPlayerOptions.targetGroup = BuildTargetGroup.Android;
         buildPlayerOptions.options = BuildOptions.CompressWithLz4;
         //skip x86. that doesn't work
         AndroidArchitecture aac = AndroidArchitecture.ARM64 | AndroidArchitecture.ARMv7;
         PlayerSettings.Android.targetArchitectures = aac;
         //use this for all archs
         //PlayerSettings.Android.targetArchitectures = AndroidArchitecture.All;
         //for android, use this to build a bundle instead
         EditorUserBuildSettings.buildAppBundle = true;
         //if Unity version is lower than 2018, also may need to set:
         //EditorUserBuildSettings.androidBuildSystem = AndroidBuildSystem.Gradle;
         //try and get cmd args
         var argers = System.Environment.GetCommandLineArgs();
         string password = "default";
         //index 1 has the password
         password = argers[1];
         //set the keystore password.
         PlayerSettings.keystorePass = password;
         PlayerSettings.keyaliasPass = password;
 
         BuildReport report = BuildPipeline.BuildPlayer(buildPlayerOptions);
         BuildSummary summary = report.summary;
 
         if (summary.result == BuildResult.Succeeded)
         {
             Debug.Log("Build succeeded: " + summary.totalSize + " bytes");
             //can we just copy it to a google drive folder straight away?
             //where is the file? here: buildfolder\wildwar3\WildWar3Client\WW3ClientAndroid
             var clientPath = Application.dataPath.Replace("/Assets", "");
             //the path is
             clientPath = clientPath + "/WW3ClientAndroid.aab";
             Debug.Log("Client Path: " + clientPath);
             //copy it somewhere easily findable for manual upload to google play.
             var destReleaseFilePath = @"C:\Users\Navil\Google Drive\Wild War 3\Builds\Android\WW3ClientAndroid.aab";
             File.Copy(clientPath, destReleaseFilePath, true);
         }
 
         if (summary.result == BuildResult.Failed)
         {
             Debug.Log("Build failed");
         }
     }
 }



I know there are some gaps, and you'll probably have to iterate a few times to get it right. Making it repeatable on a build server will save you a lot of headache and stress. Good luck, and if you have any specific questions just let me know.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

342 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to port game on android wear ? 2 Answers

Editor script to set AndroidSdkVersions 1 Answer

Android - Failed to repackage resources error after installing facebook plugin 2 Answers

com.android.tools.r8 compilation error please help 0 Answers

Can a project tiny app be built for android? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges