Skip to content

Commit d9b8b19

Browse files
author
game-workstore-bot
committed
Package Update 1.6.0
1 parent 740dd10 commit d9b8b19

29 files changed

+725
-174
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# Changelog for com.google.android.appbundle
22

3+
## [1.6.0] - 2021-11-15
4+
### New Features
5+
- Updated bundletool-all.jar from 1.6.1 to 1.8.2
6+
### Bug Fixes
7+
- Fixed issue #127: crash with IL2CPP and "Separate base APK asset" enabled
8+
- Fixed issue #143: handle AssetBundle files that have file extensions
9+
- Fixed issue #145: AAB upload to Play Console fails due to BundleConfig.pb file size
10+
- Fixed issue when installing Android APIs using the plugin
11+
### Other
12+
- Update minimum Target SDK version to 30
13+
314
## [1.5.0] - 2021-06-14
415
### New Features
516
- Added a new Bundletool method for building AABs (requires 2018.4+ and .NET 4+)

Documentation~/index.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,9 @@ Refer to the
1212
and
1313
[Editor API reference](//developer.android.com/reference/unity/namespace/Google/Android/AppBundle/Editor)
1414
for more information.
15+
16+
## Known Issues
17+
18+
- The plugin's build system is incompatible with the Play Asset Delivery support built into Unity.
19+
See [the Google Play Plugins for Unity README](https://github.com/google/play-unity-plugins/blob/master/README.md#built-in-pad)
20+
for details.

Editor/Scripts/AssetBundleBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,4 +226,4 @@ private static void CheckDirectory(string path, bool allowClearDirectory)
226226
directoryInfo.Delete( /* recursive= */ true);
227227
}
228228
}
229-
}
229+
}

