Expo supports running an app not only on Android and on iOS, but also on the Web. The above statement is about running the Web version of your app. It is not referring to running your app on Android and displaying a WebView as part of your app.
This can all get confusing . It seems that Adam misunderstood what you were asking. You cannot somehow use Expo’s expo-admob-ads
module inside of a <WebView>
, but if you’re just displaying a normal web site inside of the <WebView>
then there should be no problem.
But this would be easy to test. Just replace the <WebView>
with <Text>Testing testing 1 2 3</Text>
and build the app to see if it still crashes. I believe it will, since I don’t think the <WebView>
had anything to do with the crash.
The strange thing is that your app is crashing immediately, right? Not after 35 seconds?
Maybe test what happens if you comment out the useInterval(adFunction, 35000);
call and instead use a button to trigger the call to adFunction
. Then it shouldn’t be running any AdMob code until you press the button. But given your current app crashes immediately I suspect this version would also crash immediately.
import { Alert, Button } from 'react-native';
[...]
// useInterval(adFunction, 35000);
return <Button title="Press me" onPress={adFunction} />;
If it crashes only when you press the button it seems like it must have something to do with AdMob.
If it crashes immediately then it might not have anything to do with AdMob.
After the above try commenting out/removing the adFunction
function and the AdMobInterstitial
import completely and replace the call to adFunction
in the button’s onPress
handler with an alert:
return <Button title="Press me" onPress={() => Alert.alert('Button pressed')} />;
Rebuild the app. If it still crashes, uninstall/remove the expo-admob-ads
module, rebuild and try it again.
At this point if it still crashes then the cause can’t be AdMob. So now you should go to the link that Adam posted above where it talks about accessing the native device logs. These logs have a lot of information in them that is unrelated to your app, but if you search for a “fatal exception” you should hopefully find something that gives you a hint about what’s wrong.
The other strategy you could try is this:
Create a new app with expo init
and build it without making any changes and test if it crashes for you. If it does it would be very surprising. If it does not crash, you could compare all of the files in the root of the project with the corresponding files in your real app to see what differences there are. You should probably ignore the yarn.lock
or package-lock.json
file (depending on whether you use yarn or npm) when doing this. Then you could see if you can start making changes to the new app to make it more like your real app. For each change you make, see if it still works in dev mode but crashes after you build it. This should allow you to get to exactly the change that causes the crash.