【发布时间】:2017-10-20 05:20:15
【问题描述】:
我们使用 android studio 创建了 Google Endpoint api v1。 我们收到了来自谷歌云的电子邮件,其中谷歌 API 版本 v1 已被弃用。所以我们尝试将 v1 更新到 v2。 因此参考以下链接进行迁移。 https://cloud.google.com/endpoints/docs/frameworks/legacy/v1/java/migrating-android#before_you_begin
更改后,当我们尝试运行时显示“.../backend/build/exploded-app”不存在
如果我查看项目中的目录树 我可以根据模块名称“backend”和包含 Discovery 文档的“endpointsDiscoveryDocs”看到展开的目录“../build/exploded-backend”。
“.../backend/build/exploded-app”和“.../backend/build/endpointsClientLibs”不可用
当我尝试执行时,构建成功但显示在 运行后端出错:无法启动进程,工作目录 '...\MyAppliaiton\backend\build\exploded-app' 不存在
我的android项目中使用了以下build.xml
MyApplication build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.google.guava:guava:19.0'
classpath 'com.android.tools.build:gradle:2.3.3'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
应用构建.gradle
**apply plugin: 'com.android.application'
// V2: Apply the new Endpoints Framework client plugin
apply plugin: 'com.google.cloud.tools.endpoints-framework-client'
buildscript {
repositories {
jcenter()
}
dependencies {
// V2: Add the new Endpoints Framework plugin dependencies
classpath 'com.google.cloud.tools:endpoints-framework-gradle-plugin:1.0.0'
}
}
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.chainsys.myapplication"
minSdkVersion 20
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.code.findbugs:jsr305:2.0.1'
testCompile 'junit:junit:4.12'
//compile project(path: ':backend', configuration: 'android-endpoints')
// V2: Endpoints Framework v2 migration
endpointsServer project(path: ':backend', configuration: 'endpoints')
compile 'com.google.api-client:google-api-client:1.23.0'
compile 'com.google.http-client:google-http-client-android:1.23.0'
}**
后端构建.gradle
**buildscript {
repositories {
jcenter()
}
dependencies {
//classpath 'com.google.appengine:gradle-appengine-plugin:1.9.42'
// V2: Add the new App Engine and Endpoints Frameworks plugin dependencies
classpath 'com.google.cloud.tools:endpoints-framework-gradle-plugin:1.0.0'
classpath 'com.google.cloud.tools:appengine-gradle-plugin:1.3.2'
}
}
repositories {
jcenter();
}
apply plugin: 'java'
apply plugin: 'war'
// apply plugin: 'appengine'
// V2: Apply new App Engine and Endpoints Framework server plugins
apply plugin: 'com.google.cloud.tools.appengine'
apply plugin: 'com.google.cloud.tools.endpoints-framework-server'
dependencies {
//appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.42'
// V2: Endpoints Framework v2 migration
compile 'com.google.endpoints:endpoints-framework:2.0.7'
compile 'javax.inject:javax.inject:1'
compile 'javax.servlet:servlet-api:2.5'
// compile 'com.google.appengine:appengine-endpoints:1.9.42'
// compile 'com.google.appengine:appengine-endpoints-deps:1.9.42'
// compile 'javax.servlet:servlet-api:2.5'
}
// V2: Define deployment configuration using the new App Engine plugin
// with the appengine closure
appengine { // App Engine tasks configuration
deploy { // deploy configuration
// The following is used for acceptance tests and
// is not required for a migration.
project = findProperty("appengine.deploy.project")
version = findProperty("appengine.deploy.version")
def promoteProp = findProperty("appengine.deploy.promote")
if (promoteProp != null) {
promote = new Boolean(promoteProp)
}
}
}**
后端 web.xml
**<?xml version="1.0" encoding="utf-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee">
<servlet>
<servlet-name>EndpointsServlet</servlet-name>
<servlet-class>com.google.api.server.spi.EndpointsServlet</servlet-class>
<init-param>
<param-name>services</param-name>
<param-value>com.example.sugumar.p.myapplication.backend.MyEndpoint</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>EndpointsServlet</servlet-name>
<url-pattern>/_ah/api/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>**
我需要帮助这里发生的事情。
【问题讨论】:
-
请您提供正在运行的命令的日志和完整输出。
-
按需配置是一项孵化功能。 :backend:compileJava 最新 :backend:processResources 最新 :backend:classes 最新 :backend:endpointsDiscoveryDocs 最新 :backend:_zipDiscoveryDocs 最新 :backend:war UP -TO-DATE :backend:explodeWar UP-TO-DATE :backend:assemble UP-TO-DATE BUILD SUCCESSFUL 错误运行后端:无法启动进程,工作目录'...\MyAppliaiton\backend\build\exploded-app'不存在
-
请把它放在你的问题中,而不是在 cmets 中。您还可以包括您的gradle(大概)配置吗?或者 Maven,如果你正在使用它。
-
更新了 saiyr。请帮我看看我的错误
标签: google-app-engine google-cloud-endpoints