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

Unable to install FirebaseAnalytics Xcode 12 with SPM #6360

Closed
coulonb opened this issue Aug 28, 2020 · 32 comments
Closed

Unable to install FirebaseAnalytics Xcode 12 with SPM #6360

coulonb opened this issue Aug 28, 2020 · 32 comments
Labels
beta-software Related to using beta iOS or Xcode versions. Swift Package Manager

Comments

@coulonb
Copy link

coulonb commented Aug 28, 2020

[REQUIRED] Step 1: Describe your environment

  • Xcode version: 12.0 beta 6
  • Firebase SDK version: Branch 6.31-spm-beta
  • Firebase Component: Firebase, FirebaseCrashlytics, FirebaseAnalytics
  • Component version: 6.31
  • Installation method: SPM

[REQUIRED] Step 2: Describe the problem

Hi,
I try to install FirebaseAnalytics from the SPM, and after compiling an error appears and the application doesn't install. I specify that the problem appears when I try to install FirebaseAnalytics. No problems with FirebaseCrashlytics and Firebase.
The -ObjC flag is well added.

Screenshot 2020-08-28 at 15 28 53

Screenshot 2020-08-28 at 15 28 58

Screenshot 2020-08-28 at 15 29 10

Screenshot 2020-08-28 at 15 29 17

@google-oss-bot
Copy link

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

@coulonb coulonb changed the title Unable to install Analytics Xcode 12 Unable to install Analytics Xcode 12 with SPM Aug 28, 2020
@coulonb coulonb changed the title Unable to install Analytics Xcode 12 with SPM Unable to install FirebaseAnalytics Xcode 12 with SPM Aug 28, 2020
@paulb777 paulb777 added Swift Package Manager beta-software Related to using beta iOS or Xcode versions. and removed needs-triage labels Aug 28, 2020
@ryanwilson
Copy link
Member

Hey @coulonb - sorry for the issues you're seeing.

I'm unable to reproduce this on both device and simulator. Can you please try creating a brand new project, following the installation steps and seeing if you still run into the issue? Also, is this an iOS/iPadOS app, or does it target a different platform?

It could be a provisioning issue as well. We'll likely need a repro to make any further progress on it. Thanks!

@ryanwilson
Copy link
Member

Thanks for the extra info @EthanHannah.

@coulonb can you follow the same steps to see if that helps for you? Restarting, cleaning the build folder, and reinstalling the app?

If that doesn't help you, we'll likely need a project or steps to reproduce the issue in order to make further progress. Hopefully that helps get you unblocked, though!

@Neilfau
Copy link

Neilfau commented Sep 1, 2020

I also have the same issue, I have Firebase Analytics as a dependency of another package that is added to my main project. I get the following error when I try to run the app on device or simulator and ive tried all the Xcode tricks with derived data, restarting devices etc.

Details

Unable to install "FirebaseExample"
Domain: com.apple.dt.MobileDeviceErrorDomain
Code: -402653103
--
Could not inspect the application package.
Domain: com.apple.dt.MobileDeviceErrorDomain
Code: -402653103
User Info: {
    DVTRadarComponentKey = 282703;
    MobileDeviceErrorCode = "(0xE8000051)";
    "com.apple.dtdevicekit.stacktrace" = (
	0   DTDeviceKitBase                     0x000000012b9b290f DTDKCreateNSErrorFromAMDErrorCode + 220
	1   DTDeviceKitBase                     0x000000012b9f10f4 __90-[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:]_block_invoke + 155
	2   DVTFoundation                       0x000000010e93dcef DVTInvokeWithStrongOwnership + 71
	3   DTDeviceKitBase                     0x000000012b9f0e35 -[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:] + 1440
	4   IDEiOSSupportCore                   0x000000012b861d84 __118-[DVTiOSDevice(DVTiPhoneApplicationInstallation) processAppInstallSet:appUninstallSet:installOptions:completionBlock:]_block_invoke.292 + 3513
	5   DVTFoundation                       0x000000010ea6c45a __DVT_CALLING_CLIENT_BLOCK__ + 7
	6   DVTFoundation                       0x000000010ea6e07c __DVTDispatchAsync_block_invoke + 1191
	7   libdispatch.dylib                   0x00007fff72f3a6c4 _dispatch_call_block_and_release + 12
	8   libdispatch.dylib                   0x00007fff72f3b658 _dispatch_client_callout + 8
	9   libdispatch.dylib                   0x00007fff72f40c44 _dispatch_lane_serial_drain + 597
	10  libdispatch.dylib                   0x00007fff72f415d6 _dispatch_lane_invoke + 363
	11  libdispatch.dylib                   0x00007fff72f4ac09 _dispatch_workloop_worker_thread + 596
	12  libsystem_pthread.dylib             0x00007fff73195a3d _pthread_wqthread + 290
	13  libsystem_pthread.dylib             0x00007fff73194b77 start_wqthread + 15
);
}
--


