MobiVM / robovm-robopods

55 stars 37 forks source link

GoogleMobileAds, file was built for unsupported file format #10

Closed joshmmo closed 8 years ago

joshmmo commented 8 years ago

I am attempting to setup google-mobile-ads with my libgdx project. While attempting to create the IPA I get the following error:

Classpath entry /Users/imac/jenkins/workspace/Sight_Words_Racing_iOS/ios/build/resources/main does not exist
Classpath entry /Users/imac/jenkins/workspace/Sight_Words_Racing_iOS/ios/build/resources/main does not exist
Root pattern com.badlogic.gdx.physics.bullet.** matches no classes
ld: warning: ignoring file /Users/imac/jenkins/workspace/Sight_Words_Racing_iOS/ios/libs/GoogleMobileAds.framework/GoogleMobileAds, file was built for unsupported file format ( 0x56 0x65 0x72 0x73 0x69 0x6F 0x6E 0x73 0x2F 0x43 0x75 0x72 0x72 0x65 0x6E 0x74 ) which is not the architecture being linked (armv7): /Users/imac/jenkins/workspace/Sight_Words_Racing_iOS/ios/libs/GoogleMobileAds.framework/GoogleMobileAds
ld: warning: undefined base symbol '_GADAdSizeFromNSValue' for alias '__unhidden_GADAdSizeFromNSValue'
ld: warning: undefined base symbol '_IsGADAdSizeValid' for alias '__unhidden_IsGADAdSizeValid'
ld: warning: undefined base symbol '_CGSizeFromGADAdSize' for alias '__unhidden_CGSizeFromGADAdSize'
ld: warning: undefined base symbol '_kGADAdSizeSmartBannerLandscape' for alias '__unhidden_kGADAdSizeSmartBannerLandscape'
ld: warning: undefined base symbol '_GADAdSizeFullWidthPortraitWithHeight' for alias '__unhidden_GADAdSizeFullWidthPortraitWithHeight'
ld: warning: undefined base symbol '_GADAdSizeFromCGSize' for alias '__unhidden_GADAdSizeFromCGSize'
ld: warning: undefined base symbol '_GADAdSizeEqualToSize' for alias '__unhidden_GADAdSizeEqualToSize'
ld: warning: undefined base symbol '_kGADAdSizeSkyscraper' for alias '__unhidden_kGADAdSizeSkyscraper'
ld: warning: undefined base symbol '_kGADAdSizeSmartBannerPortrait' for alias '__unhidden_kGADAdSizeSmartBannerPortrait'
ld: warning: undefined base symbol '_kGADAdSizeLargeBanner' for alias '__unhidden_kGADAdSizeLargeBanner'
ld: warning: undefined base symbol '_kGADAdSizeBanner' for alias '__unhidden_kGADAdSizeBanner'
ld: warning: undefined base symbol '_GADAdSizeFullWidthLandscapeWithHeight' for alias '__unhidden_GADAdSizeFullWidthLandscapeWithHeight'
ld: warning: undefined base symbol '_kGADAdSizeFullBanner' for alias '__unhidden_kGADAdSizeFullBanner'
ld: warning: undefined base symbol '_NSStringFromGADAdSize' for alias '__unhidden_NSStringFromGADAdSize'
ld: warning: undefined base symbol '_kGADSimulatorID' for alias '__unhidden_kGADSimulatorID'
ld: warning: undefined base symbol '_kGADAdSizeInvalid' for alias '__unhidden_kGADAdSizeInvalid'
ld: warning: undefined base symbol '_kDFPSimulatorID' for alias '__unhidden_kDFPSimulatorID'
ld: warning: undefined base symbol '_kGADAdLoaderAdTypeNativeCustomTemplate' for alias '__unhidden_kGADAdLoaderAdTypeNativeCustomTemplate'
ld: warning: undefined base symbol '_kGADErrorDomain' for alias '__unhidden_kGADErrorDomain'
ld: warning: undefined base symbol '_kGADAdLoaderAdTypeNativeAppInstall' for alias '__unhidden_kGADAdLoaderAdTypeNativeAppInstall'
ld: warning: undefined base symbol '_NSValueFromGADAdSize' for alias '__unhidden_NSValueFromGADAdSize'
ld: warning: undefined base symbol '_kGADAdLoaderAdTypeNativeContent' for alias '__unhidden_kGADAdLoaderAdTypeNativeContent'
ld: warning: undefined base symbol '_kGADAdSizeMediumRectangle' for alias '__unhidden_kGADAdSizeMediumRectangle'
ld: warning: undefined base symbol '_kGADAdSizeLeaderboard' for alias '__unhidden_kGADAdSizeLeaderboard'
Undefined symbols for architecture armv7:
  "_OBJC_CLASS_$_GADInterstitial", referenced from:
      objc-class-ref in libGGLAdMob.a(GGLContext+AdMob.o)
  "_OBJC_CLASS_$_GADBannerView", referenced from:
      objc-class-ref in libGGLAdMob.a(GGLContext+AdMob.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
:ios:createIPA FAILED

Here is my robovm.xml file:

<config>
  <executableName>${app.executable}</executableName>
  <mainClass>${app.mainclass}</mainClass>
  <os>ios</os>
  <arch>thumbv7</arch>
  <target>ios</target>
  <iosInfoPList>Info.plist.xml</iosInfoPList>
  <resources>
    <resource>
      <directory>../android/assets</directory>
      <includes>
        <include>**</include>
      </includes>
      <skipPngCrush>true</skipPngCrush>
    </resource>
    <resource>
      <directory>resources</directory>
    </resource>
  </resources>
  <forceLinkClasses>
    <pattern>com.badlogic.gdx.scenes.scene2d.ui.*</pattern>
    <pattern>com.badlogic.gdx.physics.bullet.**</pattern>
    <pattern>com.android.okhttp.HttpHandler</pattern>
    <pattern>com.android.okhttp.HttpsHandler</pattern>
    <pattern>com.android.org.conscrypt.**</pattern>
    <pattern>com.android.org.bouncycastle.jce.provider.BouncyCastleProvider</pattern>
    <pattern>com.android.org.bouncycastle.jcajce.provider.keystore.BC$Mappings</pattern>
    <pattern>com.android.org.bouncycastle.jcajce.provider.keystore.bc.BcKeyStoreSpi</pattern>
    <pattern>com.android.org.bouncycastle.jcajce.provider.keystore.bc.BcKeyStoreSpi$Std</pattern>
    <pattern>com.android.org.bouncycastle.jce.provider.PKIXCertPathValidatorSpi</pattern>
    <pattern>com.android.org.bouncycastle.crypto.digests.AndroidDigestFactoryOpenSSL</pattern>
    <pattern>org.apache.harmony.security.provider.cert.DRLCertFactory</pattern>
    <pattern>org.apache.harmony.security.provider.crypto.CryptoProvider</pattern>
    <pattern>com.badlogic.gdx.pay.ios.apple.PurchaseManageriOSApple</pattern>
  </forceLinkClasses>
  <libs>
    <lib>z</lib>
  </libs>
  <frameworkPaths>
    <path>libs</path>
  </frameworkPaths>
  <frameworks>
    <framework>UIKit</framework>
    <framework>OpenGLES</framework>
    <framework>QuartzCore</framework>
    <framework>CoreGraphics</framework>
    <framework>OpenAL</framework>
    <framework>AudioToolbox</framework>
    <framework>AVFoundation</framework>
    <framework>GoogleMobileAds</framework>
    <framework>GLKit</framework>
    <framework>CoreVideo</framework>
    <framework>CoreBluetooth</framework>
    <framework>CoreMotion</framework>
    <framework>SafariServices</framework>
    <framework>EventKit</framework>
    <framework>EventKitUI</framework>
  </frameworks>
  <weakFrameworks>
    <framework>AdSupport</framework>
    <framework>StoreKit</framework>
  </weakFrameworks>
</config>

I have put GoogleMobileAds.framework directory inside of ios/libs. I have tried both 7.11 and 7.12.1 of the GoogleMobileAds.framework. Both give the same error. I am running the 2.2.1-SNAPSHOT.

build.gradle:

    project.ext.roboVMVersion = "2.2.1-SNAPSHOT"
    project.ext.roboVMGradleVersion = "2.2.1-SNAPSHOT"
    project.ext.robopodsVersion = "2.2.1-SNAPSHOT"
joshmmo commented 8 years ago

It turns out GoogleMobileAds.framework/GoogleMobileAds is just a file that links to the actual library. Copying the library and replacing that linking file with the actual library fixes the issue.