Getting QueryResultIterable not found error with Gradle appengine project using Objectify - java

I've set up an Gradle App Engine project and ported over my code that was working perfectly well. But on building the project through Gradle I get the following error:
20:28:32.036 [INFO] [org.gradle.api.internal.tasks.compile.jdk6.Jdk6JavaCompiler] Compiling with JDK Java compiler API.
20:28:32.088 [ERROR] [system.err] D:\Projects\WordBuzzIntegrated\wordbuzzserver\src\com\wrc\wordbuzzweb\service\Login.java:21: error: cannot access QueryResultIterable
20:28:32.088 [ERROR] [system.err] User user = ofy().load().type(User.class).id(facebookUser.id).now();
20:28:32.089 [ERROR] [system.err] ^
20:28:32.089 [ERROR] [system.err] class file for com.google.appengine.api.datastore.QueryResultIterable not found
I don't really have a clue what's causing the problem and Googling the error returns zero results. My dependencies list is as follows:
dependencies {
appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.15'
providedCompile 'javax.servlet:servlet-api:2.5'
testCompile group: 'junit', name: 'junit', version: '4.11'
compile 'com.fasterxml.jackson.core:jackson-databind:2.4.3'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.4.0'
compile 'com.fasterxml.jackson.core:jackson-core:2.4.3'
compile 'com.googlecode.objectify:objectify:5.1.1'
}
If anyone has any idea what might be going on here then your help would be greatly appreciated.

There are other App Engine dependencies that need to be included in the Gradle build. I ended up including all of the following for good measure - although I'm not sure all are required:
dependencies {
appengineSdk "com.google.appengine:appengine-java-sdk:$appEngineVersion"
compile "com.google.appengine:appengine-api-1.0-sdk:$appEngineVersion"
compile "com.google.appengine:appengine-endpoints:$appEngineVersion"
compile "com.google.appengine:appengine-endpoints-deps:$appEngineVersion"
compile "com.googlecode.objectify:objectify:5.1.1"
compile group: "com.google.guava", name: "guava", version: "18.0"
}
If using IntelliJ be sure to add the jars to your artifact for deployment.
If you want to run unit tests (junit included below) then you'll also need to add the following
testCompile group: "junit", name: "junit", version: "4.11"
testCompile "com.google.appengine:appengine-testing:$appEngineVersion"
testCompile "com.google.appengine:appengine-api-labs:$appEngineVersion"
testCompile "com.google.appengine:appengine-api-stubs:$appEngineVersion"
You'll also need to include the following in your Gradle script to set the app engine version. (Check what the latest version is)
ext.appEngineVersion = '1.9.21'

The Problem can be solved by adding the following dependendy in Gradle:
compile 'com.google.appengine:appengine-api-1.0-sdk:1.9.21'
You do not need to have the dependency for Cloud Endpoints if you are not using it, although it will also solve the problem as it has itself a dependeny on the missing one.
Ran into the same issue when generating a module with Android Studio which did not include this API. I could not even find any information on it in the documentation.

Related

Gradle DSL method not found: exclude()

i am using a lot of library in my project. And some libraries using same jar file therefore i writed this on build.gradle :
dependencies {
compile fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.twotoasters.jazzylistview:library:1.2.1'
compile 'com.google.firebase:firebase-core:10.2.4'
compile 'com.google.firebase:firebase-database:10.2.4'
compile 'com.orhanobut:dialogplus:1.11#aar'
compile 'com.github.recruit-lifestyle:FloatingView:2.2'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.nineoldandroids:library:2.4.0'
compile ('com.specyci:residemenu:1.6+'){
exclude group: 'com.nineoldandroids', module: 'library' }
compile files('libs/poppyview.jar'){
exclude group: 'com.nineoldandroids', module: 'library' }
}
And i am getting error :
Error:(54, 0) Gradle DSL method not found: 'exclude()'
Possible causes:The project 'DopingEng' may be using a version of the Android Gradle plug-in that does not contain the method (e.g. 'testCompile' was added in 1.1.0).
Upgrade plugin to version 2.3.1 and sync projectThe project 'DopingEng' may be using a version of Gradle that does not contain the method.
Open Gradle wrapper fileThe build file may be missing a Gradle plugin.
Apply Gradle plugin
Gradle already update , how can i solve this problem ?
Here's the problem
compile files('libs/poppyview.jar'){
exclude ...
}
A file based dependency does not work in the same way as a dependency coming from a repository. There is no meta data associated with it (eg no dependency information) so there's also nothing to exclude (since there's no transitive dependencies).
Do you have the pom/ivy meta-data for libs/poppyview.jar? If so then you shouldn't declare it like this (I suggest a local maven repository folder). If you don't then there's nothing to exclude

Manifest Merger Error - Different versions of support library

