Expo apk build runs with no problem , but the apk has no content what so ever.

Please provide the following:

  1. SDK Version: 48
  2. Platforms(Android/iOS/web/all): Andorid
  3. Add the appropriate “Tag” based on what Expo library you have a question on.

ok I will provide my github repository that I am trying to build an app for GitHub - CaptainJow/PlateScannerApp: this is an Android app built with React Native , here the problem is that after following the Build APKs for Android Emulators and devices - Expo Documentation on how to build the apk , I was able to build the app with no problem “errors” but the files uploaded to the eas are only 200KB which is obviously wrong and the the built app is just a splash screen with no content .

Keep in mind that the app runs with no issues on expo go

Hi @captainjow

It doesn’t look like you’re using this. I suspect it was installed by mistake:

If I do this to see what will get uploaded it looks identical to the files in the Git repository, except for the .git directory and anything in .gitignore.

$ eas build:inspect --platform android --output /tmp/archive --profile preview --stage archive

Also, it’s about 852KB

I tried building it myself, and strangely, although the build completed, it looks to me like there’s something wrong with the JavaScript bundle:

> Task :app:createBundleReleaseJsAndAssets
[stderr] /home/expo/workingdir/build/android/app/build/generated/assets/createBundleReleaseJsAndAssets/index.android.bundle:2087:23: warning: the variable "DebuggerInternal" was not declared in function "__shouldPauseOnThrow"
[stderr]         return typeof DebuggerInternal !== 'undefined' && DebuggerInternal.shouldPauseOnThrow === true;
[stderr]                       ^~~~~~~~~~~~~~~~
[stderr] /home/expo/workingdir/build/android/app/build/generated/assets/createBundleReleaseJsAndAssets/index.android.bundle:9114:7: warning: the variable "setTimeout" was not declared in function "logCapturedError"
[stderr]       setTimeout(function () {
[stderr]       ^~~~~~~~~~
[stderr] /home/expo/workingdir/build/android/app/build/generated/assets/createBundleReleaseJsAndAssets/index.android.bundle:7079:108: warning: the variable "nativeFabricUIManager" was not declared in function "onChange"
[stderr]       (fromOrTo = fromOrTo && fromOrTo.stateNode) && fromOrTo.canonical._internalInstanceHandle ? (from && nativeFabricUIManager.setIsJSResponder(from.stateNode.node, false, blockNativeResponder || false), to && nativeFabricUIManager.setIsJSResponder(to.stateNode.node, true, blockNativeResponder || false)) : null !== to ? ReactNativePrivateInterface.UIManager.setJSResponder(to.stateNode.canonical._nativeTag, blockNativeResponder) : ReactNativePrivateInterface.UIManager.clearJSResponder();
[stderr]                                                                                                            ^~~~~~~~~~~~~~~~~~~~~
[stderr] /home/expo/workingdir/build/android/app/build/generated/assets/createBundleReleaseJsAndAssets/index.android.bundle:7695:21: warning: the variable "clearTimeout" was not declared in anonymous function " 257#"
[stderr]     cancelTimeout = clearTimeout;
[stderr]                     ^~~~~~~~~~~~
[...]

What happens if you run it in Expo Go with:

npx expo start --minify --no-dev
1 Like

Hello thanks for the quick reply , I removed the package that I may not need ( “i”: “^0.3.7” ) and then then tried running your command and indeed its 852KB , also for context my eas.js looks like this for now ,

{
  "cli": {
    "version": ">= 3.8.1"
  },
  "build": {
    "development": {
      "developmentClient": true,
      "distribution": "internal"
    },
    "preview": {
      "distribution": "internal"
    },
    "production": {
      "android": {
        "buildType": "apk"
      }
    }
  },
  "submit": {
    "production": {}
  }
}

I tried to build it again and during the process again only 256KB in exact are being uploaded and the the built apk is 31 migabytes but its only the splash screen with no content or even the icon ,
and yes I tried your other command

npx expo start --minify --no-dev

and no problem seems to appear on Expo Go it works perfectly fine I tried it on both my Iphone and android emulator .
I use this command to build the app

npx eas build --profile production --platform android

I am fairly new into expo and react native in general so it could be something obvious but Idk .
may I ask if the apk that you built is working fine ? , you didnt elaborate on that.

Generally you should use preview if you want an APK and leave production as-is, which will produce a .aab file. You want to upload a .aab file to Google Play rather than a .apk, because then the Play store can optimize what it sends to a device when the app is downloaded.

The preview app is build in production mode, so it’s pretty much the same thing, but it builds as an APK to make it easy for you to side load onto a phone or emulator.

Where did you see this?

No, it just shows the splash screen. This normally indicates that there’s some issue with the JavaScript, but you can’t tell just from those symptoms what the problem is.

If I try it in Expo Go with npx expo start --minify --no-dev then I get this:

And if I view the error log I get this:

Although, strangely, if I just reload then it gets to the SignIn/Sign Up screen. I have to kill the app and expo start to get the error to appear again. And if I try without --minify --no-dev then I do not get the error.

I tried generating the bundle locally like this:

$ npx expo export -p android -c .

and it gave me an error about react-native-gesture-handler not being installed:

Starting Metro Bundler
warning: Bundler cache is empty, rebuilding (this may take a minute)
Android Bundling failed 8593ms
Android node_modules/expo/AppEntry.js ▓▓▓▓░░░░░░░░░░░░ 26.2% ( 626/1224)
Error: Unable to resolve module react-native-gesture-handler from /scratch/PlateScannerApp/node_modules/@react-navigation/stack/src/views/GestureHandlerNative.tsx: react-native-gesture-handler could not be found within the project or in these directories:
  node_modules
  3 |   PanGestureHandler as PanGestureHandlerNative,
  4 |   PanGestureHandlerProperties,
> 5 | } from 'react-native-gesture-handler';
    |         ^
  6 |
  7 | import GestureHandlerRefContext from '../utils/GestureHandlerRefContext';
  8 |
Error: Unable to resolve module react-native-gesture-handler from /scratch/PlateScannerApp/node_modules/@react-navigation/stack/src/views/GestureHandlerNative.tsx: react-native-gesture-handler could not be found within the project or in these directories:
  node_modules
  3 |   PanGestureHandler as PanGestureHandlerNative,
  4 |   PanGestureHandlerProperties,
> 5 | } from 'react-native-gesture-handler';
    |         ^
  6 |
  7 | import GestureHandlerRefContext from '../utils/GestureHandlerRefContext';
  8 |
    at ModuleResolver.resolveDependency (/scratch/PlateScannerApp/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:162:15)
    at DependencyGraph.resolveDependency (/scratch/PlateScannerApp/node_modules/metro/src/node-haste/DependencyGraph.js:260:43)
    at Object.resolve (/scratch/PlateScannerApp/node_modules/metro/src/lib/transformHelpers.js:177:21)
    at Graph._resolveDependencies (/scratch/PlateScannerApp/node_modules/metro/src/DeltaBundler/Graph.js:432:35)
    at Graph._processModule (/scratch/PlateScannerApp/node_modules/metro/src/DeltaBundler/Graph.js:218:38)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Graph._addDependency (/scratch/PlateScannerApp/node_modules/metro/src/DeltaBundler/Graph.js:314:20)
    at async Promise.all (index 0)
    at async Graph._processModule (/scratch/PlateScannerApp/node_modules/metro/src/DeltaBundler/Graph.js:263:5)

