The "appengine.applications.get" permission is required - google-app-engine

I am trying to deploy my first app engine spring boot project using gradle and I am running into the following error when I run "gradle appengineDeploy":
ERROR: (gcloud.app.deploy) Error Response: [403] Operation not allowed
Details: [
[
{
"#type": "type.googleapis.com/google.rpc.ResourceInfo",
"description": "The \"appengine.applications.get\" permission is required.",
"resourceType": "gae.api"
}
]
]
Here is my build.gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.2.RELEASE")
classpath("com.google.cloud.tools:appengine-gradle-plugin:+")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'com.google.cloud.tools.appengine'
jar {
baseName = 'gs-spring-boot'
version = '0.1.0'
}
repositories {
mavenCentral()
maven {
url 'https://maven-central.storage.googleapis.com'
}
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
// tag::actuator[]
compile("org.springframework.boot:spring-boot-starter-actuator")
// end::actuator[]
// tag::tests[]
testCompile("org.springframework.boot:spring-boot-starter-test")
// end::tests[]
//compile("com.google.cloud.tools:appengine-maven-plugin:1.0.0")
//appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.50'
compile('com.google.appengine:appengine:+')
}
appengine {
deploy { // deploy configuration
stopPreviousVersion = true // default - stop the current version
promote = true // default - & make this the current version
}
}
Please let me know how to proceed.

I got this after updating the google cloud sdk. I just run gcloud init again and entered the same choices.

I recreated the app engine instance and the problem was fixed

A bit silly, but I got this error by mistyping the GCP project name:
$ gcloud app deploy app.yaml --project=wrong-project-name

I fixed this issue by enabling the 'google app engine' cloud api in their api console.

Related

How to dynamically set appengine gradle property

How can I create a task that dynamically set app engine project id and run the appengineDeploy task?
On this example when I run deployStaging appengineDeploy is being executed with project 'a', how I can rewrite this code to make it run with project 'b'?
buildscript {
dependencies {
classpath("com.google.cloud.tools:appengine-gradle-plugin:2.0.1")
}
}
apply plugin: 'com.google.cloud.tools.appengine'
def gcpProject = 'a'
appengine {
deploy {
projectId = gcpProject
}
}
task deployStaging() {
doLast {
gcpProject = 'b'
}
}
deployStaging.finalizedBy appengineDeploy
Answer provided by the gradle plugin folks:
appengine {
deploy {
version = "123"
// do not define projectId here
}
}
task deployStaging {
dependsOn appengineDeploy
}
task deployProduction {
dependsOn appengineDeploy
}
// here's the weird gradle logic, use at your own risk
if (project.gradle.startParameter.taskNames.contains("deployStaging")) {
appengine.deploy.projectId = "potato-stage"
}
else if(project.gradle.startParameter.taskNames.contains("deployProduction")) {
appengine.deploy.projectId = "tomato-prod"
}
How about using a project property instead? Project properties can be passed via -P command line parameters:
buildscript {
dependencies {
classpath("com.google.cloud.tools:appengine-gradle-plugin:2.0.1")
}
}
apply plugin: 'com.google.cloud.tools.appengine'
def gcpProject = project.findProperty('stageName') ?: 'a'
appengine {
deploy {
projectId = gcpProject
}
}
Now if you just call ./gradlew appengineDeploy the gcpProject variable will have the value 'a'. If you call ./gradlew appengineDeploy -PstageName=b the gcpProject variable will have the value 'b'.

Why does Android Studio believe my App Engine module is an Android app?

I have a project which contains
an Android app module
an App Engine (Cloud Endpoints) module
When I created the project with an older version of Android Studio, it created a reference between the modules, which I removed. Before I did this, I also tried raising the minimum Version in the app module to 21, but Android Studio or LINT somehow still believes my App Engine module was an app and marks code like
list.isEmpty()
new AbstractMap.SimpleEntry<>()
with something like Call required API level 9 (current min is 1): (...).
The project compiles fine, but the errors are underlined in red and show up in LINT.
Neither in the project gradle nor the module gradle I can see anything suspicious. Any idea what the problem could be or where to search and fix this?
For completeness, here are the gradle files:
Projct:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
App Engine Module:
// https://github.com/GoogleCloudPlatform/gradle-appengine-plugin
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.google.appengine:gradle-appengine-plugin:1.9.30'
}
}
repositories {
jcenter();
}
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'appengine'
dependencies {
appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.30'
compile 'com.google.appengine:appengine-endpoints:1.9.30'
compile 'com.google.appengine:appengine-endpoints-deps:1.9.30'
compile 'com.google.appengine.tools:appengine-gcs-client:0.5'
compile 'javax.servlet:servlet-api:2.5'
compile 'com.googlecode.objectify:objectify:5.1.3'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.retrofit:converter-simplexml:1.9.0'
compile 'io.jsonwebtoken:jjwt:0.6.0'
compile 'org.slf4j:slf4j-parent:1.7.10' // required for JJWT
compile 'org.slf4j:slf4j-nop:1.7.10' // suppress all internal logging in JJWT
}
appengine {
downloadSdk = true
appcfg {
oauth2 = true
}
endpoints {
getClientLibsOnBuild = true
getDiscoveryDocsOnBuild = true
}
}
App Module:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "cc.closeup.android.test"
minSdkVersion 21
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.4.0'
}

JavaFXPorts 8.60.7 app crash when traying type into TextField

