Excuse me, and I tried to build an APK with the command
ionic cordova build android --debug FAILURE: Build failed with an exception. What went wrong: Could not resolve all files for configuration ':app:debugCompileClasspath'.
Could not find play-services-auth.aar (com.google.android.gms:play-services-auth:11.8.0). Searched in the following locations: Could not find play-services-identity.aar (com.google.android.gms:play-services-identity:11.8.0). Searched in the following locations: Could not find play-services-auth-api-phone.aar (com.google.android.gms:play-services-auth-api-phone:11.8.0). Searched in the following locations: Could not find play-services-auth-base.aar (com.google.android.gms:play-services-auth-base:11.8.0). Searched in the following locations: Could not find play-services-identity-license.aar (com.google.android.gms:play-services-identity-license:11.8.0). Searched in the following locations: Could not find play-services-auth-api-phone-license.aar (com.google.android.gms:play-services-auth-api-phone-license:11.8.0). Searched in the following locations: Could not find play-services-auth-base-license.aar (com.google.android.gms:play-services-auth-base-license:11.8.0). Searched in the following locations:
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED in 13s 14 actionable tasks: 1 executed, 13 up-to-date (node:440) UnhandledPromiseRejectionWarning: Error: /home/alain/PuntoPro/PuntoPro/platforms/android/gradlew: Command failed with exit code 1 Error output: FAILURE: Build failed with an exception.
What went wrong: Could not resolve all files for configuration ':app:debugCompileClasspath'.
Could not find play-services-auth.aar (com.google.android.gms:play-services-auth:11.8.0). Searched in the following locations: Could not find play-services-identity.aar (com.google.android.gms:play-services-identity:11.8.0). Searched in the following locations: Could not find play-services-auth-api-phone.aar (com.google.android.gms:play-services-auth-api-phone:11.8.0). Searched in the following locations: Could not find play-services-auth-base.aar (com.google.android.gms:play-services-auth-base:11.8.0). Searched in the following locations: Could not find play-services-identity-license.aar (com.google.android.gms:play-services-identity-license:11.8.0). Searched in the following locations: Could not find play-services-auth-api-phone-license.aar (com.google.android.gms:play-services-auth-api-phone-license:11.8.0). Searched in the following locations: Could not find play-services-auth-base-license.aar (com.google.android.gms:play-services-auth-base-license:11.8.0). Searched in the following locations:
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED in 13s at ChildProcess.whenDone (/home/alain/PuntoPro/PuntoPro/platforms/android/cordova/node_modules/cordova-common/src/superspawn.js:169:23) at emitTwo (events.js:126:13) at ChildProcess.emit (events.js:214:7) at maybeClose (internal/child_process.js:925:16) at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5) (node:440) 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:440) [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.
I already searched for the solution, but still nothing, maybe I could help.
11 Answers
Solved the problem by making a small change to the build.gradle file. Basically just change the order, calling first maven {} and then jcenter ()
buildscript { repositories { maven { url "" } jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.0.0' } } 1I solved my problem by removing
maven { url "" } in the allprojects { repositeries{ ... } } lines below the buildscript { ... } lines.
Then, I add google() before jcenter() like that :
allprojects { repositories { google() jcenter() } ... } So in platforms/android/build.gradle file,it should be something like this:
buildscript { repositories { jcenter() maven { url "" } } dependencies { classpath 'com.android.tools.build:gradle:3.0.1' } } I also face the same issue a few days ago solved via :
Go to platform/android/build.gradle
Move google to upside in buildscripts as well as in allprojects
For example
I cannot explain from where the problem arises but it can be solved by Invalidatind caches and restart,
goto
File and select invalidate caches and restart
in my case it was in incorrect or outdated(?) plugin de.appplant.cordova.plugin.local-notification, that I installed recently
I removed this plugin de.appplant.cordova.plugin.local-notification
Than install other version ionic cordova plugin add cordova-plugin-local-notification
Ionic 3 codebase
Ionic 6* cli version
I solved my problem by changing distributionUrl in gradle-wrapper.properties file to latest version
if you use Gradle plugin 4 or higher, use: google(), otherwise use: maven {url ""}
I was using implementation "android.arch.lifecycle:extensions:1.1.1" and it was because of that! I removed it and it started to build again!
Step 1: install java 8
Step 2: setup your environment variable
Step 3: go to android studio click file->project structure->project settings->project.
Step 4: select project sdk "which should be the sdk you are targeting"
Step 5: click apply then ok.
I was having a similar challenge. Apparently, I had added a dysfunctional dependency that was throwing that build error. What I did was that I scrolled downward in the build output and I saw the dependency that was giving me the error, something like, "couldn't find com.github.sharish:ShimmerRecyclerView:v1.3"
I simply deleted that dependency and my app started running again.