0

So, I'm really new to React Native and Expo, however I'm trying to make an app for a friend, the thing is that when I try to create the APK now that I finished everything, it just doesn't work, it closes immediately when I try to open it.

To create my APK I'm using: eas build -p android --profile preview

This is my App.js:

import React, { useEffect } from 'react';
import { Buffer } from 'buffer';
import * as ScreenOrientation from 'expo-screen-orientation';
import NavigationStack from './src/stack/NavigationStack';
import { NavigationContainer } from '@react-navigation/native';
import { SurveyProvider } from './src/SurveyContext';

if (!global.Buffer) {
  global.Buffer = Buffer;
}

export default function App() {
  useEffect(() => {
    async function setScreenOrientation() {
      await ScreenOrientation.lockAsync(ScreenOrientation.OrientationLock.LANDSCAPE);
    }
    setScreenOrientation();
  }, []);

  return (
    <SurveyProvider>
      <NavigationContainer>
        <NavigationStack />
      </NavigationContainer>
    </SurveyProvider>
  );
}

This is my eas.json:

{
  "cli": {
    "version": ">= 3.13.3"
  },
  "build": {
    "development": {
      "developmentClient": true,
      "distribution": "internal"
    },
    "preview": {
      "distribution": "internal"
    },
    "production": {}
  },
  "submit": {
    "production": {}
  }
}

This is my package.json:

{
  "name": "appName",
  "version": "1.0.0",
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web"
  },
  "dependencies": {
    "@babel/preset-env": "^7.1.6",
    "@babel/runtime": "^7.20.6",
    "@expo/prebuild-config": "^6.2.6",
    "@react-native-picker/picker": "2.4.10",
    "@react-navigation/native": "^6.1.7",
    "@react-navigation/stack": "^6.3.17",
    "@reduxjs/toolkit": "^1.9.5",
    "exceljs": "^4.3.0",
    "expo": "^49.0.6",
    "expo-document-picker": "~11.5.4",
    "expo-file-system": "~15.4.2",
    "expo-image-picker": "~14.3.2",
    "expo-media-library": "~15.4.1",
    "expo-permissions": "~14.2.1",
    "expo-screen-orientation": "~6.0.5",
    "expo-sharing": "~11.5.0",
    "expo-updates": "~0.18.11",
    "nativewind": "^2.0.11",
    "react": "18.2.0",
    "react-native": "0.72.3",
    "react-native-dotenv": "^3.4.9",
    "react-native-gesture-handler": "~2.12.0",
    "react-native-safe-area-context": "4.6.3",
    "react-native-screens": "~3.22.0",
    "react-redux": "^8.1.1",
    "redux-devtools-extension": "^2.13.9",
    "xlsx": "^0.18.5"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "tailwindcss": "3.3.2"
  },
  "private": true
}

I tried asking to chatGPT, but that only made things worse, I really don't know what is happening, I added android permissions too, but apparently that doesn't help.

"android": {
      "permissions": [
        "READ_EXTERNAL_STORAGE",
        "WRITE_EXTERNAL_STORAGE"
      ],

I just want the app to open after installing the APK which I create from EAS, it really works when I use Expo Go, but again, I'm new to this so idk what to do...

Jepeto
  • 1

1 Answers1

0

I found the problem, it was expo-updates, I just uninstalled it, that worked.

Jepeto
  • 1