Hey,
im trying to add admob to my game.
I did everything from this site:
https://github.com/defold/extension-admob/blob/master/admob/README.md
Now i get one error after another if i bundle and i dont know what to do. Can you guys pls help me?
Error Message:
“D:\Eigene Dateien\Defold\DontGetCrushed\admob\AndroidManifest.xml (Das System kann den angegebenen Pfad nicht finden)” (The system cant find the given path)
I understand it cant find it, because it does not exist. But i can see the file in my editor.
game.project
[project]
title = DontGetCrushed
version = 0.1
dependencies = https://github.com/defold/extension-admob/archive/v1.0.zip
bundle_resources = /res
[bootstrap]
main_collection = /main/main.collection
[input]
game_binding = /input/game.input_bindingc
[display]
width = 720
height = 1280
[physics]
scale = 0.02
[script]
shared_state = 1
[tracking]
app_id = E3E15404C88C69AC
[html5]
splash_image = /splash_img.png
[android]
package = com.justiudios.dontgetcurshed
immersive_mode = 0
manifest = /admob/AndroidManifest.xml
[ios]
bundle_identifier = com.justiudios.dontgetcurshed
[admob]
app_id_ios = ca-app-pub-1231231231231231~1111111111
app_id_android = ca-app-pub-1231231231231231~2222222222
[native_extension]
app_manifest = /game.appmanifest
britzl
October 7, 2017, 7:05am
2
The instructions mention that you should change your own AndroidManifest accordingly . Make a copy if the manifest file from the extension and store it in your own project.
1 Like
I did this yesterday but got a error too.
C:\Users\Tobi\Desktop\Defold\Bundle\armv7-android\DontGetCrushed\AndroidManifest.xml:118:error:Error:No resource found that matches the given name (at ‘theme’ with value ‘@style /Theme.IAPTheme’
AndroidManifest i used to build
<?xml version="1.0" encoding="utf-8"?>
<!-- BEGIN_INCLUDE(manifest) -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.justiudios.dontgetcurshed"
android:versionCode="1"
android:versionName="0.1"
android:installLocation="auto">
<uses-feature android:required="true" android:glEsVersion="0x00020000" />
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="23" />
<application
{{#has-icons?}}
android:icon="@drawable/icon"
{{/has-icons?}}
android:label="DontGetCrushed" android:hasCode="true" android:debuggable="false">
<!-- For Local Notifications -->
<receiver android:name="com.defold.push.LocalNotificationReceiver" >
</receiver>
<!-- For GCM (push) -->
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<!-- For Facebook -->
<meta-data android:name="com.facebook.sdk.ApplicationName"
android:value="DontGetCrushed" />
<activity android:name="com.dynamo.android.DefoldActivity"
android:label="DontGetCrushed"
android:configChanges="orientation|screenSize|keyboardHidden"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:screenOrientation="portrait"
android:launchMode="singleTask">
<meta-data android:name="android.app.lib_name"
android:value="DontGetCrushed" />
{{#android.push_field_title}}
<meta-data
android:name="com.defold.push.field_title"
android:value="android.intent.category.LAUNCHER" />
{{/android.push_field_title}}
{{#android.push_field_text}}
<meta-data
android:name="com.defold.push.field_text"
android:value="{{android.push_field_text}}" />
{{/android.push_field_text}}
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.dynamo.android.DispatcherActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<activity android:name="com.facebook.FacebookActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="DontGetCrushed" />
<activity android:name="com.defold.iap.IapGooglePlayActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="IAP">
</activity>
<!-- For Local Notifications -->
<activity android:name="com.defold.push.LocalPushDispatchActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:launchMode="singleTask"
android:configChanges="keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="com.defold.push.FORWARD" />
<category android:name="com.defold.push" />
</intent-filter>
</activity>
<!-- For GCM (push) -->
<activity android:name="com.defold.push.PushDispatchActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar">
<intent-filter>
<action android:name="com.defold.push.FORWARD" />
<category android:name="com.defold.push" />
</intent-filter>
</activity>
<receiver
android:name="com.defold.push.GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.defold.push.FORWARD" />
<category android:name="com.defold.push" />
</intent-filter>
</receiver>
<!-- For IAC Invocations -->
<activity android:name="com.defold.iac.IACActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:launchMode="singleTask"
android:configChanges="keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="com.justiudios.dontgetcurshed" />
</intent-filter>
</activity>
<service android:name="com.defold.adtruth.InstallReceiver"/>
<receiver
android:name="com.defold.adtruth.InstallReceiver"
android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
<!-- For Amazon IAP -->
<receiver android:name="com.amazon.device.iap.ResponseReceiver" >
<intent-filter>
<action android:name="com.amazon.inapp.purchasing.NOTIFY" android:permission="com.amazon.inapp.purchasing.Permission.NOTIFY" />
</intent-filter>
</receiver>
<!-- ********************* firebase ********************* -->
<!-- Include the AdActivity and InAppPurchaseActivity configChanges and themes. -->
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent" />
<activity
android:name="com.google.android.gms.ads.purchase.InAppPurchaseActivity"
android:theme="@style/Theme.IAPTheme" />
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<activity
android:name="com.google.android.gms.common.api.GoogleApiActivity"
android:exported="false"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<receiver
android:name="com.google.android.gms.measurement.AppMeasurementReceiver"
android:enabled="true"
android:exported="false" >
</receiver>
<receiver
android:name="com.google.android.gms.measurement.AppMeasurementInstallReferrerReceiver"
android:enabled="true"
android:permission="android.permission.INSTALL_PACKAGES" >
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
<service
android:name="com.google.android.gms.measurement.AppMeasurementService"
android:enabled="true"
android:exported="false" />
<provider
android:name="com.google.firebase.provider.FirebaseInitProvider"
android:authorities="com.defold.adtest.firebaseinitprovider"
android:exported="false"
android:initOrder="100" />
<receiver
android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver"
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.defold.adtest" />
</intent-filter>
</receiver>
<!-- Internal (not exported) receiver used by the app to start its own exported services without risk of being spoofed.
-->
<receiver
android:name="com.google.firebase.iid.FirebaseInstanceIdInternalReceiver"
android:exported="false" />
<!-- FirebaseInstanceIdService performs security checks at runtime, no need for explicit permissions despite exported="true"
-->
<service
android:name="com.google.firebase.iid.FirebaseInstanceIdService"
android:exported="true" >
<intent-filter android:priority="-500" >
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
<!-- ********************* firebase ********************* -->
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.android.vending.BILLING" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- For GCM (push) -->
<!-- NOTE: Package name from actual app here! -->
<permission android:name="{{android.package}}.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<!-- NOTE: Package name from actual app here! -->
<uses-permission android:name="{{android.package}}.permission.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
</manifest>
<!-- END_INCLUDE(manifest) -->
AndroidManifest in the output folder when bundling
<?xml version="1.0" encoding="utf-8"?>
<!-- BEGIN_INCLUDE(manifest) -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.justiudios.dontgetcurshed"
android:versionCode="1"
android:versionName="0.1"
android:installLocation="auto">
<uses-feature android:required="true" android:glEsVersion="0x00020000" />
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="23" />
<application
android:label="DontGetCrushed" android:hasCode="true" android:debuggable="false">
<!-- For Local Notifications -->
<receiver android:name="com.defold.push.LocalNotificationReceiver" >
</receiver>
<!-- For GCM (push) -->
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<!-- For Facebook -->
<meta-data android:name="com.facebook.sdk.ApplicationName"
android:value="DontGetCrushed" />
<activity android:name="com.dynamo.android.DefoldActivity"
android:label="DontGetCrushed"
android:configChanges="orientation|screenSize|keyboardHidden"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:screenOrientation="portrait"
android:launchMode="singleTask">
<meta-data android:name="android.app.lib_name"
android:value="DontGetCrushed" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.dynamo.android.DispatcherActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<activity android:name="com.facebook.FacebookActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="DontGetCrushed" />
<activity android:name="com.defold.iap.IapGooglePlayActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="IAP">
</activity>
<!-- For Local Notifications -->
<activity android:name="com.defold.push.LocalPushDispatchActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:launchMode="singleTask"
android:configChanges="keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="com.defold.push.FORWARD" />
<category android:name="com.defold.push" />
</intent-filter>
</activity>
<!-- For GCM (push) -->
<activity android:name="com.defold.push.PushDispatchActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar">
<intent-filter>
<action android:name="com.defold.push.FORWARD" />
<category android:name="com.defold.push" />
</intent-filter>
</activity>
<receiver
android:name="com.defold.push.GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.defold.push.FORWARD" />
<category android:name="com.defold.push" />
</intent-filter>
</receiver>
<!-- For IAC Invocations -->
<activity android:name="com.defold.iac.IACActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:launchMode="singleTask"
android:configChanges="keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="com.justiudios.dontgetcurshed" />
</intent-filter>
</activity>
<service android:name="com.defold.adtruth.InstallReceiver"/>
<receiver
android:name="com.defold.adtruth.InstallReceiver"
android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
<!-- For Amazon IAP -->
<receiver android:name="com.amazon.device.iap.ResponseReceiver" >
<intent-filter>
<action android:name="com.amazon.inapp.purchasing.NOTIFY" android:permission="com.amazon.inapp.purchasing.Permission.NOTIFY" />
</intent-filter>
</receiver>
<!-- ********************* firebase ********************* -->
<!-- Include the AdActivity and InAppPurchaseActivity configChanges and themes. -->
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent" />
<activity
android:name="com.google.android.gms.ads.purchase.InAppPurchaseActivity"
android:theme="@style/Theme.IAPTheme" />
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<activity
android:name="com.google.android.gms.common.api.GoogleApiActivity"
android:exported="false"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<receiver
android:name="com.google.android.gms.measurement.AppMeasurementReceiver"
android:enabled="true"
android:exported="false" >
</receiver>
<receiver
android:name="com.google.android.gms.measurement.AppMeasurementInstallReferrerReceiver"
android:enabled="true"
android:permission="android.permission.INSTALL_PACKAGES" >
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
<service
android:name="com.google.android.gms.measurement.AppMeasurementService"
android:enabled="true"
android:exported="false" />
<provider
android:name="com.google.firebase.provider.FirebaseInitProvider"
android:authorities="com.defold.adtest.firebaseinitprovider"
android:exported="false"
android:initOrder="100" />
<receiver
android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver"
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.defold.adtest" />
</intent-filter>
</receiver>
<!-- Internal (not exported) receiver used by the app to start its own exported services without risk of being spoofed.
-->
<receiver
android:name="com.google.firebase.iid.FirebaseInstanceIdInternalReceiver"
android:exported="false" />
<!-- FirebaseInstanceIdService performs security checks at runtime, no need for explicit permissions despite exported="true"
-->
<service
android:name="com.google.firebase.iid.FirebaseInstanceIdService"
android:exported="true" >
<intent-filter android:priority="-500" >
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
<!-- ********************* firebase ********************* -->
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.android.vending.BILLING" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- For GCM (push) -->
<!-- NOTE: Package name from actual app here! -->
<permission android:name="com.justiudios.dontgetcurshed.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<!-- NOTE: Package name from actual app here! -->
<uses-permission android:name="com.justiudios.dontgetcurshed.permission.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
</manifest>
<!-- END_INCLUDE(manifest) -->
I guess the error points at this lines:
<activity
android:name="com.google.android.gms.ads.purchase.InAppPurchaseActivity"
android:theme="@style/Theme.IAPTheme" />
britzl
October 7, 2017, 10:18am
4
Did you also add the additional bundle resources to game.project as per the instructions in the readme ?
Yes, i put google-services.json into /res/android and GoogleService-Info.plist into /res/ios
britzl
October 7, 2017, 11:56am
6
You also need to open game.project as a text file and find the [project] section and add bundle_resources = /res
. This should obviously be exposed in game.project and I’ve created a ticket for this .
I added this line already as you can see in my first post. Something else i can try?
Im still trying to fix it.
Maybe the error is in here? Should i fill something inside the {} ?
<meta-data
android:name="com.defold.push.field_title"
android:value="android.intent.category.LAUNCHER" />
{{/android.push_field_title}}
{{#android.push_field_text}}
<meta-data
android:name="com.defold.push.field_text"
android:value="{{android.push_field_text}}" />
{{/android.push_field_text}}
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
Also i found this:
https://groups.google.com/forum/#!topic/google-admob-ads-sdk/AL0QJ4Kgxek
I deinstalled andoidstudio and android sdk. Then i installed it again and installed "Android SDK Build-Tools, Android SDK Platform-Tools, Android SDK Tools and Google Play services with help of the Android SDK Manager inside Android studio.
Unfortunately it didnt help
Thats really frustrating…
britzl
October 7, 2017, 3:32pm
9
LosJustos:
I deinstalled andoidstudio and android sdk. Then i installed it again and installed "Android SDK Build-Tools, Android SDK Platform-Tools, Android SDK Tools and Google Play services with help of the Android SDK Manager inside Android studio.
This doesn’t matter at all. Defold does not interface with any external SDKs or tools. The entire build process is internal to Defold. Perhaps @AGulev or someone else who has experience with the Admob extension can help?
1 Like
AGulev
October 7, 2017, 3:49pm
10
We use AdMob via FGL Enhance
I tried to make build with admob extension, but it was unstable (I think, it’s because version of admob sdk is not latest version and DISCLAIMER: This is an example
)
@LosJustos you can try FGL Enhance - it’s easy. If you principal want to use AdMob extension, at first try to build an example https://github.com/defold/extension-admob
1 Like
The example didnt work for me.
I tryed out Enhance and was rly skeptical. But wow, it works. I got a testbanner inside my App.
Now i have to check how i can manage the rewarded ads.
Thank you both for your help.
3 Likes
One question:
I want to add the certificate. I guess i use the certificate.pem, but wich key? I have the key.pem and key.pk8 files, but i cant upload a file. If i copy the Key from key.pem i get a error message from Enhance.
I signed it with defold already, do i need to sign it with enhance again?
AGulev
October 7, 2017, 4:27pm
13
I am sign apk for test on FGL site, and then using next commands in terminal (just replace path and file names to yours):
/Applications/android-sdk-macosx/build-tools/25.0.2/zipalign -f -v 4 /Users/alexeygulev/Downloads/andr/Bring+me+Cakes-enhanced.apk /Users/alexeygulev/Downloads/andr/aligment.apk
/Applications/android-sdk-macosx/build-tools/25.0.2/apksigner sign --key key.pk8 --cert certificate.pem /Users/alexeygulev/Downloads/andr/aligment.apk
2 Likes
I am getting “Unable to open ‘/APK/DontGetCrushed-enhanced.apk’ as zip archive” from my cmd If i execute the first command. The second seems to work, but gives no feedback. Is there a way to test if it is certificated?
Thank you
1 Like
AGulev
October 7, 2017, 4:42pm
15
Check this thread
I don’t know. This command have no any output. My mac “thinks” few seconds and that’s all.
1 Like
hey @LosJustos did you end up using FGL Enhance instead or continue with admob?
and was/is your dev machine on MS windows?
thanks
Hey,
yes i am using FGL Enhance and my machine is Windows.
But i can just bundle if i use the Lib. Building fails. I have to delete the extension to test my APP in editor.
1 Like