I’ve been trying to link PluginAdMob to my game on Android. I installed the plugin manually. The game compiles but when I call a method on the plugin it causes a crash. For example this code causes a crash:
sdkbox::PluginAdMob::init();
I think this has to do with the file AppActivity.java not being set up right. I followed the advice in the manual integration guide as best I could, but there were some problems. For instance, in the sdkbox-admob_v2.6.0.0 folder there is no actual AppActivity.java file. There is just a patch file named AppActivity.java.ccc.3.0.patch. I wasn’t sure what to do with that, so I used the AppActivity.java file I found in sdkbox-sample-iap-master.
The “Manual Integration For Android” guide explains to:
" Replace extends Cocos2dxActivity with extends com.sdkbox.plugin.SDKBoxActivity"
but when I do that for the AppActivity.java file I took from sdkbox-sample-iap-master folder, I end up with a file that looks like this:
package org.cocos2dx.cpp;
import org.cocos2dx.lib.Cocos2dxActivity;
public class AppActivity extends com.sdkbox.plugin.SDKBoxActivity {
}
That doesn’t look right. I also think that it’s the wrong version anyway.
What I need to know is, where do I get the right version of AppActivity.java from? I copied the file to the folder proj.android-studio/app/src/org/cocos2dx/cpp. I think this is right but should there be more files in there? Also, do I need a proj.android-studio/app/src/org/cocos2dx/lib folder with Cocos2dxActivity.java etc as well?
Thanks for reading. I will show the stack of the crash in the next post.
When I do that the code compiles ok, and runs without any errors. Unfortunately the ads do not show up. I’m not sure if this has anything to do with commenting out super.setEnableVirtualButton(false); or not.
The project I have is set up just like your example project here:
Cocos2dxActivity.java is in cocos2dx/platform/android/java/src/org/cocos2dx/lib with the other files, and AppActivity.java is in proj.android-studio/app/src/org/cocos2dx/cpp.
Is it necessary to complete this part of the manual install?
" Manual Integration for Google Play Services SDK (dependent library only) "
This part is confusing me because I can see the file proj.android-studio/app/project.properties in the folders, but when I open Android Studio I can’t see it in any of the drop down lists. So it seems like it is not included in the project. Is copying the gps folder, and modifying project.properties an important step? Maybe this is why things are not working.
Thanks for your help. Where do I find the files for IAP and SDKBoxPlay that are the right version to work with this. What do I need to add to dependencies in the build.gradle file?