flutter-unity-view-widget
flutter-unity-view-widget copied to clipboard
InvalidOperationException: The build cannot be appended.
I'm trying to create a simple Unity project accessible in Flutter.
But when trying to export using the Flutter Unity Package (https://github.com/juicycleff/flutter-unity-view-widget/tree/master/scripts/FlutterUnityPackage.unitypackage), I receive the following error:
"InvalidOperationException: The build cannot be appended."
Steps to reproduce:
Unity Hub > New > 3D > Create > Click to open new project > Import Flutter Unity Package > Flutter > Export iOS
"InvalidOperationException: The build cannot be appended."
This happens on most versions of Unity. Is there something I'm missing here?
Google: No results found for "the build cannot be appended".
Seems to be an issue with the Flutter Unity Package and newer versions of Unity, which are required for my project.
I suppose this works on Unity version 2019.4.3f1. I will see if I can make an exception. Although on 2019.4.3f1, the following warning appears:
"iOS project doesn't seem to exist, can't append, using replace mode."
I'm also having this issue in windows for android, using unity 2019.4.13f1 and 2020.1.10f1, it shows the following error when click Export Android
InvalidOperationException: The build target does not support build appending. UnityEditor.BuildPipeline.BuildPlayer (System.String[] scenes, System.String locationPathName, System.String assetBundleManifestPath, UnityEditor.BuildTargetGroup buildTargetGroup, UnityEditor.BuildTarget target, UnityEditor.BuildOptions options, System.String[] extraScriptingDefines) (at <3037c1046402403280ab8b0782ca806f>:0)
Update: it seems an error with the last versions 20201.10f1 and 2019.4.13f1, because I tried with the previous version of unity 2019.4.12f1 and is working correctly
The AcceptExternalModificationsToPlayer option seems to be redefined? Some more codes is added to unity 2019.4.13f1. Though it is not published, the decompilation of UnityEditor.dll shows
if ((options & BuildOptions.AcceptExternalModificationsToPlayer) == BuildOptions.AcceptExternalModificationsToPlayer)
{
switch (InternalEditorUtility.BuildCanBeAppended(target, locationPathName))
{
case CanAppendBuild.Unsupported:
throw new InvalidOperationException("The build target does not support build appending.");
case CanAppendBuild.No:
throw new InvalidOperationException("The build cannot be appended.");
}
}
The removal of AcceptExternalModificationsToPlayer will make it happy.
Our build pipeline broke down too when upgrading to 2019.4.14f1. Unity has changed the behaviour of BuildOptions.AcceptExternalModificationsToPlayer. It no longer works with Gradle builds. You have to use EditorUserBuildSettings.exportAsGoogleAndroidProject = true;
https://forum.unity.com/threads/oculus-build-invalidoperationexception-the-build-target-does-not-support-build-appending.994930/
Our build pipeline broke down too when upgrading to 2019.4.14f1. Unity has changed the behaviour of BuildOptions.AcceptExternalModificationsToPlayer. It no longer works with Gradle builds. You have to use EditorUserBuildSettings.exportAsGoogleAndroidProject = true;
https://forum.unity.com/threads/oculus-build-invalidoperationexception-the-build-target-does-not-support-build-appending.994930/
thanks for him i just opened Build.cs file and edited it : changed doBuild function of the android target looking for this line var options = BuildOptions.AllowDebugging.AcceptExternalModificationsToPlayer; and change it to something else like that var options = BuildOptions.AllowDebugging; and it worked
Having exactly the same issue on 2020.1.10f1 (android export)
Having exactly the same issue on 2020.1.10f1 (android export)
@Pyciko did you try the solution that mention @midoshawky ?
Having exactly the same issue on 2020.1.10f1 (android export)
@Pyciko did you try the solution that mention @midoshawky ?
yes I did the result was useless too. it managed to build the apk, but then, a couple of errors came out in unity, and even more errors on build with flutter. sorry, not around my pc right now, but I can send them later
Hi,
I tried @midoshawky solution and it let me build the APK, I use the oculus quest to recieve data from external sensors via bluetooth, however, when I delete the BuildOptions.AcceptExternalModificationsToPlayer option the oculus quest no longer recieves sensor data and I can no longer build the app without removing this option. EditorUserBuildSettings.exportAsGoogleAndroidProject = true; doesn't fix my issue, it only let's me build the app. Does anyone have a similar issue?
Yeah so, @Darkmax, about the problems. If I change the line of code that @midoshawky suggested, it builds the apk, but nothing more. UnityExport folder is missing, unity as library is missing etc.
@emcengineer is this an Oculus specific build issue?
Thanks @snlehton and @midoshawky, your solutions worked for me to resolve this error on Android/iOS builds in Unity 2020.1.15f1.
To summarize, replace the following lines in Assets > FlutterUnityIntegration > Editor > Build.cs.
For iOS, replace this line in DoBuildIOS()
-
var options = BuildOptions.AcceptExternalModificationsToPlayer;
with
var options = BuildOptions.AllowDebugging;
For Android, replace this line in DoBuildAndroid()
-
var options = BuildOptions.AcceptExternalModificationsToPlayer;
with
var options = BuildOptions.AllowDebugging;
EditorUserBuildSettings.exportAsGoogleAndroidProject = true;
On Android, that last line is important. It tells Unity to export an Android Studio project instead of an apk. Forgetting it will cause the copy step of the export script to fail.
@russelljahn Do you mean DoBuildIOS
for iOS?
By the way, when I build, where exactly can I find the unity project? I looked at Builds
directory and all I see is a Test Project.apk
directory which seems to be my Android build directory. However, I can't find the iOS build directory. On the readme it says that they are in android/unityLibrary
and ios/UnityLibrary
but where are those directories?
@aznshodan Yep, typo, I meant DoBuildIOS
for iOS.
And yes, those are the correct directories. When exported successfully, they're located under your root Flutter project folder:
<Your Flutter Project>
├── android
│ └── unityLibrary
├── ios
│ └── UnityLibrary
├── lib
├── test
├── unity
│ └── <Your Unity Project>
│ ├── Assets
│ └── Builds
├── pubspec.yml
├── README.md
For example, in my screenshots molecule
is my Flutter project directory.
The exported unityLibrary
location for Android:
The exported UnityLibrary
location for iOS:
Our build pipeline broke down too when upgrading to 2019.4.14f1. Unity has changed the behaviour of BuildOptions.AcceptExternalModificationsToPlayer. It no longer works with Gradle builds. You have to use EditorUserBuildSettings.exportAsGoogleAndroidProject = true; https://forum.unity.com/threads/oculus-build-invalidoperationexception-the-build-target-does-not-support-build-appending.994930/
thanks for him i just opened Build.cs file and edited it : changed doBuild function of the android target looking for this line var options = BuildOptions.AllowDebugging.AcceptExternalModificationsToPlayer; and change it to something else like that var options = BuildOptions.AllowDebugging; and it worked
I love you, it works
I expect this is the related Unity issue https://issuetracker.unity3d.com/issues/buildoptions-dot-acceptexternalmodificationstoplayer-throws-error-when-building-for-ios-if-the-xcode-project-does-not-already-exist
I had the same issue when building Andorid projec on ubuntut with unity engine 2020.3.19f1 using FlutterUnityIntegration-v4.1.0. i will try other combinations to see what works
Our build pipeline broke down too when upgrading to 2019.4.14f1. Unity has changed the behaviour of BuildOptions.AcceptExternalModificationsToPlayer. It no longer works with Gradle builds. You have to use EditorUserBuildSettings.exportAsGoogleAndroidProject = true; https://forum.unity.com/threads/oculus-build-invalidoperationexception-the-build-target-does-not-support-build-appending.994930/
thanks for him i just opened Build.cs file and edited it : changed doBuild function of the android target looking for this line var options = BuildOptions.AllowDebugging.AcceptExternalModificationsToPlayer; and change it to something else like that var options = BuildOptions.AllowDebugging; and it worked
my issue has been solved, with this solution. thanks brother @midoshawky
Unity version 2020.3.20f1 Flutter Unity Integration v4.1.0 : https://github.com/juicycleff/flutter-unity-view-widget/blob/master/scripts/FlutterUnityIntegration-v4.1.0.unitypackage
@juicycleff Can this fix be merged anytime soon?