2

It is my first time trying to use GAE endpoints connecting in an Android Studio project. So, I've simply followed the instructions provided by Google (https://cloud.google.com/tools/android-studio/app_engine/). But I am getting a 403 error every time I attempt to build or run backend module. Here is the message:

Error:Execution failed for task ':backend:appengineEndpointsGetClientLibs'.
> There was an error running endpoints command get-client-lib: 403 Forbidden
  <!DOCTYPE html>
<html lang=en>
  <meta charset=utf-8>
  <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
  <title>Error 403 (Forbidden)!!1</title>
  <style>
    *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}
  </style>
  <a href=//www.google.com/><span id=logo aria-label=Google></span></a>
  <p><b>403.</b> <ins>That’s an error.</ins>
  <p>Your client does not have permission to get URL <code>/_ah/api/discovery/v1/apis/generate/rest</code> from this server.  <ins>That’s all we know.</ins>

Usually I could suppress this kind of issues by enabling a proxy in Settings. But for this error, after googling for 3 days and trying all solutions flashed in my mind, nothing changed. Anyone has encountered the same error? or know a solution/suggestion?

Edit I am running the template Endpoint project with sample MyBean and MyEndpoint classes without any changes. Here is related build.gradle file:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.google.appengine:gradle-appengine-plugin:1.9.18'
    }
}

repositories {
    mavenCentral();
}

apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'appengine'

sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7

dependencies {
    appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.18'
    compile 'com.google.appengine:appengine-endpoints:1.9.18'
    compile 'com.google.appengine:appengine-endpoints-deps:1.9.18'
    compile 'javax.servlet:servlet-api:2.5'
}

appengine {
    downloadSdk = true
    appcfg {
        oauth2 = true
    }
    endpoints {
        getClientLibsOnBuild = true
        getDiscoveryDocsOnBuild = true
    }
}
Ali Mortazavi
  • 41
  • 1
  • 10

1 Answers1

1

Google blocks access of people in some countries including Iran to http://developer.google.com and http://apis.google.com, so you are having problems.

You should avoid Google App Engine anyway, because of privacy, portability and several other concerns.

Portability concerns

Developers worry that the applications will not be portable from App Engine and fear being locked into the technology. In response, there are a number of projects to create open-source back-ends for the various proprietary/closed APIs of app engine, especially the datastore. AppScale, CapeDwarf and TyphoonAE are a few of the open source efforts.

https://en.wikipedia.org/wiki/Google_App_Engine#Portability_concerns

You can use these alternatives.

Ho1
  • 1,239
  • 1
  • 11
  • 29
  • Thanks for response @Ho1. Actually, portability or other GAE main drawbacks our not my concerns. I am working for an employer outside the Iran where the whole project will be deployed. I had this issue from downloading the framework to using developers features but a proxy server made it possible for me to develop and test apps inside Google environment. for this particular issue, is it possible to use a proxy setting for Java httprequests at test? – Ali Mortazavi Mar 27 '16 at 08:12
  • Yes. But VPN would be a better choice. – Ho1 Mar 27 '16 at 09:08