Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Building aab via editor script only building AMRv7

Discussion in 'Android' started by kidzooly, Aug 20, 2019.

  1. kidzooly

    kidzooly

    Joined:
    Jan 23, 2016
    Posts:
    26
    Hi,
    We have been trying to automate the building process but the problem whenever we are trying to build for 2 architectures lets say ARMv7 and ARM64 its only building for armv7. We cannot see any arm64 files in lib folder in our aab file. We are using Unity 2019.1.4f1.

    This is our build script code snippet we using

    Code (CSharp):
    1. static void BuildAppBundle(bool firebaseResolved)
    2.     {
    3.         if(firebaseResolved) {
    4.             Debug.Log("Building app bundle..");
    5.             EditorUserBuildSettings.buildAppBundle = true;
    6.             EditorUserBuildSettings.androidBuildSystem = AndroidBuildSystem.Gradle;
    7.             PlayerSettings.SetScriptingBackend(BuildTargetGroup.Android, ScriptingImplementation.IL2CPP);
    8.             AndroidArchitecture aac = AndroidArchitecture.ARM64 | AndroidArchitecture.ARMv7 ;
    9.             PlayerSettings.Android.targetArchitectures = aac;        
    10.             UnityEditor.Build.Reporting.BuildReport result = BuildPipeline.BuildPlayer(EditorBuildSettings.scenes, o_dir + o_name + ".aab", BuildTarget.Android, BuildOptions.None);
    11.          
    12.             Debug.Log("Build result: " + result.summary);
    13.             System.Diagnostics.Process.Start("open", o_dir);
    14.         }
    15.         else
    16.             System.Diagnostics.Process.Start("open", build_log);
    17.     }
    I was hoping if someone can help us with this issue.
    TIA

    EDIT:- Sorry for typos, I was removing the useless debug and deleted few things by mistake.
     
    Last edited: Aug 21, 2019
  2. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,875
    Can you fix typos in you code, there's no PlayerSettings.Android.s property.
     
  3. kidzooly

    kidzooly

    Joined:
    Jan 23, 2016
    Posts:
    26
    Sorry for the typo. I have fixed it now.
     
  4. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,875
    Works fine here, did you try your script in empty project.

    Additionally, maybe you have custom gradle template, which has lines for excluding other architectures in packagingOptions
     
  5. kidzooly

    kidzooly

    Joined:
    Jan 23, 2016
    Posts:
    26
    Hi, Thank you for the response.
    Whenever we are force resolving with the PlayServiceResolver it is adding the packagingOptions by itself. How can I disable the packaging thing which is getting added by PlayServiceResolver.
    This is our mainTemplate.gradle
    Code (JavaScript):
    1. buildscript {
    2.     repositories {**ARTIFACTORYREPOSITORY**
    3.         google()
    4.         jcenter()
    5.     }
    6.  
    7.     dependencies {
    8.         classpath 'com.android.tools.build:gradle:3.4.0'
    9. **BUILD_SCRIPT_DEPS**}
    10. }
    11.  
    12. allprojects {
    13.     repositories {**ARTIFACTORYREPOSITORY**
    14.         google()
    15.         jcenter()
    16.         flatDir {
    17.             dirs 'libs'
    18.         }
    19.     }
    20. }
    21.  
    22. // Android Resolver Repos Start
    23. ([rootProject] + (rootProject.subprojects as List)).each { project ->
    24.     project.repositories {
    25.         def unityProjectPath = "file:///" + file(rootProject.projectDir.path + "/../../").absolutePath
    26.         maven {
    27.             url "https://maven.google.com"
    28.         }
    29.         maven {
    30.             url (unityProjectPath + "/Assets/Firebase/m2repository") // Assets/Firebase/Editor/AnalyticsDependencies.xml:20, Assets/Firebase/Editor/AppDependencies.xml:20, Assets/Firebase/Editor/MessagingDependencies.xml:22
    31.         }
    32.         maven {
    33.             url "https://maven.google.com/" // Assets/GoogleMobileAds/Editor/GoogleMobileAdsDependencies.xml:7
    34.         }
    35.         mavenLocal()
    36.         jcenter()
    37.         mavenCentral()
    38.     }
    39. }
    40. // Android Resolver Repos End
    41. apply plugin: 'com.android.application'
    42. **APPLY_PLUGINS**
    43.  
    44. dependencies {
    45.     implementation fileTree(dir: 'libs', include: ['*.jar'])
    46.     implementation('com.android.support:multidex:1.0.3')
    47. // Android Resolver Dependencies Start
    48.     implementation 'com.google.android.gms:play-services-ads:17.2.0' // Assets/GoogleMobileAds/Editor/GoogleMobileAdsDependencies.xml:7
    49.     implementation 'com.google.auto.value:auto-value-annotations:1.6.3' // Assets/Firebase/Editor/AppDependencies.xml:22
    50.     implementation 'com.google.firebase:firebase-analytics:16.5.0' // Assets/Firebase/Editor/MessagingDependencies.xml:15
    51.     implementation 'com.google.firebase:firebase-analytics-unity:6.0.0' // Assets/Firebase/Editor/AnalyticsDependencies.xml:20
    52.     implementation 'com.google.firebase:firebase-app-unity:6.0.0' // Assets/Firebase/Editor/AppDependencies.xml:20
    53.     implementation 'com.google.firebase:firebase-common:17.0.0' // Assets/Firebase/Editor/AppDependencies.xml:13
    54.     implementation 'com.google.firebase:firebase-iid:[18.0.0]' // Assets/Firebase/Editor/MessagingDependencies.xml:13
    55.     implementation 'com.google.firebase:firebase-messaging:18.0.0' // Assets/Firebase/Editor/MessagingDependencies.xml:17
    56.     implementation 'com.google.firebase:firebase-messaging-unity:6.0.0' // Assets/Firebase/Editor/MessagingDependencies.xml:22
    57. // Android Resolver Dependencies End
    58. **DEPS**}
    59.  
    60. // Android Resolver Exclusions End
    61. // Android Resolver Exclusions Start
    62. android {
    63.   packagingOptions {
    64.       exclude ('/lib/armeabi/*' + '*')
    65.       exclude ('/lib/mips/*' + '*')
    66.       exclude ('/lib/mips64/*' + '*')
    67.       exclude ('/lib/x86/*' + '*')
    68.       exclude ('/lib/x86_64/*' + '*')
    69.   }
    70. }
    71. // Android Resolver Exclusions End
    72. android {
    73.     compileSdkVersion **APIVERSION**
    74.     buildToolsVersion '**BUILDTOOLS**'
    75.  
    76.     compileOptions {
    77.         sourceCompatibility JavaVersion.VERSION_1_8
    78.         targetCompatibility JavaVersion.VERSION_1_8
    79.     }
    80.  
    81.     defaultConfig {
    82.         minSdkVersion **MINSDKVERSION**
    83.         targetSdkVersion **TARGETSDKVERSION**
    84.         applicationId '**APPLICATIONID**'
    85.         ndk {
    86.             abiFilters **ABIFILTERS**
    87.         }
    88.         versionCode **VERSIONCODE**
    89.         versionName '**VERSIONNAME**'
    90.         multiDexEnabled true
    91.     }
    92.  
    93.     lintOptions {
    94.         abortOnError false
    95.     }
    96.  
    97.     aaptOptions {
    98.         noCompress = ['.unity3d', '.ress', '.resource', '.obb'**STREAMING_ASSETS**]
    99.         ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~"
    100.     }**SIGN**
    101.  
    102.     buildTypes {
    103.         debug {
    104.             minifyEnabled **MINIFY_DEBUG**
    105.             useProguard **PROGUARD_DEBUG**
    106.             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD****SIGNCONFIG**
    107.             jniDebuggable true
    108.         }
    109.         release {
    110.             minifyEnabled **MINIFY_RELEASE**
    111.             useProguard **PROGUARD_RELEASE**
    112.             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD****SIGNCONFIG**
    113.         }
    114.     }**PACKAGING_OPTIONS****SPLITS**
    115. **BUILT_APK_LOCATION**
    116. **EXTERNAL_SOURCES**
    117.     bundle {
    118.         language {
    119.             enableSplit = false
    120.         }
    121.         density {
    122.             enableSplit = false
    123.         }
    124.         abi {
    125.             enableSplit = true
    126.         }
    127.     }
    128. }**SPLITS_VERSION_CODE****REPOSITORIES****SOURCE_BUILD_SETUP**
    129.  

    TIA