Failed to add app variants to bare project

I’ve followed the instructions on the official Expo site for adding app variants to bare repositories, and I’m seeing a build error on iOS.

Has anyone else run into issues when trying to install app variants in a bare project?

Here’s the error I’m seeing when running a build:

❌  error: Build input file cannot be found: '/Users/expo/workingdir/build/ios/Pods/Target Support Files/Pods-immersely/ExpoModulesProvider.swift'.
Did you forget to declare this file as an output of a script phase or custom build rule which produces it? (in target 'immersely-dev' from project 'immersely')

This guide does not cover a case where you have multiple targets. I never configured stuff like that, but I think you need to have a separate one signal target for each of your new targets.

Also, I noticed that you have a bunch of configurations for managed projects, but your project is bare. Is this misconfiguration, or intentional?

1 Like

Ok thanks so much for checking this out! Let me try configuring multiple one signal targets.

I think some of the managed configuration is left over from before I ejected the project. I do occasionally run expo prebuild, so I think maybe I was keeping some of the config for that.

You might want to run npx expo prebuild --clean occasionally. Sometimes npx expo prebuild is not enough. But note that this will delete your android and ios directories and regenerate them from scratch. So any changes you have made to the native projects will need to be redone.

@wkozyra How might I set up a separate one signal target for each new target? How would that fit into the Podfile specified in the Expo app variant instructions:

abstract_target 'common' do
  # put common target configuration here

  target 'myapp' do
  end

  target 'myapp-dev' do
  end
end

target 'OneSignalNotificationServiceExtension' do
  pod 'OneSignalXCFramework', '>= 3.0', '< 4.0'
end

I’m planning on running expo prebuild --clean as well.

To make it work with a prebuild one signal would have to support that. You can only do that if you prebuild it once and maintain your native code yourself from that point on.

How would that fit into the Podfile specified in the Expo app variant instructions:

It wouldn’t, you need to create all those targets with xcode, entry in podfile just refers to targets that exists in xcode project, you would need to create them first.

Also as I mentioned, I suspect it has to be a separate target, but I’m not 100% sure of that.

@wkozyra Ok thanks for the additional info!

I wanted to do a sanity check, so I just now tried adding iOS app variants to my bare project without OneSignalNotificationServiceExtension and it still didn’t work.

Maybe there’s something wrong with the official Expo instructions? Or maybe it’s my podfile?

Here’s what I did:

  • expo prebuild --clean
  • Ran a build to make sure the build was still working (eas build --local --profile development --platform ios)
  • Followed the official iOS bare workflow app variant steps: Installing app variants on the same device - Expo Documentation
  • And I’m seeing the same error as before:
    error: Build input file cannot be found: '/var/folders/_1/4k922p_53nv7662_tvvn2m1r0000gn/T/eas-build-local-nodejs/0a4bab8c-6897-4d71-9dde-3d65d2c338e1/build/ios/Pods/Target Support Files/Pods-umi/ExpoModulesProvider.swift'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it? (in target 'umi-dev' from project 'umi')

Any ideas here? Appreciate the help!

(I’ve thought about reverting to managed workflow, but seems like a pain since there’s no officially supported way to revert)

I’ve thought about reverting to managed workflow, but seems like a pain since there’s no officially supported way to revert

Just delete android and ios directories

Maybe there’s something wrong with the official Expo instructions? Or maybe it’s my podfile?

There is a lot of potential reason why it might not work. It might an issue with instruction or it might be something in project or it’s dependencies, it’s hard to tell. The main reason for this guide is to show how to use xcode project with multiple application targets in EAS. If the project builds with Xcode, but not on EAS we can probably help, but if you are on bare workflow configuring your native project is ultimately your responsibility to make it work in xcode.

It’s not clear to me whether you followed the Bare workflow instructions or the Managed workflow instructions. Given that you have run npx expo prebuild you would need to follow the Bare instructions.

You should also be able to follow the managed workflow instructions and then run npx expo prebuild --clean after that.

I haven’t tried this in a bare app, so I am quite possibly missing something, but maybe try doing it again following the managed workflow, followed by prebuild --clean and see if that makes a difference.

maybe try doing it again following the managed workflow, followed by prebuild --clean and see if that makes a difference.

This will not work, prebuild will generate a single target project in that case depending on envs that are set when prebuild command is called. If the goal is to have a way fo building multiple app variants then reverting back to managed is the easiest option. Bare option requires a lot more work and knowledge to maintain, so unless you really need to modify native code, it’s better to use managed.

1 Like

OK, thanks for the clarification

Hi @wkozyra can you help please ?

I’m running in to the same problem using xcode Version 14.3.1, I have a bar project and I follow all the instructions on docs and I get the following the error:

Environment

  expo-env-info 1.0.5 environment info:
    System:
      OS: macOS 13.3.1
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 14.15.3 - /var/folders/nn/tt3qwcv969n5lbty3zp_x2jw0000gn/T/yarn--1689689243873-0.26294676520920635/node
      Yarn: 1.22.19 - /var/folders/nn/tt3qwcv969n5lbty3zp_x2jw0000gn/T/yarn--1689689243873-0.26294676520920635/yarn
      npm: 8.9.0 - ~/.nvm/versions/node/v14.15.3/bin/npm
    Managers:
      CocoaPods: 1.11.3 - /Users/ma/.rvm/gems/ruby-2.7.5/bin/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4
      Android SDK:
        API Levels: 29, 30, 31, 32
        Build Tools: 29.0.2, 30.0.0, 30.0.2, 30.0.3, 31.0.0
        System Images: android-29 | Intel x86 Atom_64, android-30 | Google Play Intel x86 Atom
    IDEs:
      Android Studio: 2022.1 AI-221.6008.13.2211.9619390
      Xcode: 14.3.1/14E300c - /usr/bin/xcodebuild
    npmPackages:
      expo: ^44.0.4 => 44.0.6
      react: 17.0.1 => 17.0.1
      react-dom: 17.0.1 => 17.0.1
      react-native: 0.64.3 => 0.64.3
      react-native-web: 0.17.1 => 0.17.1
    npmGlobalPackages:
      eas-cli: 0.47.0
      expo-cli: 5.2.0
    Expo Workflow: bare

Podile


require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking")
require File.join(File.dirname(`node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods")
require File.join(File.dirname(`node --print "require.resolve('@react-native-community/cli-platform-ios/package.json')"`), "native_modules")

platform :ios, '12.0'

require 'json'
podfile_properties = JSON.parse(File.read('./Podfile.properties.json')) rescue {}

abstract_target 'common' do

target 'LnFound' do
  use_expo_modules!
  config = use_native_modules!

  pod 'expo-dev-launcher', path: '../node_modules/expo-dev-launcher', :configurations => :debug
  pod 'expo-dev-menu', path: '../node_modules/expo-dev-menu', :configurations => :debug
  use_react_native!(
    :path => config[:reactNativePath],
    :hermes_enabled => podfile_properties['expo.jsEngine'] == 'hermes'
  )

  # Uncomment to opt-in to using Flipper
  #
  # if !ENV['CI']
  #   use_flipper!('Flipper' => '0.75.1', 'Flipper-Folly' => '2.5.3', 'Flipper-RSocket' => '1.3.1')
  # end

  # post_install do |installer|
  #   react_native_post_install(installer)

  #   # Workaround `Cycle inside FBReactNativeSpec` error for react-native 0.64
  #   # Reference: https://github.com/software-mansion/react-native-screens/issues/842#issuecomment-812543933
  #   installer.pods_project.targets.each do |target|
  #     if (target.name&.eql?('FBReactNativeSpec'))
  #       target.build_phases.each do |build_phase|
  #         if (build_phase.respond_to?(:name) && build_phase.name.eql?('[CP-User] Generate Specs'))
  #           target.build_phases.move(build_phase, 0)
  #         end
  #       end
  #     end
  #   end
  # end





end

target 'LnFoundPro' do
  use_expo_modules!
  config = use_native_modules!

  pod 'expo-dev-launcher', path: '../node_modules/expo-dev-launcher', :configurations => :debug
  pod 'expo-dev-menu', path: '../node_modules/expo-dev-menu', :configurations => :debug
  use_react_native!(
    :path => config[:reactNativePath],
    :hermes_enabled => podfile_properties['expo.jsEngine'] == 'hermes'
  )

  # Uncomment to opt-in to using Flipper
  #
  # if !ENV['CI']
  #   use_flipper!('Flipper' => '0.75.1', 'Flipper-Folly' => '2.5.3', 'Flipper-RSocket' => '1.3.1')
  # end

  # post_install do |installer|
  #   react_native_post_install(installer)

  #   # Workaround `Cycle inside FBReactNativeSpec` error for react-native 0.64
  #   # Reference: https://github.com/software-mansion/react-native-screens/issues/842#issuecomment-812543933
  #   installer.pods_project.targets.each do |target|
  #     if (target.name&.eql?('FBReactNativeSpec'))
  #       target.build_phases.each do |build_phase|
  #         if (build_phase.respond_to?(:name) && build_phase.name.eql?('[CP-User] Generate Specs'))
  #           target.build_phases.move(build_phase, 0)
  #         end
  #       end
  #     end
  #   end
  # end





end

post_install do |installer|
  react_native_post_install(installer)
  # __apply_Xcode_12_5_M1_post_install_workaround(installer)

  # This is necessary for Xcode 14, because it signs resource bundles by default
  # when building for devices.
  installer.target_installation_results.pod_target_installation_results
    .each do |pod_name, target_installation_result|
    target_installation_result.resource_bundle_targets.each do |resource_bundle_target|
      resource_bundle_target.build_configurations.each do |config|
        config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
        
      end
    end
  end
end
post_integrate do |installer|
  begin
    expo_patch_react_imports!(installer)
  rescue => e
    Pod::UI.warn e
  end
end
end