Using library with Google play service vision - codenameone

I am trying to add a library that uses google play service vision. My library works well on a native android project as long as I add the play service vision lib to the app. I have added the following build hints in a Codename One project:
With that build hint i have the following build error:
/tmp/build731648870085799025xxx/MyApplication/build/intermediates/res/merged/debug/values/values.xml:64: AAPT: Error retrieving parent for item: No resource found that matches the given name 'ThemeOverlay.AppCompat.Dark.ActionBar'.
/tmp/build731648870085799025xxx/MyApplication/build/intermediates/exploded-aar/materialbarcodescanner-release/res/values/values.xml:9:5-12:13: AAPT: No resource found that matches the given name: attr 'windowActionBar'.
/tmp/build731648870085799025xxx/MyApplication/build/intermediates/exploded-aar/materialbarcodescanner-release/res/values/values.xml:9:5-12:13: AAPT: No resource found that matches the given name: attr 'windowNoTitle'.
/tmp/build731648870085799025xxx/MyApplication/build/intermediates/res/merged/debug/values/values.xml:69: AAPT: Error retrieving parent for item: No resource found that matches the given name 'ThemeOverlay.AppCompat.Light'.
That issue is not related to the google play service lib: I have the same issue when I try to use a simple library that just uses a toastbar. Perhaps android studio generated some resources that can not be used in codename one ?
When I try to change the google play service version with the following build hint:
The google play service lib is not found anymore:
Could not find com.google.android.gms:play-services-vision:10.0.
Searched in the following locations:
https://jcenter.bintray.com/com/google/android/gms/play-services-vision/10.0/play-services-vision-10.0.pom
https://jcenter.bintray.com/com/google/android/gms/play-services-vision/10.0/play-services-vision-10.0.jar
file:/tmp/build3506878302752944909xxx/MyApplication/libs/play-services-vision-10.0.jar
file:/tmp/build3506878302752944909xxx/MyApplication/libs/play-services-vision.jar
file:/home/ec2-user/android-sdk/extras/android/m2repository/com/google/android/gms/play-services-vision/10.0/play-services-vision-10.0.pom
file:/home/ec2-user/android-sdk/extras/android/m2repository/com/google/android/gms/play-services-vision/10.0/play-services-vision-10.0.jar
file:/home/ec2-user/android-sdk/extras/google/m2repository/com/google/android/gms/play-services-vision/10.0/play-services-vision-10.0.pom
file:/home/ec2-user/android-sdk/extras/google/m2repository/com/google/android/gms/play-services-vision/10.0/play-services-vision-10.0.jar
Required by:
:MyApplication:unspecified
How can I change the google play service version and how can I add my libraries properly ?

Change the android.playServicesVersion to 10.0.0 or 10.0.1. Either of those should work.

Related

Codename One Recover Project

I am having an Android app that I developed in July 2019 using Eclipse (at least that is what the folder says).
Now I want to make some changes and tried to import and run the project with Eclipse.
But when trying to run the project, I get the following error messages:
These values are required!
userName - login information from codenameone.com
password - the password matching your login from codenameone.com
jarFile - the application jar file resulting from the build
ApplicationDisplayName - display name for the application in the UI
MainClassName - the name of the main class not including the package name
ApplicationPackageName - the package in which the main class resides, this will also be used to classify the application. It is recommended you give this some thought since package names are impossible to change later on some stores!
version - the version number for the application
There is some other strange behaviour, like the error:
The method getAllStyles() is undefined for the type Form
and no Simulator_Project.launch file ...
I have tried refreshing the libraries, but to no avail. Maybe there have changes been made to the build process ...
How can I run the project?

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.

Vespa Tutorial – HTTP API use-case fails to activate with IllegalArgumentException

I'm currently following the Vespa tutorials, and ran into an issue with the HTTP API use-case. Everything works fine from the mvn install package to the vespa-deploy prepare target/application.zip.
The call to vespa-deploy activate returns normally, but the application then never gets available on localhost:8080. Looking at /opt/vespa/logs/vespa/vespa.log (in the VM) one finds the following stack trace:
Container.com.yahoo.jdisc.core.StandaloneMain error Unexpected:
exception=
java.lang.IllegalArgumentException: Could not create a component with id 'com.mydomain.demo.DemoComponent'.
Tried to load class directly, since no bundle was found for spec: sample-app-http-api-searcher.
If a bundle with the same name is installed, there is a either a version mismatch or the installed bundle's version contains a qualifier string.
at com.yahoo.osgi.OsgiImpl.resolveFromClassPath(OsgiImpl.java:48)
...
This occurred using a fresh Docker image with a clean clone of the sample-apps git repository. Preparing and activating the basic sample as well as the other http example did work seamlessly.
I checked the sources and the xml files for obvious problems but don't have any clue about what is failing and where.
target/application.zip contains
application/components/http-api-using-searcher-1.0.1-deploy.jar
application/hosts.xml
application/searchdefinitions/basic.sd
application/services.xml
And the jar itself does contain a com/mydomain/demo/DemoComponent.class file (among other things).
Potentially related issue on the github tracker: https://github.com/vespa-engine/vespa/issues/3479 I'll be posting a link to this question there as well, but I still think it's worth a SO question, at least to get some action behind the vespa tag :)
The bundle id in the application's services.xml file was wrong. Please pull the application from git and try again now. See also PR: https://github.com/vespa-engine/sample-apps/pull/18
Brief explanation: The bundle id given in the bundle="<id>" declaration in services.xml must match the 'Bundle-SymbolicName' in the bundle's manifest. When the bundle has been built with the Vespa bundle-plugin, the symbolic name is by default the same as the project's artifactId. Hence, in most cases you just have to verify that the bundle id matches the artifactId.

Liferay 7 add salesforce jar library error

I am going to integrate salesforce library into liferay 7 mvc portlet, the following steps are what i did:
Add libraries to class path. In Eclipse, go to Project > Properties > Java Build Path > Libraries > Add External JARs, then add the sfdc-wsc JAR to this list
Add below line to build.gradle:
compile group: 'com.force.api', name: 'force-wsc', version: '40.1.1'
The java source code is ok until i use gradle build to build project, the following error occur:
error: package com.sforce.soap.enterprise does not exist import com.sforce.soap.enterprise.EnterpriseConnection;
error: package com.sforce.soap.enterprise does not exist import com.sforce.soap.enterprise.QueryResult;
error: package com.sforce.soap.enterprise does not exist import com.sforce.soap.enterprise.SaveResult;
I also set the bnd file as follow according to blog post of DAVID H NEBINGER: https://web.liferay.com/web/user.26526/blog/-/blogs/osgi-module-dependencies
But nothing is improved
Bundle-ClassPath:.,\lib/externalLib.jar
-includeresource:\
lib/externalLib.jar=externalLib.jar,\
lib/commons-lang.jar=commons-lang=[0-9]*.jar
Please give any suggestion to correct.
Thanks in advance
I recently developed such a solution, but I used a different approach. I've implemented an OSGi bundle that exports Salesforce's SOAP APIs. This way you can use Salesforce APIs in any other Liferay bundle.
On this Salesforce SOAP API Client OSGi Bundle repository you find the sources. The OSGi bundle is also available on Maven Central.
Once you install the Salesforce SOAP API Client OSGi bundle, you can use it in any other Liferay bundle, such as your MVC Portlet. This sample project Salesforce Liferay Gogo Shell Command Client implements a set of Gogo Shell commands that allow us to interact with the Salesforce CRM system.
In your particular case, if you want to include external libraries via Gradle, then you can declare your dependency through the key compileInclude.
dependencies {
compileOnly group: "org.osgi", name: "org.osgi.core", version: "6.0.0"
compileOnly group: "org.osgi", name: "org.osgi.service.component.annotations", version: "1.3.0"
compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "2.6.0"
compileOnly group: "org.apache.felix", name: "org.apache.felix.gogo.runtime", version: '1.0.6'
compileInclude group: 'org.fusesource.jansi', name: 'jansi', version: '1.16'
compileInclude 'de.vandermeer:asciitable:0.3.2'}
This way you do not have to do anything on the bnd file. The external jar, like magic will be placed inside your bundle and MANIFEST will be correct.
If you want generate your stubs then you go at Force.com Web Service Connector (WSC)

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