Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When building line-sdk-unity 1.4.0 with Unity 2021.3.37, a build error occurs due to duplicate registration of xcframework, resulting in a "duplicate output file" error. #69

Closed
matsumura-katsuhiro opened this issue Apr 11, 2024 · 2 comments · Fixed by #71

Comments

@matsumura-katsuhiro
Copy link

Is it a security issue?

No

What did you do?

When building line-sdk-unity 1.4.0 with Unity 2021.3.37, a build error occurs.
Unity 2021.3.37 includes xcframework support, which seems to be causing file duplication.

Here is a part of the error that occurs

unexpected duplicate tasks
duplicate output file

(ProjectPath)/Xcode/DerivedData/Unity-iPhone-cvuxrfxovekkikcqqiqjlzycrysy/Build/Intermediates.noindex/ArchiveIntermediates/Unity-iPhone/BuildProductsPath/Release-iphoneos/2BAC3286-CC10-3FAA-BB02-6F84A3D39864.bcsymbolmap' on task: ProcessXCFramework (ProjectPath)/iOS/Libraries/Plugins/iOS/LineSDK/LineSDKObjC.xcframework /Users/violet/Library/Developer/Xcode/DerivedData/Unity-iPhone-cvuxrfxovekkikcqqiqjlzycrysy/Build/Intermediates.noindex/ArchiveIntermediates/Unity-iPhone/BuildProductsPath/Release-iphoneos/LineSDKObjC.framework

This phenomenon also occurs in a project that only includes the LineSDK.

When setting the environment to iOS and performing an Archive on the Xcode project generated by executing "Build," an Unexpected duplicate tasks error occurs.

What did you expect?

I hope that the duplicate registration of xcframework will not occur and that the build will be successful.

This phenomenon may be due to an issue with Unity's handling of xcframework.

I was able to confirm that the build succeeds by adding the following code:

In FrameworkAdding.cs, I confirmed that removing the LineSDKObjC.xcframework, which Unity seems to be adding, with the following code allows it to work correctly:

private const string frameworkXcodePath = "Frameworks/Plugins/iOS/LineSDK/vendor";

// Get the GUID of the source framework without adding it to the project.
var frameworkXcodeSourcePath = Path.Combine(frameworkXcodePath, frameworkName);
string sourceFrameworkGuid = proj.FindFileGuidByProjectPath(frameworkXcodeSourcePath);
Debug.Log("Framework GUID: " + sourceFrameworkGuid);

// Remove the source framework from the project if it exists.
if (!string.IsNullOrEmpty(sourceFrameworkGuid)) {
	proj.RemoveFileFromBuild(appTargetGuid, sourceFrameworkGuid);
	proj.RemoveFrameworkFromProject(appTargetGuid, frameworkName);
	proj.RemoveFile(sourceFrameworkGuid);
}

I would like to confirm if this approach is correct.

What happened actually?

When building line-sdk-unity 1.4.0 with Unity 2021.3.37, the following build errors occur
unexpected duplicate tasks
duplicate output file

Your environment?

Apple MacBook Pro M1 2021
macOS 13.6.4 ventura
line-sdk-unity 1.4.0 with Unity 2021.3.37

Sample project

@Kenward1336
Copy link

I found easier way to solve this issue.
line-sdk-unity 1.4.0 have a problem with LineSDKObjc.framework loaded twice.

When you check your Xcode project, You can found LineSDKObjC.framework in
{Project}/Libraries/Plugins/iOS/LineSDK and {Project}/Frameworks/Plugins/iOS/LineSDK/vender

To solve this issue,
Simply deselect the iOS import option and then apply the LineSDKObjc.framework within Unity's Assets/Plugins/iOS/LineSDK/vendor.
image

@onevcat
Copy link
Member

onevcat commented May 31, 2024

Should be fixed in 1.4.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants