Search code examples
flutterbuildapk

Unable to build an apk in flutter


I am trying to build an api from my flutter project, last month it was fine when I was doing flutter build apk, but not for now... I am not able to do that and here is the error log

FAILURE: Build failed with an exception.                                
                                                                        
* What went wrong:                                                      
Could not determine the dependencies of task ':app:compileReleaseJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:releaseCompileClasspath'.
   > Could not resolve com.google.android.gms:play-services-location:16.+.
     Required by:                                                       
         project :app > project :location                               
      > Failed to list versions for com.google.android.gms:play-services-location.
         > Unable to load Maven meta-data from https://google.bintray.com/exoplayer/com/google/android/gms/play-services-location/maven-metadata.xml.
            > Could not get resource 'https://google.bintray.com/exoplayer/com/google/android/gms/play-services-location/maven-metadata.xml'.
               > Could not GET 'https://google.bintray.com/exoplayer/com/google/android/gms/play-services-location/maven-metadata.xml'. Received status code 403 from server: Forbidden
                                                                        
* Try:                                                                  
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.
                                                                        
* Get more help at https://help.gradle.org                              
                                                                        
BUILD FAILED in 33s                                                     
Running Gradle task 'assembleRelease'...                                
Running Gradle task 'assembleRelease'... Done                      34.3s
Gradle task assembleRelease failed with exit code 1

here is my android/build.gradle: https://gist.github.com/wahyu-handayani/959de3306aa1410c1b9b78ad927cc35c


Solution

  • Try to update your gradle wrapper to: distributionUrl=https://services.gradle.org/distributions/gradle-6.7.1-all.zip