"cannot find symbol method setBatchPath(String)" in the generated source from generated endpoint - google-app-engine

For an unknown reason, when I tried to build my Google App Engine endpoints, I get these errors in all of the API java files generated by Android Studio:
Error:(400, 5) error: method does not override or implement a method from a supertype
Error:(402, 29) error: cannot find symbol method setBatchPath(String)
I did some initial troubleshooting and found out that there's a Builder class inside the java file and it extends AbstractGoogleJsonClient.Builder. I looked at the source for the Builder class and I cannot find the method.
Why all of the sudden am I getting these errors? Help!

Same thing happened to me this morning.
I resolved it by adding this in my backend project
appengine {
endpoints {
googleClientVersion = '1.23.0'
}
}
and updating this version in my app gradle file.
implementation('com.google.api-client:google-api-client-android:1.23.0')

Faced the same problem. I upgraded google client libs to 1.23.0 and it worked (earlier was 1.22.0)
compile 'com.google.api-client:google-api-client:1.23.0'
compile 'com.google.http-client:google-http-client-android:1.23.0'

We already had these in our backend build.gradle:
dependencies {
compile 'com.google.api-client:google-api-client:+'
compile 'com.google.api-client:google-api-client-android:+'
compile 'com.google.http-client:google-http-client:+'
compile 'com.google.http-client:google-http-client-android:+'
}
All we needed was adding:
appengine {
endpoints {
googleClientVersion = '1.23.0'
}
}
But it'd have been nice if Google didn't break our codes every once in awhile out of the blue and wasting hours of development time!

Related

Observing error while running Gatling project 'object gatling is not a member of package io'

I m seeing the following error while running Engine.scala
object gatling is not a member of package io import io.gatling.app.Gatling
Below is the code that is used
`import io.gatling.app.Gatling
import io.gatling.core.config.GatlingPropertiesBuilder
object Engine extends App {
val props = new GatlingPropertiesBuilder()
.resourcesDirectory(IDEPathHelper.mavenResourcesDirectory.toString)
.resultsDirectory(IDEPathHelper.resultsDirectory.toString)
.binariesDirectory(IDEPathHelper.mavenBinariesDirectory.toString)
Gatling.fromMap(props.build)
}`
I tried changing the Gatling version in mvn file, but no luck. could someone please help
It means the Gatling jars are not properly imported in your classpath.
No idea how to help you though as you're not describing exactly what you're doing and how you're getting this error: when running maven from the command line? when running from IntelliJ? or another IDE?
Note: if you're struggling with properly setting up a development environment for Scala, you should probably consider using Gatling with Java instead, where the set up is way more simple.

Android builds failing with compilation errors

Im trying to build my app for android. It is setup for notifications. If I build with version 3.4 it gets the following error:
/tmp/x/WordTime1/src/main/java/com/codename1/impl/android/AndroidImplementation.java:4576: error: cannot find symbol
notification.setLatestEventInfo(activity, contentTitle, contentBody, contentIntent);
^
symbol: method
setLatestEventInfo(Activity,String,String,PendingIntent)
location: variable notification of type Notification
/tmp/x/WordTime1/src/main/java/com/codename1/impl/android/PushNotificationService.java:110: error: cannot find symbol
notif.setLatestEventInfo(this, value, "", contentIntent);
^
symbol: method setLatestEventInfo(PushNotificationService,String,String,PendingIntent)
location: variable notif of type Notification
If I build with latest, it gets this error:
/tmp/x/WordTime1/src/main/java/com/codename1/social/GoogleImpl.java:112: error: cannot find symbol
GoogleSignInAccount acct = result.getSignInAccount();
and many more from the com/codename1/social package.
Thank you
Sam
You should build with the latest as 3.4 is ancient by now (we are past 3.8).
The problem with the Google Signin relates to the old Google Plus login support which Google removed. You need to remove the build hints related to that and switch to the new Google Login functionality mentioned in the developer guide.
I mentioned the problems with the Google Connect switch in the blog a while back.

Angular Dart with Polymer and Service-Worker incompatibilty

