Google Analytics libAdIdAccess.a does not contain

2019-01-31 05:20发布

问题:

Xcode 7 beta 3 just installed some "additional components" (now Version 7.0 beta 3 (7A152u)), and now I'm getting a compiler error:

ld: '/<abbreviated>/Vendor/Analytics/GoogleAnalytics/libAdIdAccess.a(TAGActualAdIdAccess.o)' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

This Google Code post is the only mention I've found for GA and bitcode.

It would be nice if I could disable it for this library only rather than disable bitcode entirely. Is that possible?

This answer provides a work around for bitcode being enabled by default, and this may ultimately be a dupe of that more generic question.

回答1:

Update:

Good news everyone!

Google Analytics now supports Bitcode with their 3.14 release. You can grab it from their download sources, however its not listed on Cocoapods yet.

Google Analytics SDK Download

Change Log

Original:

Google needs to compile their analytics SDK into a bitcode library. However, from previous experience with Google updating their libraries to 64-bit it took over half a year iirc.

My advice is if you're not supporting watchOS we can just wait it out, got to

  1. Build Settings

  2. Enable Bitcode

  3. Set to No

If you are supporting watchOS, use a different analytics tool for now.

Extra info:

There's developers talking about it on a google forum here: https://groups.google.com/forum/#!topic/ga-mobile-app-analytics/d6ML4BKBBeY

Facebook and Fabric.io (Crashlytics, TwitterKit) have already updated to use bitcode, so it technically shouldn't be too difficult for Google to follow suit. I believe this type of holdback to be politics. The ones who have the most to lose are our users.



回答2:

Welcome back to 2013, as @david-wong mentioned, it took a year for Google to support arm64. Whenever Apple announces a change or requirement to the toolchain, it takes the Google ios SDK team years to update their static lib. Just to set your expectations, they just recently acknowledge that bitcode support is a "high priority" issue, even though app slicing/bitcode was announced on June 8th, 2015. If you're using GA in your main target, GA will prevent you from using the extremely valuable benefit of architecture slicing.

Disabling bitcode isn't a workaround, it's just disabling bitcode support. Hopefully someone managing GA sees this, and decides to makes ios a first class citizen.



回答3:

Google have just updated the Google Analytics and Google Tag Manager SDKs (version 3.14) to support Bitcode, so you can update the libraries and compile your app using "Enable Bitcode - Yes" flag.

Download page

Direct link



回答4:

Upgrade your GoogleAnalytics sdk using pod.

  1. Open terminal
  2. Go to your project directory
  3. pod init
  4. Open the pod file created in your project directory
  5. Write the following lines

    platform :ios, '10.0'
    
    target “GoogleAnalyticsTestApp” do
       pod 'GoogleAnalytics'
       pod 'GoogleIDFASupport'
    end
    

This will resolve the error. From the following links you can add Google's Api:

1.http://cocoapods.org/pods/GoogleAnalytics

2.http://developers.google.com/ios/guides/cocoapods



回答5:

If you are using cocoapods, you can add this at the end of the Podfile:

post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['ENABLE_BITCODE'] = 'NO'
        end
    end
end

This will recurse through all the pods and mark the ENABLE_BITCODE off. Naturally, you will not be able to compile for the watch / apple tv (as they require it on some versions).