我們已經使用android studio創建了Google Endpoint api v1。 我們收到來自Google雲端的電子郵件,即Google Api v1已被棄用。所以我們嘗試將v1更新爲v2。 所以引用下面的鏈接進行遷移。 https://cloud.google.com/endpoints/docs/frameworks/legacy/v1/java/migrating-android#before_you_beginGoogle App引擎端點版本遷移V1到V2
變化,當我們試圖運行時演出結束後「... /後端/建設/爆炸-應用」不存在
如果我看看目錄樹我的項目 內我可以看到根據包含Discovery文檔的模塊名稱「backend」和「endpointsDiscoveryDocs」展開目錄「../build/exploded-backend」。
不可用 '... /後端/建設/爆炸-應用' 和 '... /後端/建設/ endpointsClientLibs'
,當我試圖執行,構建成功,但顯示在 錯誤運行後臺:無法啓動的過程中,工作目錄「... \ MyAppliaiton \後端\建立\爆炸,應用」不存在
下面的build.xml在我的Android項目中使用
所有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
}
應用的build.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'
}**
後端的build.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>**
我需要幫助這裏發生了什麼。
需要你提供什麼命令你的日誌請運行和完整的輸出。 – saiyr
按需配置是一項孵化功能。 :後端:compileJava UP-TO-DATE :後端:processResources UP-TO-DATE :後端:類UP-TO-DATE :後端:endpointsDiscoveryDocs UP-TO-DATE :後端:_zipDiscoveryDocs UP-TO-DATE :後端:戰爭UP-TO-DATE :後端:explodeWar UP-TO-DATE :後端:組裝UP-TO-DATE 生成成功 錯誤運行後臺:無法啓動的過程中,工作目錄」 ... \ MyAppliaiton \ backend \ build \ exploded-app'不存在 –
請將此置於您的問題中,而不是在評論中。你還可以包含你的gradle(大概)配置嗎?或者Maven,如果這就是你正在使用的。 – saiyr