Closed ushmau5 closed 1 year ago
Hi - which libraries in specific did you have to comment out to let the Android debugger screen work?
I have a file that encapsulates all of your ad logic like so;
// react
import React from 'react';
import {Platform, StyleSheet, View} from 'react-native';
// libraries
//@ts-ignore
import AppLovinMAX from 'react-native-applovin-max';
// local
import {colours} from 'src/styles';
AppLovinMAX.initialize('XXXXXX', () => {
// SDK is initialized, start loading ads
});
const BANNER_AD_UNIT_ID = Platform.select({
android: '12345',
ios: '12345',
});
const BannerAd = () => (
<View style={styles.container}>
<AppLovinMAX.AdView adUnitId={BANNER_AD_UNIT_ID} adFormat={AppLovinMAX.AdFormat.BANNER} style={styles.banner} />
</View>
);
const styles = StyleSheet.create({
banner: {
// Set background color for banners to be fully functional
backgroundColor: colours.darkBg,
position: 'relative',
width: '100%',
height: AppLovinMAX.isTablet() ? 90 : 50,
},
container: {
alignItems: 'center',
paddingBottom: 10,
},
});
export default BannerAd;
If I comment out imports for this file in my codebase everything works fine.
The issue is something to do with this library import AppLovinMAX from 'react-native-applovin-max';
The keys and ad id's have been omitted for security purposes.
Thank you for the info - we can investigate this a little, but this is the first time that this particular issue has been raised with us.
same here
This is because the banner is attached before the AppLovinMAX initialization. Please load the banner after the AppLovinMAX initialization.
When entering debug mode via the Android virtual device (command + M -> Debug), if this library is imported and initialised the app will not load. All that is visible is a white screen.
To work around this, I have encapsulated the imports, initialisation and components in a single file which I comment out if I need to use the debugger.
package.json
Metro Console Log:
Chrome Console Log:
Android Studio LogCat Log: