Copy the files JNIHelpers.cpp and JNIHelpers.h from folder External Cocos Helper Android Frameworks/Classes to your project's Classes folder:
Copy the files SonarFrameworks.cpp and SonarFrameworks.h to the Classes folder of your cocos project:
Copy the file SonarFrameworkSettings.xml file from res/values to the res/values of your proj.android:
( Do not overwrite the res folder else you will lose the drawable folders and also the strings.xml )
Then, copy the src folder and overwrite the src folder in proj.android:
And copy the AndroidManifest.xml and replace the same file in proj.android
Open the AndroidManifest.xml file in proj.android and make the following changes.
Change the package name to your packagename.
Edit the Android.mk file in proj.android jni folder:
to add the additional classes as follows:
LOCAL_SRC_FILES := hellocpp/main.cpp \
../../Classes/AppDelegate.cpp \
../../Classes/Bird.cpp \
../../Classes/GameOverScene.cpp \
../../Classes/GameScene.cpp \
../../Classes/MainMenuScene.cpp \
../../Classes/SplashScene.cpp \
../../Classes/Pipe.cpp \
../../Classes/JNIHelpers.cpp \
../../Classes/SonarFrameworks.cpp
The added files are:
../../Classes/JNIHelpers.cpp \
../../Classes/SonarFrameworks.cpp
Then build the proj.android by running build_native.py.
Open Eclipse and import libcocos2dx and your HelloCocos project. Then import google-play-services-lib:
Then, add it as a library:
Then add the google-play-services-lib.jar:
And also make sure to Order and Export it by checking the checkbox:
Then, open the AndroidManifest.xml file and make the following changes.
Enabled the following tags (by uncommenting them ), below is what it should look like:
<!-- Required for Google Play Services
<meta-data
android:name="com.google.android.gms.games.APP_ID"
android:value="@string/google_play_game_app_id" /> -->
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<!-- End here requirement for Google Play Services -->
<!-- Required for AdMob -->
<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent" />
<!-- End here requirement for AdMob -->
Enable only the following permissions and disable the rest:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Then open SonarFrameworkSettings.xml and enter the admob ids:
Copy the AdMob folder from Frameworks folder to folder proj.android/src/sonar/systems/frameworks
Click File, Refresh the Eclipse project to see the new Admob framework:
Open the file SonarFrameworkSettings.java and set Admob to true:
public static final boolean USE_ADMOB = true;
No comments:
Post a Comment