Editor/Scripts/AssetPack.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ public string AssetBundleFilePath
4545
get { return _assetBundleFilePath; }
4646
set
4747
{
48+
if (value == null)
49+
{
50+
_assetBundleFilePath = null;
51+
return;
52+
}
53+
4854
if (_assetPackDirectoryPath != null)
4955
{
5056
throw new ArgumentException("AssetPackDirectoryPath is already set.");
@@ -75,6 +81,12 @@ public string AssetPackDirectoryPath
7581
get { return _assetPackDirectoryPath; }
7682
set
7783
{
84+
if (value == null)
85+
{
86+
_assetPackDirectoryPath = null;
87+
return;
88+
}
89+
7890
if (_assetBundleFilePath != null)
7991
{
8092
throw new ArgumentException("AssetBundleFilePath is already set.");
@@ -108,6 +120,12 @@ public Dictionary<TextureCompressionFormat, string> CompressionFormatToAssetBund
108120
get { return _compressionFormatToAssetBundleFilePath; }
109121
set
110122
{
123+
if (value == null)
124+
{
125+
_compressionFormatToAssetBundleFilePath = null;
126+
return;
127+
}
128+
111129
if (_assetBundleFilePath != null)
112130
{
113131
throw new ArgumentException("AssetBundleFilePath is already set.");
@@ -141,6 +159,12 @@ public Dictionary<TextureCompressionFormat, string> CompressionFormatToAssetPack
141159
get { return _compressionFormatToAssetPackDirectoryPath; }
142160
set
143161
{
162+
if (value == null)
163+
{
164+
_compressionFormatToAssetPackDirectoryPath = null;
165+
return;
166+
}
167+
144168
if (_assetBundleFilePath != null)
145169
{
146170
throw new ArgumentException("AssetBundleFilePath is already set.");

Editor/Scripts/AssetPackConfig.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,4 +212,4 @@ private static void CheckAssetPackName(string assetPackName)
212212
}
213213
}
214214
}
215-
}
215+
}

Editor/Scripts/Bundletool.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public static async Task<AndroidBuildReport> BuildBundle(AndroidBuildOptions and
4747
{
4848
return await AppBundlePublisher.BuildTask(androidBuildOptions);
4949
}
50+
5051
#endif
5152

5253
/// <summary>

Editor/Scripts/Internal/AndroidArchitectureHelper.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ public static void EnableIl2CppBuildArchitectures()
9292

9393
/// <summary>
9494
/// Enable the Mono scripting backend and all Android architectures supported by Mono builds.
95+
/// Note: Unity 2019.4.31+ only supports x86 for IL2CPP builds.
9596
/// </summary>
9697
public static void EnableMonoBuildArchitectures()
9798
{
@@ -109,4 +110,4 @@ private static bool IsArchitectureEnabled(AndroidArchitecture androidArchitectur
109110
return (PlayerSettings.Android.targetArchitectures & androidArchitecture) == androidArchitecture;
110111
}
111112
}
112-
}
113+
}

Editor/Scripts/Internal/AppBundlePublisher.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ public static async Task<AndroidBuildReport> BuildTask(AndroidBuildOptions andro
8787

8888
return await appBundleBuilder.CreateBundleWithTask(androidBuildOptions);
8989
}
90+
9091
#endif
9192

9293
/// <summary>
@@ -180,7 +181,11 @@ private static bool Build(AppBundleBuilder appBundleBuilder, AppBundleBuildSetti
180181
var aabFilePath = buildSettings.buildPlayerOptions.locationPathName;
181182
if (IsBatchMode || buildSettings.forceSynchronousBuild)
182183
{
183-
var errorMessage = appBundleBuilder.CreateBundle(aabFilePath, buildSettings.assetPackConfig);
184+
var createBundleOptions = new CreateBundleOptions
185+
{
186+
AabFilePath = aabFilePath, AssetPackConfig = buildSettings.assetPackConfig
187+
};
188+
var errorMessage = appBundleBuilder.CreateBundle(createBundleOptions);
184189
return errorMessage == null;
185190
}
186191

@@ -207,7 +212,12 @@ private static void CreateBundleAsync(
207212
runOnDevice
208213
? (AppBundleBuilder.PostBuildCallback) RunBundle
209214
: EditorUtility.RevealInFinder;
210-
appBundleBuilder.CreateBundleAsync(aabFilePath, assetPackConfig, callback);
215+
216+
var createBundleOptions = new CreateBundleOptions
217+
{
218+
AabFilePath = aabFilePath, AssetPackConfig = assetPackConfig
219+
};
220+
appBundleBuilder.CreateBundleAsync(createBundleOptions, callback);
211221
}
212222

213223
private static void RunBundle(string aabFile)

Editor/Scripts/Internal/BuildTools/AndroidBuilder.cs

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
using Google.Android.AppBundle.Editor.Internal.AssetPacks;
1818
using UnityEditor;
1919
using UnityEngine;
20-
2120
#if UNITY_2018_1_OR_NEWER
2221
using UnityEditor.Build.Reporting;
22+
2323
#endif
2424

2525
namespace Google.Android.AppBundle.Editor.Internal.BuildTools
@@ -108,15 +108,33 @@ public virtual bool Initialize(BuildToolLogger buildToolLogger)
108108
return false;
109109
}
110110

111-
if (PlayerSettings.Android.useAPKExpansionFiles)
111+
if (BuiltInPadHelper.EditorSupportsPad() && BuiltInPadHelper.ProjectHasAndroidPacks())
112112
{
113113
var message =
114-
string.Format(
115-
"This build doesn't support APK Expansion (OBB) files.\n\nLarge games can instead use the " +
116-
"\"{0}\" option available through the \"Google > Android App Bundle > Asset Delivery " +
117-
"Settings\" menu or the AssetPackConfig API's SplitBaseModuleAssets field.\n\n" +
118-
"Click \"OK\" to disable the \"Split Application Binary\" setting.",
119-
AssetDeliveryWindow.SeparateAssetsLabel);
114+
"This build method doesn't support .androidpack folders. Assets within those folders will not be included" +
115+
" in the build.";
116+
buildToolLogger.DisplayOptOutDialog(message, "androidPackError");
117+
}
118+
119+
if (PlayerSettings.Android.useAPKExpansionFiles)
120+
{
121+
string messagePrefix;
122+
if (BuiltInPadHelper.EditorSupportsPad())
123+
{
124+
messagePrefix = "This build method doesn't support Unity's \"Split Application Binary\" option.";
125+
}
126+
else
127+
{
128+
messagePrefix = "This build method doesn't support APK Expansion (OBB) files.";
129+
}
130+
131+
var message = string.Format(
132+
"{0}\n\nLarge games can instead use the " +
133+
"\"{1}\" option available through the \"Google > Android App Bundle > Asset Delivery " +
134+
"Settings\" menu or the AssetPackConfig API's SplitBaseModuleAssets field.\n\n" +
135+
"Click \"OK\" to disable the \"Split Application Binary\" setting.",
136+
messagePrefix,
137+
AssetDeliveryWindow.SeparateAssetsLabel);
120138
if (buildToolLogger.DisplayActionableErrorDialog(message))
121139
{
122140
PlayerSettings.Android.useAPKExpansionFiles = false;

Editor/Scripts/Internal/BuildTools/AndroidSdk.cs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,16 @@ public class AndroidSdk : IBuildTool
3030
public const string AndroidHomeEnvironmentVariableKey = "ANDROID_HOME";
3131

3232
private const string AndroidNdkHomeEnvironmentVariableKey = "ANDROID_NDK_HOME";
33+
34+
/// <summary>
35+
/// The environment variable key we use when overriding existing Unity editor preferences.
36+
/// We use UNITY_JAVA_HOME instead of JAVA_HOME because Unity will override JAVA_HOME to match it's editor preferences.
37+
/// </summary>
38+
private const string JavaHomeEnvironmentVariableKey = "UNITY_JAVA_HOME";
3339
private const string AndroidSdkRootEditorPrefsKey = "AndroidSdkRoot";
3440
private const string AndroidNdkRootEditorPrefsKey = "AndroidNdkRoot";
41+
private const string JdkPathEditorPrefsKey = "JdkPath";
42+
private const string JdkUseEmbeddedEditorPrefsKey = "JdkUseEmbedded";
3543

3644
private string _androidSdkRoot;
3745

@@ -81,7 +89,7 @@ public virtual string RootPath
8189
}
8290

8391
/// <summary>
84-
/// Override the AndroidSdkRoot/AndroidNdkRoot EditorPrefs with corresponding environment variables.
92+
/// Override the AndroidSdkRoot/AndroidNdkRoot/JdkPath EditorPrefs with corresponding environment variables.
8593
/// This is especially helpful for automated builds where the preferences may not be set.
8694
/// </summary>
8795
public static void OverrideEditorPreferences()
@@ -95,16 +103,28 @@ public static void OverrideEditorPreferences()
95103
OverrideEditorPreference(AndroidNdkHomeEnvironmentVariableKey,
96104
() => UnityEditor.Android.AndroidExternalToolsSettings.ndkRootPath,
97105
v => { UnityEditor.Android.AndroidExternalToolsSettings.ndkRootPath = v; });
106+
OverrideEditorPreference(JavaHomeEnvironmentVariableKey,
107+
() => UnityEditor.Android.AndroidExternalToolsSettings.jdkRootPath,
108+
v => { UnityEditor.Android.AndroidExternalToolsSettings.jdkRootPath = v; });
98109
#else
99110
OverrideEditorPreference(AndroidHomeEnvironmentVariableKey,
100111
() => EditorPrefs.GetString(AndroidSdkRootEditorPrefsKey),
101112
v => { EditorPrefs.SetString(AndroidSdkRootEditorPrefsKey, v); });
102113
OverrideEditorPreference(AndroidNdkHomeEnvironmentVariableKey,
103114
() => EditorPrefs.GetString(AndroidNdkRootEditorPrefsKey),
104115
v => { EditorPrefs.SetString(AndroidNdkRootEditorPrefsKey, v); });
116+
117+
OverrideEditorPreference(JavaHomeEnvironmentVariableKey,
118+
() => EditorPrefs.GetString(JdkPathEditorPrefsKey),
119+
v => { EditorPrefs.SetString(JdkPathEditorPrefsKey, v); });
120+
121+
// Older versions of Unity have an additional boolean preference that must be disabled.
122+
// Otherwise, Unity will use the JDK installed with the editor instead of the path we set in EditorPrefs.
123+
EditorPrefs.SetInt(JdkUseEmbeddedEditorPrefsKey, 0);
105124
#endif
106125
}
107126

127+
// TODO(b/189958664): Move this to a helper class and move the JDK portion of OverrideEditorPreferences into JavaUtils.
108128
private static void OverrideEditorPreference(
109129
string environmentVariableKey, Func<string> getPreference, Action<string> setPreference)
110130
{

0 commit comments

Comments
 (0)