When I run ionic cordova run android
to build my apps. It shows build failed.
D:\Practice\azmaeen>ionic cordova run android
Running app-scripts build: --platform android --target cordova
[16:03:52] build dev started ...
[16:03:52] clean started ...
[16:03:52] clean finished in 10 ms
[16:03:52] copy started ...
[16:03:52] deeplinks started ...
[16:03:52] deeplinks finished in 179 ms
[16:03:52] transpile started ...
[16:03:57] transpile finished in 5.14 s
[16:03:57] preprocess started ...
[16:03:57] preprocess finished in less than 1 ms
[16:03:57] webpack started ...
[16:03:58] copy finished in 5.97 s
[16:04:05] webpack finished in 7.36 s
[16:04:05] sass started ...
Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.
[16:04:11] sass finished in 5.67 s
[16:04:11] postprocess started ...
[16:04:11] postprocess finished in 18 ms
[16:04:11] lint started ...
[16:04:11] build dev finished in 19.27 s
> cordova run android
Android Studio project detected
ANDROID_HOME=C:\Users\Aman\AppData\Local\Android\Sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_161
studio
[16:04:17] lint finished in 6.28 s
Starting a Gradle Daemon, 2 incompatible and 1 stopped Daemons could not be reused, use --status for details
:wrapper
BUILD SUCCESSFUL in 39s
1 actionable task: 1 executed
Subproject Path: CordovaLib
Subproject Path: app
publishNonDefault is deprecated and has no effect anymore. All variants are now published.
Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead.
Download https://jcenter.bintray.com/com/google/gms/google-services/4.0.0/google-services-4.0.0.pom
Download https://jcenter.bintray.com/com/google/gms/google-services/4.0.0/google-services-4.0.0.jar
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
at build_7b1twz5vxmo7tfylofokr18ui.run(D:\Practice\azmaeen\platforms\android\app\build.gradle:146)
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 registerGeneratedFolders(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 registerGeneratedFolders(FileCollection)
:CordovaLib:preBuild
UP-TO-DATE
:CordovaLib:preDebugBuild UP-TO-DATE
:CordovaLib:compileDebugAidl
:CordovaLib:compileDebugRenderscript
:CordovaLib:checkDebugManifest
:CordovaLib:generateDebugBuildConfig
:CordovaLib:prepareLintJar
:CordovaLib:generateDebugResValues
:CordovaLib:generateDebugResources
:CordovaLib:packageDebugResources
:CordovaLib:platformAttrExtractor
:CordovaLib:processDebugManifest
:CordovaLib:javaPreCompileDebug
:CordovaLib:processDebugJavaRes NO-SOURCE
:app:preBuild
UP-TO-DATE
:app:preDebugBuild
:app:compileDebugAidl
:CordovaLib:packageDebugRenderscript NO-SOURCE
:app:compileDebugRenderscript
:app:checkDebugManifest
:app:generateDebugBuildConfig
:app:prepareLintJar
:app:generateDebugResValues
:app:generateDebugResources
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugGoogleServices'.
> File google-services.json is missing. The Google Services Plugin cannot function without it.
Searched Location:
D:\Practice\azmaeen\platforms\android\app\src\nullnull\debug\google-services.json
D:\Practice\azmaeen\platforms\android\app\src\debug\nullnull\google-services.json
D:\Practice\azmaeen\platforms\android\app\src\nullnull\google-services.json
D:\Practice\azmaeen\platforms\android\app\src\debug\google-services.json
D:\Practice\azmaeen\platforms\android\app\src\nullnullDebug\google-services.json
D:\Practice\azmaeen\platforms\android\app\google-services.json
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 26s
:app:processDebugGoogleServices FAILED
18 actionable tasks: 18 executed
(node:14304) UnhandledPromiseRejectionWarning: Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugGoogleServices'.
> File google-services.json is missing. The Google Services Plugin cannot function without it.
Searched Location:
D:\Practice\azmaeen\platforms\android\app\src\nullnull\debug\google-services.json
D:\Practice\azmaeen\platforms\android\app\src\debug\nullnull\google-services.json
D:\Practice\azmaeen\platforms\android\app\src\nullnull\google-services.json
D:\Practice\azmaeen\platforms\android\app\src\debug\google-services.json
D:\Practice\azmaeen\platforms\android\app\src\nullnullDebug\google-services.json
D:\Practice\azmaeen\platforms\android\app\google-services.json
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 26s
at ChildProcess.whenDone (D:\Practice\azmaeen\platforms\android\cordova\node_modules\cordova-common\src\superspawn.js:169:23)
at ChildProcess.emit (events.js:197:13)
at maybeClose (internal/child_process.js:978:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
(node:14304) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:14304) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[OK] Your app has been deployed.
Did you know you can live-reload changes from your app with --livereload?
My Environment is:
D:\Practice\azmaeen>ionic info
cli packages: (C:\Users\Aman\AppData\Roaming\npm\node_modules)
@ionic/cli-utils : 1.19.2
ionic (Ionic CLI) : 3.20.0
global packages:
cordova (Cordova CLI) : 8.0.0
local packages:
@ionic/app-scripts : 3.1.8
Cordova Platforms : android 7.0.0
Ionic Framework : ionic-angular 3.9.2
System:
Node : v11.9.0
npm : 6.7.0
OS : Windows 10
Environment Variables:
ANDROID_HOME : not set
Misc:
backend : pro