我使用精灵构建器制作了一个Cocos2d游戏,它使用了AdMob,转换在没有AdMob的情况下正常运行。但在启用AdMob后,我收到了以下错误:
[5/7]链接Build / android-armeabi-debug / Vitamins / apk / lib / armeabi / libApplication.so FAILED:PATH = / Users / aukevalk / .apportable / SDK / toolchain / macosx / binutils / arm-linux-androideabi / bin:$ PATH CCACHE_CPP2 = yes /Users/aukevalk/.apportable/SDK/toolchain/macosx/clang/bin / clang ++ -o /Users/aukevalk/.apportable/SDK/Build/android-armeabi-debug/Vitamins/apk/lib/armeabi/libApplication.so -arch armeabi -target arm-apportable-linux-androideabi -Wl, - build-id --no-undefined -fuse-ld = gold -shared -Wl,@ / Users / aukevalk / .apportable / SDK / lib / linker / bionic.wrap -Wl,@ / Users / aukevalk / .apportable / SDK /lib/linker/opengl.wrap -Wl, - as-needed -framework CoreFoundation -framework Security -framework SystemConfiguration -framework CFNetwork -framework Foundation -framework CoreGraphics -framework ImageIO -framework BridgeKit -framework CoreTelephony -framework GooglePlayServices -framework MPLib - 框架OpenAL -framework OpenGLES -framework QuartzCore -framework CoreMotion -framework CoreText -framework CoreImage -framework UIKit -framework CoreAudio -framework AudioFile -framework AudioUnit -frame工作CoreVideo -framework AudioToolbox -framework CoreMedia -framework MediaToolbox -framework AVFoundation -framework StoreKit -framework MessageUI -framework GLKit -framework AdSupport -Wl, - whole-archive /Users/aukevalk/.apportable/SDK/sysroot/usr/local/ lib / armeabi / libzlib.a /Users/aukevalk/.apportable/SDK/sysroot/usr/local/lib/armeabi/libverde_android.a/Users/aukevalk/.apportable/SDK/Build/android-armeabi-debug/com。 falcko.Vitamins / ObjectiveChipmunk-iPhone / libObjectiveChipmunk-iPhone.a /Users/aukevalk/.apportable/SDK/Build/android-armeabi-debug/com.falcko.Vitamins/cocos2d/libcocos2d.a/Users/aukevalk/.apportable/ SDK / Build / android-armeabi-debug / com.falcko.Vitamins / Vitamins / libVitamins.a -Wl, - no-whole-archive --sysroot = / Users / aukevalk / .apportable / SDK / sysroot -lEGL -lGLESv1_CM -lGLESv2 -llog -ljnigraphics -lEGL -lGLESv1_CM -lGLESv2 -lstdc ++ /Users/aukevalk/.apportable/SDK/sysroot/usr/local/lib/armeabi/libv.so/Users/aukevalk/.apportable/SDK/sysroot/usr /local/lib/armeabi/libcxx.so /我们ers / aukevalk / .apportable / SDK / sysroot / usr / local / lib / armeabi / libSystem.so /Users/aukevalk/.apportable/SDK/sysroot/usr/local/lib/armeabi/libicu.so/Users/aukevalk / .apportable / SDK / sysroot / usr / local / lib / armeabi / libxml2.so /Users/aukevalk/.apportable/SDK/sysroot/usr/local/lib/armeabi/libCommonCrypto.so /Users/aukevalk/.apportable/SDK /sysroot/usr/local/lib/armeabi/libcrypto_1_01h.so /Users/aukevalk/.apportable/SDK/sysroot/usr/local/lib/armeabi/libssl_1_01h.so /Users/aukevalk/.apportable/SDK/sysroot/usr /local/lib/armeabi/libGraphicsServices.so /Users/aukevalk/.apportable/SDK/sysroot/usr/local/lib/armeabi/libgles_apportable.so /Users/aukevalk/.apportable/SDK/sysroot/usr/local/lib /armeabi/libpango.so /Users/aukevalk/Documents/apps/iphone/vitamins/vitamins.spritebuilder/Source/AppDelegate.m:163:错误:未定义引用' kGADAdSizeSmartBannerLandscape' /Users/aukevalk/Documents/apps/iphone/vitamins/vitamins.spritebuilder/Source/AppDelegate.m:163:错误:未定义引用' kGADAdSizeSmartBannerPortrait' /Users/aukevalk/.apportable/SDK/Build/android-armeabi-debug/com.falcko.Vitamins/Vitamins/libVitamins.a(AppDelegate.mo):/Users/aukevalk/Documents/apps/iphone/vitamins/vitamins。 spritebuilder / Source / AppDelegate.m:function L_OBJC_CLASSLIST_REFERENCES _ $ _ 32:error:undefined reference to' OBJC_CLASS _ $ _ GADBannerView' /Users/aukevalk/.apportable/SDK/Build/android-armeabi-debug/com.falcko.Vitamins/Vitamins/libVitamins.a(AppDelegate.mo):/Users/aukevalk/Documents/apps/iphone/vitamins/vitamins。 spritebuilder / Source / AppDelegate.m:function L_OBJC_CLASSLIST_REFERENCES _ $ _ 49:error:undefined reference to' OBJC_CLASS _ $ _ GADRequest' clang:错误:链接器命令失败,退出代码为1(使用-v查看调用) 忍者:构建停止:子命令失败。 错误:命令失败:/Users/aukevalk/.apportable/SDK/toolchain/macosx/ninja/ninja --no-strip-ansi-escapes -j 16 /Users/aukevalk/.apportable/SDK/Build/android-armeabi-调试/维生素/维生素-debug.apk
这是我的createAdmob函数:
-(void)createAdmobAds
{
if (!mBannerView) {
mBannerType = BANNER_TYPE;
if(mBannerType <= kBanner_Portrait_Bottom)
mBannerView = [[GADBannerView alloc] initWithAdSize:kGADAdSizeSmartBannerPortrait];
else
mBannerView = [[GADBannerView alloc] initWithAdSize:kGADAdSizeSmartBannerLandscape];
// Specify the ad's "unit identifier." This is your AdMob Publisher ID.
mBannerView.adUnitID = @"id_goes_here";
// Let the runtime know which UIViewController to restore after taking
// the user wherever the ad goes and add it to the view hierarchy.
mBannerView.rootViewController = self.navController;
[self.navController.view addSubview:mBannerView];
//#ifdef DEBUG
// GADRequest *request = [GADRequest request];
// request.testDevices = [NSArray arrayWithObjects:GAD_SIMULATOR_ID, nil];
//#endif
// Initiate a generic request to load it with an ad.
[mBannerView loadRequest:[GADRequest request]];
CGSize s = [[CCDirector sharedDirector] viewSize];
CGRect frame = mBannerView.frame;
off_x = 0.0f;
on_x = 0.0f;
switch (mBannerType)
{
case kBanner_Portrait_Top:
{
off_y = -frame.size.height;
on_y = 0.0f;
}
break;
case kBanner_Portrait_Bottom:
{
off_y = s.height;
on_y = s.height-frame.size.height;
}
break;
case kBanner_Landscape_Top:
{
off_y = -frame.size.height;
on_y = 0.0f;
}
break;
case kBanner_Landscape_Bottom:
{
off_y = s.height;
on_y = s.height-frame.size.height;
}
break;
default:
break;
}
frame.origin.y = off_y;
frame.origin.x = off_x;
mBannerView.frame = frame;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
frame = mBannerView.frame;
frame.origin.x = on_x;
frame.origin.y = on_y;
mBannerView.frame = frame;
[UIView commitAnimations];
}
}
我希望你们有一个关于如何解决这个问题的小费。 提前谢谢!
Falcko