使用Android Studio生成Google Endpoints库(JDO)

时间:2014-08-13 09:28:11

标签: android google-app-engine android-studio jdo google-cloud-endpoints

我正在尝试从Android Studio生成基于JDO的端点,但是没有生成库(并且没有显示错误)。我能看到的唯一警告是下面关于注释的警告。

这是我的gradle日志:

:app:preBuild
:app:preDebugBuild
:app:checkDebugManifest
:app:preReleaseBuild
:head:appengineDownloadSdk
:head:compileJava
warning: Implicitly compiled files were not subject to annotation processing.
  Use -proc:none to disable annotation processing or -implicit to specify a policy for implicit compilation.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 warning

:head:processResources UP-TO-DATE
:head:classes
:head:appengineEndpointsGetClientLibs
API client library written to C:\Users\Juan\AndroidStudioProjects\Komi\head\build\client-libs\registration-v1-java.zip
API client library written to C:\Users\Juan\AndroidStudioProjects\Komi\head\build\client-libs\messaging-v1-java.zip
:head:appengineEndpointsExpandClientLibs

两个显示API客户端库是基于客体化的,但第三个(基于JDO)缺失并且似乎被跳过。我将不胜感激,谢谢!

这是gradle文件(与docs不同):

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

repositories {
    mavenCentral();
}

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

sourceCompatibility = 1.7
targetCompatibility = 1.7

dependencies {
  appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.9'
  compile 'com.google.appengine:appengine-endpoints:1.9.9'
  compile 'com.google.appengine:appengine-endpoints-deps:1.9.9'
  compile 'javax.servlet:servlet-api:2.5'
  compile 'com.googlecode.objectify:objectify:4.0b3'
  compile 'com.ganyo:gcm-server:1.0.2'
  compile 'javax.jdo:jdo-api:3.0.1'
  compile 'org.datanucleus:datanucleus-core:3.1.4'
  compile 'org.datanucleus:datanucleus-api-jdo:3.1.3'
}

appengine {
  downloadSdk = true
  appcfg {
    oauth2 = true
  }
  endpoints {
    getClientLibsOnBuild = true
    getDiscoveryDocsOnBuild = true
  }
}

1 个答案:

答案 0 :(得分:1)

为了使它工作,我修了几件事(感谢@loosebazooka)

1)首先将端点添加到web.xml

<servlet>
        <servlet-name>SystemServiceServlet</servlet-name>
        <servlet-class>com.google.api.server.spi.SystemServiceServlet</servlet-class>
        <init-param>
            <param-name>services</param-name>
            <param-value>com.something.else.Userendpoint, com.something.else.AnotherEndpoint</param-value>
        </init-param>
    </servlet>
    <servlet-mapping>
        <servlet-name>SystemServiceServlet</servlet-name>
        <url-pattern>/_ah/spi/*</url-pattern>
    </servlet-mapping>

2)我的依赖关系出错(datanucleous-core和datanucleous-jdo-api的版本不同。一旦我将依赖关系更改为3.1.3版本增强开始工作正常并且Google端点再次变得很棒