google-services.json not found error

I built an app but when I try to build it using expo build:android -t apk it gives me an error,

Could not find google-services.json while looking in [src/nullnull/debug, src/debug/nullnull, src/nullnull, src/debug, src/nullnullDebug]
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
Could not find google-services.json while looking in [src/nullnull/release, src/release/nullnull, src/nullnull, src/release, src/nullnullRelease]

Even though I dont have any google services.
Here is the diagnostic logs:

Expo CLI 3.21.13 environment info:
System:
OS: Linux 5.3 KDE neon 5.19
Shell: 4.4.20 - /bin/bash
Binaries:
Node: 12.16.2 - /usr/bin/node
npm: 6.14.5 - /usr/bin/npm
npmPackages:
expo: ~38.0.8 => 38.0.8
react: ~16.11.0 => 16.11.0
react-dom: ~16.11.0 => 16.11.0
react-native:ā€œā€ => 0.62.2
react-native-web: ~0.11.7 => 0.11.7
npmGlobalPackages:
expo-cli: 3.21.13

Here is the error itself:

` ```
unimodules-task-manager-interface@5.2.1 from /app/turtle/workingdir/android/sdk38/android-shell-app/enabled-modules/unimodules-task-manager-interface


Could not find google-services.json while looking in [src/nullnull/debug, src/debug/nullnull, src/nullnull, src/debug, src/nullnullDebug]


registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)


Could not find google-services.json while looking in [src/nullnull/release, src/release/nullnull, src/nullnull, src/release, src/nullnullRelease]


registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)


Task :app:preBuild UP-TO-DATE


Task :app:extractProguardFiles


Task :app:preReleaseBuild


Task :app:compileReleaseAidl NO-SOURCE


Task :app:checkReleaseManifest


Task :app:compileReleaseRenderscript NO-SOURCE


Task :app:generateReleaseBuildConfig


Task :app:javaPreCompileRelease


Task :app:mainApkListPersistenceRelease


Task :app:generateReleaseResValues


Task :app:generateReleaseResources


Task :app:processReleaseGoogleServices


Parsing json file: /app/turtle/workingdir/android/sdk38/android-shell-app/app/google-services.json


Task :app:createReleaseCompatibleScreenManifests


Task :app:processReleaseManifest


/app/turtle/workingdir/android/sdk38/android-shell-app/app/src/main/AndroidManifest.xml:18:9-27:20 Warning:


provider#expo.modules.filesystem.FileSystemFileProvider@android:authorities was tagged at AndroidManifest.xml:18 to replace other declarations but no other declaration present

Task :app:mergeReleaseResources FAILED


[stderr]

FAILURE: Build failed with an exception.


[stderr]

  • What went wrong:

[stderr]

Execution failed for task ā€˜:app:mergeReleaseResourcesā€™.


[stderr]

A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade


[stderr]

Android resource compilation failed


[stderr]

 /app/turtle/workingdir/android/sdk38/android-shell-app/app/src/main/res/values/colors.xml:12:3-48: AAPT: error: invalid color.

[stderr]


[stderr]

 /app/turtle/workingdir/android/sdk38/android-shell-app/app/build/intermediates/incremental/mergeReleaseResources/merged.dir/values/values.xml: AAPT: error: file failed to compile.

[stderr]


[stderr]

  • Try:

[stderr]

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.


[stderr]


[stderr]

BUILD FAILED in 57s


Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.


Use ā€˜ā€“warning-mode allā€™ to show the individual deprecation warnings.


See Command-Line Interface


10 actionable tasks: 10 executed


Error: ./gradlew exited with non-zero code: 1
at ChildProcess.completionListener (/app/turtle/node_modules/@expo/xdl/node_modules/@expo/spawn-async/build/spawnAsync.js:52:23)
at Object.onceWrapper (events.js:418:26)
at ChildProcess.emit (events.js:311:20)
at ChildProcess.EventEmitter.emit (domain.js:482:12)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
ā€¦
at spawnAsync (/app/turtle/node_modules/@expo/xdl/node_modules/@expo/spawn-async/build/spawnAsync.js:17:21)
at spawnAsyncThrowError (/app/turtle/node_modules/@expo/xdl/build/detach/ExponentTools.js:190:45)
at buildShellAppAsync (/app/turtle/node_modules/@expo/xdl/build/detach/AndroidShellApp.js:891:11)
at async Object.createAndroidShellAppAsync (/app/turtle/node_modules/@expo/xdl/build/detach/AndroidShellApp.js:385:5)
at async runShellAppBuilder (/app/turtle/build/builders/android.js:83:9)
at async Object.buildAndroid [as android] (/app/turtle/build/builders/android.js:31:28)
at async build (/app/turtle/build/jobManager.js:158:24)
at async processJob (/app/turtle/build/jobManager.js:103:32)
at async Object.doJob (/app/turtle/build/jobManager.js:35:5)
at async main (/app/turtle/build/server.js:44:13)