System Information

macOS Version 10.15.6 (Build 19G2021)
Xcode 12.0 (17210.1)

@ryanwilson
Copy link
Member

@Neilfau sorry for the troubles. Are you able to reproduce it by creating a blank project and adding the dependency there? If it does, please let us know what steps you took so we can reproduce it. Without being able to reproduce it on our end we likely won't be able to help much more. Thanks!

@Neilfau
Copy link

Neilfau commented Sep 1, 2020

@ryanwilson with a blank project the app runs but crashes shortly after starting. All I call is FirebaseApp.configure() but nothing else. I get the error:
-[__NSCFString apm_UTF32Length]: unrecognized selector sent to instance 0x280267dc0

@Neilfau
Copy link

Neilfau commented Sep 1, 2020

@ryanwilson to clarify though that was a blank project with a local swift package dragged into the project with firebase as a dependency of that. Im now going to just add firebase as a dependency of the blank project and check that works.

@ryanwilson
Copy link
Member

Thanks @Neilfau - the crashing issue sounds like you need to add the -ObjC linker option.

@Neilfau
Copy link

Neilfau commented Sep 1, 2020

@ryanwilson ah yeah good point forgot to add that for the blank project. Will try again.

@Neilfau
Copy link

Neilfau commented Sep 1, 2020

@ryanwilson ok can confirm it works if Firebase is a dependency of a local package and if added to a blank project locally by dragging the package into Xcode and also if the firebase package is added to project directly. I have also added the package with the firebase dependency remotely and it also works fine, so I think the error is possibly related to having a project with 2 different packages that both have firebase as a dependency?

@ryanwilson
Copy link
Member

Ah, so you're saying your setup has dependency Foo which depends on Firebase, and dependency Bar which also depends on Firebase, and you think they're both being included? At first thought that shouldn't be happening since Swift Package Manager's dependency resolution should catch that, but also the error would be a duplicate symbols error instead of the above error.

Can you reproduce the above error with that setup?

@Neilfau
Copy link

Neilfau commented Sep 1, 2020

@ryanwilson not sure if I explained that well enough but my app structure is as follows:

Package A - dependencies: Firebase Package (FirebaseCore, FirebaseDatabase) & Package B
Package B - dependencies: Firebase Package (FirebaseAnalytics)

Xcode Project - dependencies: Package A

@ryanwilson
Copy link
Member

@Neilfau makes sense, thanks. If you add those dependencies in the blank project (if possible), does the error happen for you still?

@Neilfau
Copy link

Neilfau commented Sep 1, 2020

@ryanwilson ive added firebase package (FirebaseCore, FirebaseDatabase) to the blank project and have also added the test package which has firebase (FirebaseAnayltics, FirebaseCore) as dependency also and the project builds and runs fine. The next thing im going to try is making a second package with a firebase dependency and adding both packages to the blank project and see what happens.

@coulonb
Copy link
Author

coulonb commented Sep 2, 2020

@ryanwilson @EthanHannah Restarting, clean everything seems to be not the solution for me. I will tried with a new starter project and back to you.

@Neilfau
Copy link

Neilfau commented Sep 2, 2020

@ryanwilson Ok I completely recreated the same structure with a blank project and it works on both device and simulator so I'm no closer to finding the cause of the issue unfortunately. In my actual project I get this additional error when trying to run on a simulator compared to running on my device:

This app could not be installed at this time.
Domain: IXUserPresentableErrorDomain
Code: 1
Failure Reason: Could not install at this time.
Recovery Suggestion: Failed to load Info.plist from bundle at path /Users/neil/Library/Developer/CoreSimulator/Devices/35051889-6FBE-4376-92CF-51DEE6706D23/data/Library/Caches/com.apple.mobile.installd.staging/temp.qkBgi4/extracted/SportPointExampleLocal.app/Frameworks/GoogleAppMeasurement.framework; Extra info about Info.plist: Couldn't stat /Users/neil/Library/Developer/CoreSimulator/Devices/35051889-6FBE-4376-92CF-51DEE6706D23/data/Library/Caches/com.apple.mobile.installd.staging/temp.qkBgi4/extracted/SportPointExampleLocal.app/Frameworks/GoogleAppMeasurement.framework/Info.plist: No such file or directory
--
Failed to load Info.plist from bundle at path /Users/neil/Library/Developer/CoreSimulator/Devices/35051889-6FBE-4376-92CF-51DEE6706D23/data/Library/Caches/com.apple.mobile.installd.staging/temp.qkBgi4/extracted/SportPointExampleLocal.app/Frameworks/GoogleAppMeasurement.framework; Extra info about Info.plist: Couldn't stat /Users/neil/Library/Developer/CoreSimulator/Devices/35051889-6FBE-4376-92CF-51DEE6706D23/data/Library/Caches/com.apple.mobile.installd.staging/temp.qkBgi4/extracted/SportPointExampleLocal.app/Frameworks/GoogleAppMeasurement.framework/Info.plist: No such file or directory
Domain: MIInstallerErrorDomain
Code: 35
User Info: {
    FunctionName = "-[MIBundle _validateWithError:]";
    LegacyErrorString = PackageInspectionFailed;
    SourceFileLine = 131;
}
--


System Information

macOS Version 10.15.6 (Build 19G2021)
Xcode 12.0 (17210.1)

@coulonb
Copy link
Author

coulonb commented Sep 2, 2020

Like @Neilfau, after created new project with exactly the same structures (same lib, versioning flag,..) I don't have the problem on the new project. I don't understand where the problem on the initial project may come from.

@Neilfau
Copy link

Neilfau commented Sep 2, 2020

@ryanwilson think I've tried everything now & I still cannot recreate the issue with a blank project. I have now instead of adding the package that has the firebase analytics as a dependency to my second package, I have just added the firebase analytics to the target dependencies of the second package and im hoping that builds and runs. So for now I'll have use Analytics framework directly rather than having a separate package for it which I didn't really want to do but I'm running out time to spend on this issue. Hopefully someone else can do some more digging and find the cause.

@Neilfau
Copy link

Neilfau commented Sep 2, 2020

@ryanwilson unfortunately that didn't work either ... soon as I add the target dependency:
.product(name: "FirebaseAnalytics", package: "Firebase") I get the error when trying to run the app, if I comment it out it runs again.

@jesusmateos1234
Copy link

The problem with GoogleAppMeasurement.plist also it's reproduced with Carthage

@coulonb
Copy link
Author

coulonb commented Sep 2, 2020

Same issue concerning the simulator but it's not totally the same errorr. I thought maybe there was a cache conflict with cocoapods because I had installed FirebaseAnalytics before with this pod. Everything is clean and cached, Pods are completely remove from the project so it's a possibility that has been ruled out.

Details

This app was unable to be installed.
Domain: IXUserPresentableErrorDomain
Code: 2
--
Failed to load Info.plist from bundle at path /Users/pierrickcoulon-safeware/Library/Developer/CoreSimulator/Devices/4216D79A-92A0-4F3E-8C07-0B42FD6034CA/data/Library/Caches/com.apple.mobile.installd.staging/temp.S30IwG/extracted/Hamilton Visitor.app/Frameworks/GoogleAppMeasurement.framework
Domain: MIInstallerErrorDomain
Code: 35
User Info: {
    FunctionName = "-[MIBundle _validateWithError:]";
    LegacyErrorString = PackageInspectionFailed;
    SourceFileLine = 38;
}
--