I'm currently trying to build a web app compatible with the Google Progressive Web Apps specs. To do this i use Angular with Dart and Polymer based Webcomponents instead of the Angular components. So far everything works as expected. To make the app offline capable utilizing the Service-Worker API i use the following dart lib: https://github.com/isoos/service_worker
Using either Polymer or Service-Worker works fine but combining booth just exits with an error on app startup.
This is my AppComponent startup routine:
// ... other imports
import 'package:service_worker/window.dart' as sw; // <-- import alone causes the error
Future main() async {
await initPolymer(); // <-- causes the error in combination with the import above
bootstrap(AppComponent);
if (sw.isNotSupported) {
print('ServiceWorkers are not supported.');
return;
}
//... initializing service worker
}
The error occurs even if i'm not initializing the Service-Worker, importing the Service-Worker module is enough to cause the error.
Building the app works without any errors.
I'm new to Dart and the Polymer and Angular eco systems and the error message i get is not very helpful to me:
Uncaught Error: NoSuchMethodError: method not found: js_helper.dart:1742 'h' (J.Q(...).h is not a function)
at Object.J.H (http://127.0.0.1:8080/index.bootstrap.initialize.dart.js:9747:15)
at http://127.0.0.1:8080/index.bootstrap.initialize.dart.js:10559:1584
at Isolate.e.(anonymous function) (http://127.0.0.1:8080/index.bootstrap.initialize.dart.js:10608:15)
at Object.yK (http://127.0.0.1:8080/index.bootstrap.initialize.dart.js:9291:22)
at http://127.0.0.1:8080/index.bootstrap.initialize.dart.js:9282:10
at yM.a (http://127.0.0.1:8080/index.bootstrap.initialize.dart.js:2612:72)
at yM.dart.yM.$2 (http://127.0.0.1:8080/index.bootstrap.initialize.dart.js:2828:24)
at y9.dart.y9.$1 (http://127.0.0.1:8080/index.bootstrap.initialize.dart.js:2824:31)
at xM.bi (http://127.0.0.1:8080/index.bootstrap.initialize.dart.js:3767:40)
at xk.$0 (http://127.0.0.1:8080/index.bootstrap.initialize.dart.js:3167:16)
Can you give me a hint what could cause the error and how to fix it? I would very much like to use the Polymer components instead of the plain Angular components but i need the Service-Worker for offline caching support.
This looks like an issue caused by incompatibility between dart:js (the old style, used by the original polymer package) and package:js (the new style, used by all new packages, including package:service_worker).
You might want to have a look at the polymerize project, which brings Polymer via the new-style interop. Then you'll have no conflict.

appengine error - java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessClassInPackage.com.sun.org.apache.xerces

I re-deployed my app (google appengine), it seems to be working fine, but when I try to parse Xml I get:
java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessClassInPackage.com.sun.org.apache.xerces.internal.parsers")
what does it mean? and how I can solve it?
on previous version of the app I didn't got this error.
when running the app locally I don't get this error.
I made minor changes - I pass some data from the UI to the datastore
Here is the code that parse the XML:
public static <T extends BaseDataObject> T xml2Bean(Class<T> clazz,
String xmlData) throws UnsupportedEncodingException, JAXBException {
Reader reader = new StringReader(xmlData);
JAXBContext context = getContext(clazz);
Unmarshaller um = context.createUnmarshaller();
return (T) um.unmarshal(reader);
}
My guess is that Google use to support com.sun.org.apache.xerces.internal.parsers but now they don't, and my old code still working because it was pushed when it was still supported...
how can I verify this guess? i.e. where can I find the list of unsupported packages?
I'm thinking of dropping the XML code and use json instead, how can I make sure json is supported?
Problem was solved: I've downloaded xerces and added the jars to war\WEB-INF\lib and to the build path in eclipse.
I also upgrade to the latest JDK (java 7).
I'm not sure which of those solved the problem...
Something in your code or a dependency of your code, is trying to refer to the package com.sun.org.apache.xerces.internal.parsers, which is not allowed on GAE. Just a guess: maybe a dependency has been upgraded and this dependency is trying to access that package.

jTwitter, oAuth, and Google App Engine. NoClassDefFoundError

I'm trying to use jTwitter to get an oauth instance to twitter with my consumer key/secret and access token/secret. This is well documented in the javadoc here. I have downloaded signpost, signpost-jetty, and the jtwitter library, but after deploying and running the servlet, I get a error java.lang.NoClassDefFoundError: winterwell/jtwitter/OAuthSignpostClient Eclipse isn't complaining about the class not being there, because it is there-- I can see it in the JAR file itself, which is in my project. So, I said forget it, I'll try out OAuthScribeClient instead, but this generated a VERY SIMILAR ERROR java.lang.NoClassDefFoundError: org/scribe/oauth/Token This one confuses me even further because I have the following code in my java file, and it compiles without error or warning:
import org.scribe.oauth.Token;
Token token = new Token("myaccesstokeninfo", "accesstokensecret");
Clearly, I'm missing something very fundamental, but I am at an absolute loss as to what it may be. Thanks.
Usually "NoClassDefFoundError" happens when you forget to copy all jar-files to your "/war/WEB-INF/lib" directory, so those libs will be unavailable from server-side.
Xo4yHaMope is probably right.
If you're working from Eclipse but running using a web container, then your runtime classpath might be different from your project classpath - which can cause this error.
In order to complete Ben Winters answer what I actually did and worked is add the jar in
the libs folder within the project
see also here about folder hierarchy.
When you do this eclipse will normally add the jar to the android dependencies before launching the application. What I realise is that adding a jar in the build path will make classes available only during the build

Resources