I have an issue with latest JavaFXPorts 8.60.7 when I type any char from keyboard to TextField, app will crash. I'm using android 5.0.1. Earlier my app was developed on JavaFXPorts 8.60.6 and there my app was working, I could in 8.60.6, type a characters into TextField.
I receive in logcat this error:
04-15 21:56:22.066 10732-10769/? E/AndroidRuntime: FATAL EXCEPTION: JavaFX Application Thread
Process: pl.plf.myapp, PID: 10732
java.lang.NoSuchMethodError: No static method dispatchKeyEvent(II[CI)V in class Lcom/sun/glass/ui/monocle/AndroidInputDeviceRegistry; or its super classes (declaration of 'com.sun.glass.ui.monocle.AndroidInputDeviceRegistry' appears in /data/app/pl.plf.myapp-1/base.apk)
at javafxports.android.KeyEventProcessor$1.run(KeyEventProcessor.java:53)
at com.sun.javafx.application.PlatformImpl.lambda$null$155(PlatformImpl.java:295)
at com.sun.javafx.application.PlatformImpl.access$lambda$18(PlatformImpl.java)
at com.sun.javafx.application.PlatformImpl$$Lambda$19.run(Unknown Source)
at java.security.AccessController.doPrivileged(AccessController.java:52)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$156(PlatformImpl.java:294)
at com.sun.javafx.application.PlatformImpl.access$lambda$5(PlatformImpl.java)
at com.sun.javafx.application.PlatformImpl$$Lambda$6.run(Unknown Source)
at com.sun.glass.ui.monocle.RunnableProcessor.runLoop(RunnableProcessor.java:92)
at com.sun.glass.ui.monocle.RunnableProcessor.run(RunnableProcessor.java:51)
at java.lang.Thread.run(Thread.java:818)
And this is my build.gradle:
apply plugin: 'java'
apply plugin: 'war'
sourceCompatibility = 1.7
targetCompatibility = 1.7
version = '1.0'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:1.0.8'
}
}
apply plugin: 'org.javafxports.jfxmobile'
repositories {
mavenCentral()
}
dependencies {
compile project(":ApiCore")
compile project(":Validation")
compile project(":PLFModel")
compile 'org.javafxports:jfxdvk:8.60.7'
compile fileTree(dir: 'libs', include: '*.jar')
runtime fileTree(dir: 'libs', include: '*.jar')
}
mainClassName = 'pl.plf.myapp.MainApp'
jfxmobile {
android {
javafxportsVersion = '8.60.7'
manifest = 'src/android/AndroidManifest.xml'
androidSdk = '/home/user/Android/Sdk'
packagingOptions {
exclude 'META-INF/notice.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE.txt'
}
dexOptions {
javaMaxHeapSize "4g"
}
}
}
Thank's for any help.

Gradle: Plugin with id appengine not found

I m working on Mac, with Android Studio.
I m trying to build a Android App with a Google App Engine BackEnd.
I've installed Maven and Gradel and exported the M2_HOME et GRADLE_HOME
Whenever I run any of the Gradle commends I get this :
Error:(21, 0) Gradle: A problem occurred evaluating project
':backend'. Plugin with id 'appengine' not found.
the Build.gradle file :
buildscript {
repositories {
mavenCentral()
}
dependencies {
}
}
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.3'
compile 'javax.servlet:servlet-api:2.5'
compile 'com.googlecode.objectify:objectify:5.0.+'
compile 'com.google.guava:guava:16.0.+'
}
appengine {
downloadSdk = true
appcfg {
oauth2 = true
}
}
From description on plugin github page you need to define plugin JAR file in the classpath of your build script.
So here is how it can be done:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.google.appengine:gradle-appengine-plugin:1.9.3'
}
}
....

Gradle, gae, appengine-web.xml and web.xml not found

I have just started with gae plugin. The problem is that when I run gradle gaeRun I get the exception:
com.google.apphosting.utils.config.AppEngineConfigException: Could not locate ../myapp/build/exploded-war/WEB-INF/appengine-web.xml
So far I managed to get round the problem by adding the following in my gradle.build script:
gaeRun.doFirst{
copy {
from('war/WEB-INF/') {
include '**/*'
}
into 'build/exploded-war/WEB-INF/'
}
}
Is that the correct approach? Below is the whole script:
apply plugin: 'gae'
apply plugin: 'eclipse'
apply plugin: 'scala'
task wrapper(type: Wrapper) {
gradleVersion = '1.0'
}
buildscript {
repositories { mavenCentral() }
dependencies {
classpath 'org.gradle.api.plugins:gradle-gae-plugin:0.7.6'
}
}
repositories {
mavenCentral()
}
dependencies {
scalaTools 'org.scala-lang:scala-compiler:2.9.1'
scalaTools 'org.scala-lang:scala-library:2.9.1'
compile 'org.scala-lang:scala-library:2.9.1'
testCompile group: 'junit', name: 'junit', version: '4.8.2'
}
gae {
httpPort = 8085
optimizeWar = true
appcfg {
email = 'email#gmail.com'
passIn = true
logs {
severity = 1
outputFile = file('mylogs.txt')
}
app { id = 'sample-app' }
}
}
gaeRun.doFirst{
copy {
from('war/WEB-INF/') {
include '**/*'
}
into 'build/exploded-war/WEB-INF/'
}
}

Resources