react-native-admob-native-ads
react-native-admob-native-ads copied to clipboard
Ads repo feature results in invalid template ID error in release mode
I am using the Ad repository feature #216 from the master branch on an Android device (Real device, not emulator). I am able to load ads (real non-test ads) in debug mode perfectly. However, once in release mode, no ads are loaded, and results in the error "[AD] [FAILED]: Invalid template ID: -1"
. Any help from @Ali72 @ammarahm-ed would be greatly appreciated. Please let me know if any additional information is needed. Thanks in advance!
index.js
https://gist.github.com/markchen8717/db20be57ab139c69805c8d3509dc98c4
AdView.js
https://gist.github.com/markchen8717/1172cbfb000c2c5cb617222be8a4d325
Are your Ad IDs new? Did you get them recently from AdMob?
Are your Ad IDs new? Did you get them recently from AdMob?
Hi ammarahm-ed, thanks for the swift reply. My Ad IDs are not new, I've had them for over a year already. Additionally, with the same IDs, the library is working in release mode without the AD repository feature (default on demand ad loading).
@markchen8717 try to use test ad ids in release mode and see if you get any ads then - [ ] or if there is any error thrown? Subscribe to onAdFailedToLoad
prop
@markchen8717 try to use test ad ids in release mode and see if you get any ads then - [ ] or if there is any error thrown? Subscribe to
onAdFailedToLoad
prop
@ammarahm-ed I tried to use test ad ids in release mode and its working without any errors. I am not sure if this means my Ad IDs are the issue here since they work without the Ad repo feature in release mode as well and works with the feature in debug mode too.
Hi @ammarahm-ed, I re-installed my node_modules to get the latest #239 PR. Running the app again with my Ad ids using the Ad repo feature in release now results in the error : "[AD] [FAILED]: Invalid template ID: -1"
. Can you please shed some light on this?
@Ali72 You are using the lib in production. Have you seen any such error? Any idea what might be causing this?
We use this repo in our projects (android and IOS version) without facing this issue but please answer the below questions:@markchen8717
- What's your react-native version?
- Did make a release with disabled minify and proguard option? (if not, disable it and build your project in release state)
Hi @Ali72 , my react-native version is 0.64.2. I am not sure about whether I have disabled minify and proguard option. The following is my build.gradle buildtypes
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
// Caution! In production, you need to generate your own keystore file.
// see https://reactnative.dev/docs/signed-apk-android.
signingConfig signingConfigs.release
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
Please let me know how I can check and make the changes accordingly
@markchen8717 To check if proguard is enabled. See for def enableProguardInReleaseBuilds
line in app/build.gradle
@Ali72 and @ammarahm-ed, it appears that I have def enableProguardInReleaseBuilds = true
. However, even after setting def enableProguardInReleaseBuilds = false
and minifyEnabled false
under buildTypes in `app/build.gradle, I am still getting the error in release mode.
Hi @Ali72 and @ammarahm-ed, I found this stackoverflow post with regards to the error. Do you guys have app-ads.txt setup for your ad mob account?
I seem to be having a very similar issue to this one. @markchen8717 did you ever get this figured out?
Also having this issue with a lot of users
@markchen8717 did you end up finding a solution?