eas build fails on Android with prebuild

eas-cli/3.14.0 darwin-arm64 node-v16.19.1

I have a build system where I run expo prebuild -p android --no-install --clean then manually change AndroidManifest.xml, and run eas build -p android with "buildType" : "apk" so I can use the binary to sideload on Android.

But the build fails with:


[stderr] 

Note: /home/expo/workingdir/build/node_modules/@react-native-async-storage/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStorageModule.java uses or overrides a deprecated API.

[stderr] 

Note: Recompile with -Xlint:deprecation for details.

[stderr] 

Note: /home/expo/workingdir/build/node_modules/@react-native-async-storage/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStoragePackage.java uses unchecked or unsafe operations.

[stderr] 

Note: Recompile with -Xlint:unchecked for details.
[stderr] 

Note: /home/expo/workingdir/build/node_modules/react-native-svg/android/src/main/java/com/horcrux/svg/VirtualView.java uses or overrides a deprecated API.

[stderr] 

Note: Recompile with -Xlint:deprecation for details.

[stderr] 

Note: Some input files use unchecked or unsafe operations.

[stderr] 

Note: Recompile with -Xlint:unchecked for details.

npx expo-doctor says all is well.

Any ideas what is up? How could async-storage be depreciated?

I’m on SDK 48, this is still supported correct?

I have “@react-native-async-storage/async-storage”: “1.17.11”
That lib is at 1.19.3 now, but expo install gives me 1.17.11

hi there.

stderr doesn’t necessarily mean it’s an error. those are warnings.

Hi @marchingband

If you want to run prebuild, you should use npx expo prebuild .... i.e. you should be using the locally installed expo cli instead of a globally installed expo-cli.

Also, with the default eas.json, a preview build is like a production build, except that the buildType is apk, so you can just do this:

eas build -p android --profile preview

No need to change the production profile to buildType apk.

If the only thing you’re modifying in the android native project is AndroidManifest.xml, then you could write a Config Plugin to make that change automatically for you, instead of making the change manually. Then it would automatically apply the change during prebuild, which means you can have a fully managed Expo app, without any android or ios directories. (If you do not have an android or ios directory, the build servers automatically run prebuild for you during the build process.)

This does not mean that AsyncStorage is deprecated. It just means that it’s calling a deprecated API. This is pretty common in Java code and not something to be worried about. It’s for the AsyncStorage maintainers to worry about.

Yes

That’s normal. That’s because Expo SDK 48 is tested against a particular version of AsyncStorage, so they specify that version to make sure it works. Normally when they release a new SDK version they update to later versions of their dependencies.

So basically, if your build is failing it’s not because of the above warnings and version of AsyncStorage.

In the build log you’ll probably see something about one of the gradle tasks failing. Search for FAILED. e.g. see the screenshot here:

Thanks @wodin
I see FAILED

> Task :app:compileReleaseJavaWithJavac FAILED

[stderr] 

/home/expo/workingdir/build/android/app/src/main/java/com/marchingband/overkillsolar/MainActivity.java:19: error: package R does not exist

[stderr] 

    setTheme(R.style.AppTheme);

[stderr] 

              ^

[stderr] 

/home/expo/workingdir/build/android/app/src/main/java/com/marchingband/overkillsolar/MainActivity.java:39: error: cannot find symbol

[stderr] 

    return new ReactActivityDelegateWrapper(this, BuildConfig.IS_NEW_ARCHITECTURE_ENABLED, new DefaultReactActivityDelegate(

[stderr] 

                                                  ^

[stderr] 

  symbol:   variable BuildConfig

[stderr] 

  location: class MainActivity

[stderr] 

/home/expo/workingdir/build/android/app/src/main/java/com/marchingband/overkillsolar/MainApplication.java:26: error: cannot find symbol

[stderr] 

        return BuildConfig.DEBUG;

[stderr] 

               ^

[stderr] 

  symbol: variable BuildConfig

[stderr] 

/home/expo/workingdir/build/android/app/src/main/java/com/marchingband/overkillsolar/MainApplication.java:45: error: cannot find symbol

[stderr] 

        return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;

[stderr] 

               ^

[stderr] 

  symbol: variable BuildConfig

[stderr] 

/home/expo/workingdir/build/android/app/src/main/java/com/marchingband/overkillsolar/MainApplication.java:50: error: cannot find symbol

[stderr] 

        return BuildConfig.IS_HERMES_ENABLED;

[stderr] 

               ^

[stderr] 

  symbol: variable BuildConfig

[stderr] 

/home/expo/workingdir/build/android/app/src/main/java/com/marchingband/overkillsolar/MainApplication.java:63: error: cannot find symbol

[stderr] 

    if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {

[stderr] 

        ^

[stderr] 

  symbol:   variable BuildConfig

[stderr] 

  location: class MainApplication

[stderr] 

/home/expo/workingdir/build/android/app/src/main/java/com/marchingband/overkillsolar/MainApplication.java:63: error: illegal parenthesized expression

[stderr] 

    if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {

[stderr] 

       ^

[stderr] 

/home/expo/workingdir/build/android/app/src/main/java/com/marchingband/overkillsolar/MainApplication.java:67: error: cannot find symbol

[stderr] 

    ReactNativeFlipper.initializeFlipper(this, getReactNativeHost().getReactInstanceManager());

[stderr] 

    ^

[stderr] 

  symbol:   variable ReactNativeFlipper

[stderr] 

  location: class MainApplication

[stderr] 

8 errors

w

@wodin
I will try with npx expo prebuild … the decision to use one or the other is not clear to me still.
Appreciate your help very much, as always,

1 Like

@wodin the reason that preview solution doesn’t work for me is that I am still using expo publish --release-channel preview and I don’t want that to all get mixed up.

OK. Can you see what happens if you delete your android and ios directories before building? I know you need to make changes to AndroidManifest.xml, but for now, does it build if you leave that out?

Also, what is the change you need to make to AndroidManifest.xml?

These days you should always use npx expo ... instead of expo .... You can also uninstall expo-cli globally (and you should not have it installed as one of your dependencies).

Instead of using expo upgrade or expo-cli upgrade, these days you should install the correct version of the expo package in your app and then use npx expo install --fix to upgrade the other packages from the Expo SDK.

Instead of using expo doctor or expo-cli doctor, these days you should use npx expo-doctor.

Off hand I can’t remember what the old command for doing the following was, but these days, to get some info about the project you should run npx expo-env-info.

And for creating a new Expo app you can use:

npm create-expo-app

or:

yarn create expo-app

I see. Bear in mind that classic updates are coming to an end soon (2024-02-12):

Yes I know time is running low :sob:

‘npx expo prebuild’ worked thanks so much.

1 Like

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