If I run npx expo install react-native-gesture-handler and build again then I get to the SignIn/Sign Up screen.

I still see the warnings from my previous message in the build log, so not sure why that is.

1 Like

I saw this inside here when I tried building the apk

PS C:\Users\youse\OneDrive\Desktop\React\NewAppNative> npx eas build --profile production --platform android
✔ Using remote Android credentials (Expo server)
✔ Using Keystore from configuration: Build Credentials VRyzzOK5P3 (default)

Compressing project files and uploading to EAS Build. Learn more: https://expo.fyi/eas-build-archive
✔ Uploaded to EAS 3s

Build details: https://expo.dev/accounts/captainjow/projects/PlateDetect/builds/e5b8e36f-8f12-4345-971f-0d525a0d8a7d

Waiting for build to complete. You can press Ctrl+C to exit.
/ Build queued...Terminate batch job (Y/N)? y

and its inside :heavy_check_mark: Uploaded to EAS 3s , its only 256kb and when the build is finished I get the apk of the splash screen .

I tried the same and didnt get any errors for some reason , and expo go works as expected .
this is such a strange problem I couldnt find any reference online to the issue I didnt expect it to be so difficult to just build the apk and I still cant build the apk .

1 Like

I don’t see any mention of the size in that output, but anyway I don’t think that’s relevant.

So you have react-native-gesture-handler in your dependencies in package.json? It’s not in the version on GitHub.

https://github.com/CaptainJow/PlateScannerApp/blob/90773ba29cee516ea702f772ba1627388dac894d/package.json#L30-L35

I agree it should not be so difficult.

thanks you for your time , I was able to solve it finally I tried to rewrite the app on react native cli then installed expo in there manually but it created the same issue all over again so , apparently all I had to do was to delete "react-native-svg": "13.4.0", package from the package.json , I didnt expect that having an extra package could cause such a problem it was impossible to detect.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.