I'm adding the stepper indicator library - https://github.com/badoualy/stepper-indicator - to my project. To do so, I added jitpack to my project gradle file and the stepper-indicator library to my app gradle file. However, I'm getting the following build error:
Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute meta-data#android.support.VERSION#value value=(25.4.0) from [com.android.support:preference-v14:25.4.0] AndroidManifest.xml:25:13-35
is also present at [com.android.support:appcompat-v7:26.0.0-beta2] AndroidManifest.xml:28:13-41 value=(26.0.0-beta2).
Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:23:9-25:38 to override.
The other dependencies in my app include:
compile 'com.android.support:preference-v7:25.4.0'
compile 'com.android.support:preference-v14:25.4.0'
compile 'eu.davidea:flexible-adapter:5.0.0-rc2'
compile 'com.android.support:appcompat-v7:25.4.0'
compile 'com.android.support:recyclerview-v7:25.4.0'
compile 'com.android.support:cardview-v7:25.4.0'
compile 'com.android.support:support-v4:25.4.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.android.gms:play-services-gcm:11.0.2'
compile 'com.google.android.gms:play-services-auth:11.0.2'
compile 'com.google.android.gms:play-services-ads:11.0.2'
compile 'com.google.firebase:firebase-messaging:11.0.2'
compile 'com.google.firebase:firebase-auth:11.0.2'
compile 'com.squareup.okhttp3:okhttp:3.8.1'
Without upgrading all of the android support libraries to an alpha version, is there a solution to this problem?
In build.gradle you can exclude conflicting dependencies. For example:
compile ('com.github.badoualy:stepper-indicator:1.0.7'){
exclude group: 'com.android.support', module: 'appcompat-v7'
}
To inspect dependencies, you can use Gradle toolbar in Android Studio -> application module -> tasks -> android -> androidDependencies
Update:

Failed resolution of: Lorg/apache/commons/codec/digest/DigestUtils

I am having issues with app crashing and giving this stack trace
java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/commons/codec/digest/DigestUtils;
at com.ryko.fstwo.wrapper.DigestUtilsWrapper.sha1(DigestUtilsWrapper.java:7)
...
Didn't find class "org.apache.commons.codec.digest.DigestUtils" on path: <really long path name>
I have gone through all the threads on here I can find about this problem, but cant find a resolution. In my libs folder I have commons-collections-3.2.1.jar, In my dependencies section on build.gradle I have
compile 'org.apache.commons:commons-collections4:4.1' and
compile files('libs/commons-collections-3.2.1.jar').
I have read through these but can't find a working solution
1, 2, 3 and many others
I guess that you need a dependency to commons-codec. It is available in maven central repo.
For example, add this to the dependencies section of your build.gradle:
compile group: 'commons-codec', name: 'commons-codec', version: '1.10'
Or you you prefer the shorter option:
compile group: 'commons-codec:commons-codec:1.10'
you need have changes,such as
dependencies {
implementation 'commons-codec:commons-codec:1.10'
}

Gradle DSL method not found: complie() only with jopendocument

I'm trying to use Gradle with this 'org.jopendocument:jOpenDocument:1.3b1' a obtain this Error:
this Gradle file (1) fail with this error:
Error:(21, 0) Gradle DSL method not found: 'complie()'
Possible causes:
The project '' may be using a version of Gradle that does not contain the method.
Open Gradle wrapper
file The build file may be missing a Gradle plugin.
Apply Gradle plugin
Gradle file (1)
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.11'
..//
compile 'org.mariadb.jdbc:mariadb-java-client:1.1.7'
complie 'org.jopendocument:jOpenDocument:1.3b1'
}
but add this one to test compile 'org.apache.felix:org.apache.felix.scr.annotations:1.9.12' and it works well
Gradle file (2)
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.11'
..//
compile 'org.mariadb.jdbc:mariadb-java-client:1.1.7'
//complie 'org.jopendocument:jOpenDocument:1.3b1'
compile 'org.apache.felix:org.apache.felix.scr.annotations:1.9.12'
}
but want to use complie 'org.jopendocument:jOpenDocument:1.3b1', does not work, I have dealt with:
'org.jopendocument:jOpenDocument:1.3b1'
'org.jopendocument:jOpenDocument:1.3'
'org.jopendocument:jOpenDocument:1.+'
'org.jopendocument:jOpenDocument:1.1'
but it does not work, someone can tell me if I'm doing something wrong
http://mvnrepository.com/artifact/org.jopendocument/jOpenDocument/1.3b1
http://repo.gradle.org/gradle/repo/org/jopendocument/jOpenDocument/1.3/
Seems like a typing mistake: you need compile, but not complie.
That line in first gradle file:
complie 'org.jopendocument:jOpenDocument:1.3b1'

Grails 3.1 and spring-security-core:3.0.3

When I try to use
grails s2-quickstart com.kanabang secUser secRole
it show the following in the console.
Error |
Error occurred running Grails CLI: Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed:
GStringTemplateScript1.groovy: -1: unable to resolve class org.springframework.beans.factory.annotation.Autowired
# line -1, column -1.
1 error
cannot create the bean.
my dependencies
dependencies {
compile "org.springframework.boot:spring-boot-starter-logging"
compile "org.springframework.boot:spring-boot-starter-actuator"
compile "org.springframework.boot:spring-boot-autoconfigure"
compile "org.springframework.boot:spring-boot-starter-tomcat"
compile "org.grails:grails-dependencies"
compile "org.grails:grails-web-boot"
compile "org.grails.plugins:hibernate"
compile "org.grails.plugins:cache"
compile "org.hibernate:hibernate-ehcache"
compile "org.grails.plugins:scaffolding"
compile 'org.grails.plugins:spring-security-core:3.0.3'
runtime "org.grails.plugins:asset-pipeline"
testCompile "org.grails:grails-plugin-testing"
testCompile "org.grails.plugins:geb"
// Note: It is recommended to update to a more robust driver (Chrome, Firefox etc.)
testRuntime 'org.seleniumhq.selenium:selenium-htmlunit-driver:2.44.0'
console "org.grails:grails-console"
}
Is it a bug or wrong config.?
note that:I am using intellij 15.
after some testing.
I try to use mingw64 to build the application.
It is successfully create the domain classes.
Before doing this. i need to add the grails_home in the path.
I thank this is the key point.

Categories