无法为com.google.cloud.tools.gradle.appengine.core.AppEngineExtension

时间:2018-09-25 14:23:10

标签: android backend google-cloud-endpoints

我在 build.gradle 文件中有以下代码。

   buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.google.cloud.tools:endpoints-framework-gradle-plugin:1.0.2'
        classpath 'com.google.cloud.tools:appengine-gradle-plugin:1.3.3'
    }
  }

 repositories {
    jcenter()
 }
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'com.google.cloud.tools.appengine'
apply plugin: 'com.google.cloud.tools.endpoints-framework-server'

sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7

 dependencies {
    implementation 'com.google.endpoints:endpoints-framework:2.0.9'
    implementation 'javax.inject:javax.inject:1'

    implementation 'javax.servlet:servlet-api:2.5'
    implementation 'com.google.api-client:google-api-client:1.23.0'
    implementation 'com.google.http-client:google-http-client-android:1.23.0'

}
appengine {
    httpAddress = "0.0.0.0"
}

我的Android应用程序有后端,我想使用物理设备对其进行测试。按照此guide,我添加了

appengine {
httpAddress = "0.0.0.0"
}

但是我收到以下错误

  

无法为com.google.cloud.tools.gradle.appengine.core.AppEngineExtension类型的对象设置未知属性“ httpAddress”。

如何解决此错误?

1 个答案:

答案 0 :(得分:4)

根据the official documentation,您需要这样做:

appengine {
  run {
    host = '0.0.0.0'
  }
}

appengine.run.host = '0.0.0.0'