System Information

macOS Version 10.15.6 (Build 19G73)
Xcode 12.0 (17210.1)

@paulb777
Copy link
Member

paulb777 commented Sep 2, 2020

@Neilfau @coulonb Is there anything different about Build Settings between the new project and the project that demonstrates the issue?

Are you able to incrementally add to the new project or remove from the broken project to isolate what triggers the problem?

If anyone can share a reproducible example, it would be helpful.

@coulonb
Copy link
Author

coulonb commented Sep 2, 2020

@paulb777 I looked carefully line by line and I saw nothing that changes in the build settings.
I'm trying to recreate the bug on a new project but for the moment impossible to reproduce.
And to get the things that trigger the problem in the broken project I would have to know what's going on too.
I'm still looking...

@Neilfau
Copy link

Neilfau commented Sep 3, 2020

@paulb777 I couldn't see anything in the build settings and ive tried adding other packages incrementally but not class files as its a big project and would take me a long time and don't think that would have anything to do with it anyway and I have only one class that imports FirebaseDatabase and one class for analytics.

@paulb777
Copy link
Member

paulb777 commented Sep 4, 2020

Thanks for checking @coulonb @Neilfau. Unfortunately, we're stalled on our end until we can get a reproducible example.

@Neilfau
Copy link

Neilfau commented Sep 10, 2020

@paulb777 @ryanwilson

I have an update about this issue... I now have it kind of working. So the structure of my app is like the following:

[Firebase Package] -> [Analytics Package] -> [Core Package] -> [Xcode Project]

If the [Core Package] is added to the [Xcode Project] locally then when I try to build and run the app I get the same errors above. If however I add the package using Xcode's Add Package Dependency and use a repo url to add the package the app will build and run fine and analytics are working.

I would also add that I am now using the 6.32-spm-beta branch and I had to remove the following from my package file because it caused the package to fail:

 .product(name: "Firebase", package: "Firebase"),
 .product(name: "FirebaseCore", package: "Firebase"),

Hope this might help point you in the right direction.

@kylebrowning
Copy link

Yup, this is happening for me too. I don't have a dependency setup like the above.

Im straight up depending on firebase-ios-sdk and I am including.

image

Removing firebase analytics solves the issue, but that's kind of a nonstarter considering we use it.

@goncharik
Copy link

Hello @paulb777

I have the same issue. And I was able to reproduce it with new project. Was doing nothing special, just created new xcode project. Set it up with deployment target for iOS 12 and just add few swift packages with Firebase. And it shows same error about missing Info.plist on running for simulator. You can checkout this demo project here: https://github.com/goncharik/XCFrameworkSPMDemo

Please advice what am I doing wrong.

@ryanwilson
Copy link
Member

Aha, thanks for the project @goncharik! I now see the issue with the project you provided. Digging into it now to see if I can track this down.

I thought this may have been an project that targets iOS < 13 issue but after creating a new project and modifying it appropriately to run on iOS 10, adding Firebase to it via SwiftPM, I was still unable to reproduce the issue.

@Neilfau re: removing the Firebase and FirebaseCore products - that was an intention decision we made since those should be included by default in every installation and it's likely just confusing for future users. Thanks for bringing that up though!

@Neilfau
Copy link

Neilfau commented Sep 11, 2020

@ryanwilson ok great! Yeah my project targets iOS 13.0+ so I don't think its that.

@kylebrowning
Copy link

My project is also 13+

@paulb777
Copy link
Member

Thanks for the repro case @goncharik ! We were able to isolate and fix.

To pick up the fix - File -> Swift Packages -> Update to Latest Package Versions

We were able to isolate to missing Info.plist files in the Analytics .frameworks and fix in #6444. It's a mystery about why this sometimes works and sometimes doesn't. Perhaps an Xcode race condition?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
beta-software Related to using beta iOS or Xcode versions. Swift Package Manager
Projects
None yet
Development

No branches or pull requests

9 participants