I'm having some troubles with an Android application. It's using React Native (version 0.72.5) and I use Android Studio to emulate it. At some point, I made some implementations 'native-base' and '@react-navigation/native' on it (in both cases, I followed the documentation), and it works perfectly on the emulator. Now, I'm trying to generate the release .apk.
I followed all the steps here and it was generated.
Then, I tried running it at my cellphone, but it's not working... nor giving me any logs to see what error is happening... and now I have no idea what to do about it.
This is the configuration I'm using, that works fine on the emulator:
My App.jsx file:
export default class App extends React.Component {
render() {
return (
<NavigationContainer>
<Stack.Navigator
initialRouteName="Login"
screenOptions={{ headerShown: false }}
>
<Stack.Screen
component={Login}
name="Login"
options={{headerShown: false, animationEnabled: false}}
/>
<Stack.Screen
component={BottomTabNavigator}
name="Tabs"
screenOptions={{ headerShown: false }}
/>
<Stack.Screen
component={Finish}
name="Finish"
options={{headerShown: false, animationEnabled: false}}
/>
</Stack.Navigator>
</NavigationContainer>
);
}
}
My BottomTabNavigator.jsx file:
class BottomTabNavigator extends Component {
constructor(props) {
super(props);
this.state = {
badgeData: 0,
};
}
componentDidMount() {
this.getCountCompleted();
this.updateInterval = setInterval(() => {
this.getCountCompleted();
}, 4000);
}
componentWillUnmount() {
if (this.updateInterval) {
clearInterval(this.updateInterval);
}
}
getCountCompletedEscalas = async () => {
try {
const realm = await getRealm();
const data = realm.objects('scale').filtered('complete = ' + 1);
const count = data.length;
this.setState({ badgeData: count });
storeData('@badgeData', count);
} catch (err) {
console.error(err);
}
};
render() {
return (
<Tab.Navigator
initialRouteName="HomeTab"
screenOptions={{
headerShown: false,
tabBarStyle: { backgroundColor: '#E5E5E5', height: screenHeight * 0.09},
}}
tabBarOptions={{
activeTintColor: "#39B44A",
inactiveTintColor: "#C3CDDE",
}}
>
<Tab.Screen
component={Download}
name="DownloadTab"
options={{
tabBarLabel: "",
}}
/>
<Tab.Screen
component={Local}
name="LocalTab"
options={{
tabBarLabel: "",
}}
/>
<Tab.Screen
component={Home}
name="HomeTab"
options={{
tabBarLabel: "",
}}
/>
<Tab.Screen
component={Upload}
name="UploadTab"
options={{
tabBarBadge: this.state.badgeData > 0 ? this.state.badgeData : null,
tabBarLabel: "",
),
}}
/>
<Tab.Screen
component={Help}
name="HelpTab"
options={{
tabBarLabel: "",
}}
/>
<Tab.Screen
component={Areas}
name="AreaTab"
options={{
tabBarButton: () => null,
tabBarVisible: false
}}
/>
<Tab.Screen
component={Inspect}
name="InspectTab"
options={{
tabBarButton: () => null,
tabBarVisible: false
}}
/>
</Tab.Navigator>
);
}
}
export default BottomTabNavigator;