question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug]: maplibre being installed in v10 - Package.resolved file is corrupted or malformed

See original GitHub issue

Mapbox Implementation

Mapbox

Mapbox Version

default

Platform

iOS

@rnmapbox/maps version

10.0.0-beta.56

Standalone component to reproduce

/* @flow */ import React from ‘react’; import { StyleSheet, View } from ‘react-native’; import MapboxGL from ‘@rnmapbox/maps’;

// Set mapbox access token MapboxGL.setAccessToken(‘MAPBOX_ACCESS_TOKEN’);

type Props = { style?: StyleType, };

/**

  • Mapbox Map
  • @todo replicate logic from …/Map/Map.js */ const MapboxMap = ({ style }: Props) => { return <MapboxGL.MapView style={[styles.container, style]} />; };

const styles = StyleSheet.create({ container: { flex: 1, }, });

export default MapboxMap;

Observed behavior and steps to reproduce

Steps to reproduce:

react-native init sample --version react-native@0.60.5
cd sample
npm install rnmapbox/maps#main --save
// do ios setup instructions mentioned in docs (update podfile)
cd ios
pod install

A file package.resolved is created

{
  "pins" : [
    {
      "identity" : "maplibre-gl-native-distribution",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/maplibre/maplibre-gl-native-distribution",
      "state" : {
        "revision" : "4e44c56a54fd3750a24388827f78c8360b0a50f2",
        "version" : "5.12.1"
      }
    }
  ],
  "version" : 2
}

When building using fasatlane, this error is thrown:

xcodebuild: error: Could not resolve package dependencies:
  Package.resolved file is corrupted or malformed; fix or delete the file to continue: unsupported schema version 2

Expected behavior

maplibre should not be installed and package.resolved file should not be created.

Notes / preliminary analysis

Podfile has $RNMapboxMapsImpl = ‘mapbox’.

Podfile:

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

# By Us - mapbox - https://github.com/rnmapbox/maps/blob/main/ios/install.md
$RNMapboxMapsImpl = 'mapbox'

platform :ios, '13.0'
install! 'cocoapods', :deterministic_uuids => false

target 'MyApp' do
  config = use_native_modules!

  # Flags change depending on the env values.
  flags = get_default_flags()

  use_react_native!(
    :path => config[:reactNativePath],
    # Hermes is now enabled by default. Disable by setting this flag to false.
    # Upcoming versions of React Native may rely on get_default_flags(), but
    # we make it explicit here to aid in the React Native upgrade process.
    :hermes_enabled => true,
    :fabric_enabled => flags[:fabric_enabled],
    # Enables Flipper.
    #
    # Note that if you have use_frameworks! enabled, Flipper will not work and
    # you should disable the next line.
    :flipper_configuration => FlipperConfiguration.enabled,
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  target 'MyAppTests' do
    inherit! :complete
    # Pods for testing
  end

  # By Us - mapbox - # By Us - mapbox - https://github.com/rnmapbox/maps/blob/main/ios/install.md
  pre_install do |installer|
    $RNMapboxMaps.pre_install(installer)
  end

  post_install do |installer|
    react_native_post_install(
      installer,
      # Set `mac_catalyst_enabled` to `true` in order to apply patches
      # necessary for Mac Catalyst builds
      :mac_catalyst_enabled => false
    )
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
    # By Us - mapbox - # By Us - mapbox - https://github.com/rnmapbox/maps/blob/main/ios/install.md
    $RNMapboxMaps.post_install(installer)
  end
end

Additional links and references

No response

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
mfazekascommented, Nov 24, 2022

@a-tokyo yep because you mush have run pod install before setting $RNMapboxMapsImpl as well, and that defaulted to maplibre. Go to project Package dependencies and remove the extra maplibre dependency.

0reactions
a-tokyocommented, Nov 25, 2022

@mfazekas Thanks! That’s helpful.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Package.resolved file is corrupted or malformed - Stack Overflow
I tried the solution suggested by Maxwell above but it didn't resolve the problem for me. The error appeared with Xcode 12 but...
Read more >
Xcode 13.2.1 Could not resolve package dependencies
I'm having issues trying to install any swift packages in Xcode 13.2, 13.2.1. ... package dependencies: Package.resolved file is corrupted or malformed; ...
Read more >
Package.resolved file is corrupted or malformed ios build error
I removed my package-lock and rebuilt, I followed this StackOverflow, but still get the error?
Read more >
Package.resolved being reset after checking out a branch with ...
I've got a swift package and I'm running into an issue when switching branches from main to a branch that has updated a...
Read more >
Ahmed Tarek a-tokyo - GitHub
[BUG] maplibre being installed in v10 - Package.resolved file is corrupted or malformed. Environment Dev OS: OSX 12.6.1 Steps to reproduce react-native init ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found