Unfortunately moPubView is not created. I think this is because Cocos2dx 2.1 doesn’t use XML for layout anymore(?) So the app crashes on launch due to a null pointer exception.
I tried passing R.layout.main to setContentView before attempting to create the ad view. This does successfully create the ad view however the rest of the app isn’t visible.
Anyone have advice on how to solve this in Cocos2dx 2.1?
One thought I have is creating the view programmatically instead of using XML. However after some research it looks like I still need to call setContentView. I’m worried I’ll run into the same problem as above hence I thought I’d ask here.
So I dug into the problem a bit more. One strange behavior I’m seeing: running my game in the Android emulator immediately after following step one of Mopub’s integration instructions “Import the MoPub archive file into your Eclipse workspace” causes the app to just be blank. Note before this import the app appears correctly. Any idea why this is happening?
I’m guessing it’s related to Cocos2dx configuring “views” in a way that Mopub doesn’t expect. I’m more familiar with iOS development so a lot of the Android stuff is still foreign to me.
Just an update: the app was “appearing blank” because some network requests were failing. Adding the appropriate permissions to the manifest in the MoPubSDK fixed this. Apparently having the permissions in my project’s manifest was not sufficient.
Just an update: the app was “appearing blank” because some network requests were failing. Adding the appropriate permissions to the manifest in the MoPubSDK fixed this. Apparently having the permissions in my project’s manifest was not sufficient.
Hi JP,
I’m trying to use Mopub with cocos2d-x 2.1+ too , but I meet the problem. Can you share about how to make the view without xml ?