user2459624
user2459624

Reputation: 181

Tryint to generate "Cloud Endpoint Client Library" from Google-app-engine project failed in MAC OS X

I'm trying to generate "Cloud Endpoint Client Library" from Google App-Engine project using Eclipse plug-in, but it fails with exception: InvocationTargetException - "All API classes with the same API name and version must have the exact same API-wide configuration". I'm using Eclipse 4.2 with Google App-Engine plug-in 1.8.3 on MAC OS X 10.8.4. The strange thing is: on PC running Windows with same eclipse and plug-in versions, generating the libraries from the project doesn't raise any exception.

Upvotes: 1

Views: 279

Answers (2)

FilipR
FilipR

Reputation: 1238

While all properties in the @Api annotation must match for all classes in an API, you can additionally use the @ApiClass annotation to provides properties that do not need to be exactly the same between classes.

For this case:

@Api(name = "shoppingassistant",
version = "v1", namespace = @ApiNamespace(ownerDomain = ApiKeysAndIds.API_OWNER,
    ownerName = ApiKeysAndIds.API_OWNER, packagePath = ApiKeysAndIds.API_PACKAGE_PATH),
clientIds = {
    ApiKeysAndIds.ANDROID_CLIENT_ID, ApiKeysAndIds.IOS_CLIENT_ID, ApiKeysAndIds.WEB_CLIENT_ID},
audiences = {ApiKeysAndIds.AUDIENCE_ID})
@ApiClass(resource = "deviceinfos")

Read the full tutorial here

Upvotes: 0

Gabor Juhasz
Gabor Juhasz

Reputation: 317

I was having the same problem. I ended up removing the resource attribute from ALL of the endpoint classes, as it was the only difference.

@Api(name = "shoppingassistant",
// resource = "deviceinfos",
version = "v1", namespace = @ApiNamespace(ownerDomain = ApiKeysAndIds.API_OWNER, ownerName = ApiKeysAndIds.API_OWNER, packagePath = ApiKeysAndIds.API_PACKAGE_PATH), clientIds = {
        ApiKeysAndIds.ANDROID_CLIENT_ID, ApiKeysAndIds.IOS_CLIENT_ID, ApiKeysAndIds.WEB_CLIENT_ID }, audiences = { ApiKeysAndIds.AUDIENCE_ID })

The project compiles now, and I was able to generate the client lib. (I haven't tried the android project yet)

Upvotes: 1

Related Questions