Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

2017.3.1p1 Android builds fail with both, internal and gradle - No apk created

Discussion in 'Android' started by sschilp, Feb 21, 2018.

  1. sschilp

    sschilp

    Joined:
    Jul 12, 2016
    Posts:
    12
    I have a system for automated builds for my project.
    It is using Teamcity to run the command line on my mac (mini) and i am creating builds by calling the buildscript inside my project.
    In general, this is working fine. I have been creating ios builds without any problems for almost 2 years with this setup.
    More than a year ago i created the last android build with this system and then deactivated android builds as the focus of the project switched to ios-only.

    However, i am trying to do android builds again but i encountered the following problems:
    • With the internal build system, my builds crash
    • With gradle the builds are successful but i just get the gradle project instead of the apk (thats how it's supposed to work if i understand that correctly)
    • I can't get the gradle project to compile into an apk/I don't really know how to do it
    Details:
    My buildscript for android looks like this

    Code (CSharp):
    1. public static void BuildAndroid()
    2. {
    3.     Debug.Log("ANDROID BUILD TRIGGERED");
    4.     BuildSetup();
    5.  
    6.     const string androidPath = BasePath + "Android/";
    7.     if (!CreatePath(androidPath)) return;
    8.  
    9.     var scenes = CollectBuildScenes();
    10.     EditorUserBuildSettings.development = false;
    11.     PlayerSettings.stripEngineCode = false;
    12.    
    13.     EditorUserBuildSettings.androidBuildType = AndroidBuildType.Debug;
    14.     EditorUserBuildSettings.buildScriptsOnly = false;
    15.     EditorUserBuildSettings.exportAsGoogleAndroidProject = false;
    16.     EditorUserBuildSettings.androidBuildSystem = AndroidBuildSystem.Gradle;
    17.     //EditorUserBuildSettings.androidBuildSystem = AndroidBuildSystem.Internal;
    18.  
    19.     var buildMessage = BuildPipeline.BuildPlayer(scenes, androidPath + "xyz.apk", BuildTarget.Android, _buildOptions);
    20.  
    21.     Debug.Log("BUILD OUTCOME: " + buildMessage);
    22.     Debug.Log("ANDROID BUILD FINISHED");
    23. }
    The used build options are just standard things like IL2CPP, AllowDebugging, Development and ConnectWithProfiler.
    When it comes to build options and EditorUserBuildSettings, i tried multiple combinations that all end up in the same results.

    So as i said, when i set the BuildSystem to internal, my build fails completely, this is the log output:

    I am using Unity 2017.3.1p1, the targeted and minimum android sdk is 23, the sdk, ndk and jre are properly setup on that mac as far as i can tell.

    The goal would be to figure out why the internal system is failing with that exception as i would like to avoid adding an additional step to my build process that actually builds the created gradle project.
    And if i understand that correctly, the internal system should (still) be able of giving me the apk right away as the result of unity's build without the need for additional tools or steps?!

    Thanks in advance for any kind of help, hint or comment.
     
  2. qcbf1

    qcbf1

    Joined:
    Nov 1, 2013
    Posts:
    19
    +1 help