`

Hey @rajsharmaof,

Were you able to get a binary built yet? If not, can you let me know what SDK version your project is running.

Cheers,
Adam

@adamjnav This problem started showing up for me as well in the past few hours.

Could not find google-services.json while looking in [src/nullnull/debug, src/debug/nullnull, src/nullnull, src/debug, src/nullnullDebug]

SDK 38, I have already build ~14 apps using SDK 38, without issue. This is an issue in the build service.

Hmmm. I just built two apks without issue. Can you see if you can replicate this with a freshly created project?

@adamjnav This was a freshly created project (but wĆ­th the google-services.json file linked in app.json). Would you like me to add you to our team so you can see the build logs? Edit: Here is a build ID: 76f5d1b8-cc8a-4ee2-b2b8-ea6fcb39cd5e

Iā€™ve also made sure the files are actually present (the google-services.json).

For my sanity, I rebuild an app (so NOT new). This did work. So it only happens for the new app that I had not yet builtā€¦

In my case it was completely my fault. When giving the backgroundColor property into app.json, instead of 6 hex characters I gave just 5. Thatā€™s why it was given build errors. Now it is fixed. :grin::grin:

1 Like

Check your app.json fileā€¦ Maybe there are some unseen mistakes.

1 Like

So, I just copied the app.json from the build that is working, changed the slug to a completely new slug, re-download google-services.json from firebase, and tried to build it.

Nope.

But given what you said, Iā€™ll just step-for-step redo it from scratch until I find what breaks it :slight_smile:

Itā€™s actually the google-services.json file that just wonā€™t work. Thatā€™s problematic. Iā€™ve compared the ā€œbrokenā€ one with the ā€œworkingā€ one, and apart from values, they are identical :frowning:

I went ahead and recreated everything.

Now it works :man_shrugging:

Hey @rajsharmaof, were you seeing the same google-services.json error as a result of your invalid backgroundColor value as well?

I built it successfullyā€¦ Thanks for asking man. :+1:

Yeahā€¦ Manā€¦ Itā€™s sameā€¦

In my case, I didnā€™t have any Google services lolšŸ˜‚

For the life of me I can not reproduce this error, if either of you have a minimal reproducible repo I could use that would be great. Iā€™ve tried a new project that hasnā€™t been built before, with and without a google-services file, with and without an invalid app.json property.

Hi everybody!

Iā€™m having the same problem, when I went from SDK 37 to SDK 38, but my error is here.

[stderr] FAILURE: Build failed with an exception.
[stderr] * What went wrong:
[stderr] Execution failed for task ':app:signReleaseBundle'.
[stderr] > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
[stderr]    > Failed to read key aalteam-android71071301146 from store "/tmp/turtle/keystore-fad4bc66-8c41-4e2b-83a2-30b13c5ab98a.jks": Invalid keystore format
[stderr] * Try:
[stderr] Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
[stderr] * Get more help at https://help.gradle.org

I think my problems started here, because it was the first build after uploading the first version of the app manually to Google Play

MBP-de-ANIBAL-2:Brokerhoods anibalasprilla$ expo build:android
āœ” Choose the build type you would like: ā€ŗ app-bundle
Checking if there is a build in progress...

Configuring credentials for aasprilla in project Brokerhoods
āœ” Would you like to upload a Keystore or have us generate one for you?
If you don't know what this means, let us generate it! :) ā€ŗ I want to upload my own file

WARNING! In this mode, we won't be able to make sure that your credentials are valid.
Please double check that you're uploading valid files for your app otherwise you may encounter strange errors!

When building for IOS make sure you've created your App ID on the Apple Developer Portal, that your App ID
is in app.json as `bundleIdentifier`, and that the provisioning profile you
upload matches that Team ID and App ID.

āœ” Path to the Keystore file. ā€¦ /Users/anibalasprilla/api-8771518372671769047-141674-fed06d34fc37.json
āœ” Keystore password ā€¦ *************
āœ” Key alias ā€¦ aalteam-android71071301146
āœ” Key password ā€¦ *************
Keystore updated successfully

Thanks in advance!

@aasprilla
Your problem is not related to issues mentioned by others in this topic. You are getting that error because you specified some json file instead of keystore.

Hi @wkozyra,

Iā€™m new to this and making silly mistakes, sorry.

How can I fix it?

Thanks in advance!

That depends

  • if you have keystore somwhere, just specify it by running expo build:android -c and passing all values manually
  • if you donā€™t have one, run expo build:android -c ā†’ wait for the build end ā†’ run expo fetch:android:upload-cert ā†’ send pem file generated by last command to google support to reset your password

If you have any question about that, please create a separate post