Fórum

Liferay Mobile SDK build issue for custom service

thumbnail
Harish Kumar, modificado 8 Anos atrás.

Liferay Mobile SDK build issue for custom service

Expert Postagens: 483 Data de Entrada: 31/07/10 Postagens Recentes
Hi,

We are using liferay-mobile-sdk-master to build custom services for android and iOS. Everything was working fine but starting today we are facing issues while building services. We are getting following errors -

F:\liferay-mobile-sdk-master>gradlew.bat createModule -P=all

FAILURE: Build failed with an exception.

* Where:
Script 'https://raw.githubusercontent.com/brunofarache/liferay-mobile-sdk/master/sdk-builder.gradle' line: 20

* What went wrong:
A problem occurred evaluating script.
> Could not find property 'contexts' on task ':modules/sync-web:generate'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 5.331 secs


I checked the https://dev.liferay.com/develop/tutorials/-/knowledge_base/6-2/building-mobile-sdks documentation for any changes and found that
instead of liferay-mobile-sdk-master there are separate SDKs for android and iOS. Both have different versions available. iOS mobile sdk seems bit ahead of android sdk.

I downloaded liferay-mobile-sdk-android-7.0.1and tried to build custom service as earlier. this time service build was successful but I could not found my custom services in generated code but out of box services is there. I also tried latest download of https://github.com/liferay/liferay-mobile-sdk and build services. Same issue - our custom services was not there in generated code. So I have following queries regarding the same

1. Do we need to use separate mobile sdk for android and iOS ?
2. Portal Version [7]: what should be value for liferay 6.2 ? Is it 62 or 6.
3. Why our custom services are not there in generated code if we use liferay-mobile-sdk-android-7.0.1.

Its a bit urgent as we are unable to build services and its a blocker for us.
Thanks in advance

Regards,
Harish

https://github.com/liferay/liferay-mobile-sdk
thumbnail
Bruno Farache, modificado 8 Anos atrás.

RE: Liferay Mobile SDK build issue for custom service

Liferay Master Postagens: 603 Data de Entrada: 14/05/07 Postagens Recentes
Hi Harish,

For the SDK Builder, do not use master, it's unstable, use a stable release instead. The latest one is tagged:
https://github.com/liferay/liferay-mobile-sdk/releases/tag/builder-6.2.0.16
thumbnail
Harish Kumar, modificado 8 Anos atrás.

RE: Liferay Mobile SDK build issue for custom service

Expert Postagens: 483 Data de Entrada: 31/07/10 Postagens Recentes
Hi Bruno,

I tried this also. Following are the errors


C:\Users\harish\Downloads\liferay-mobile-sdk-builder-6.2.0.16>gradlew createModule -P=all

FAILURE: Build failed with an exception.

* Where:
Script 'https://raw.githubusercontent.com/brunofarache/liferay-mobile-sdk/master/sdk-builder.gradle' line: 20

* What went wrong:
A problem occurred evaluating script.
> Could not find property 'contexts' on task ':modules/sync-web:generate'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 21.216 secs



Regards,
Harish
thumbnail
Bruno Farache, modificado 8 Anos atrás.

RE: Liferay Mobile SDK build issue for custom service (Resposta)

Liferay Master Postagens: 603 Data de Entrada: 14/05/07 Postagens Recentes
Hi Harish,

I'm sorry about that, I just fixed it, here's the new tag:

https://github.com/liferay/liferay-mobile-sdk/releases/tag/builder-6.2.0.17

We will fix the documentation as well and specify you must avoid using master.

Thanks!
thumbnail
Harish Kumar, modificado 8 Anos atrás.

RE: Liferay Mobile SDK build issue for custom service

Expert Postagens: 483 Data de Entrada: 31/07/10 Postagens Recentes
Hi Bruno,

Thanks for your response. The new tag worked just fine for me.
thanks again..

Regards,
Harish
thumbnail
Genar Codina, modificado 7 Anos atrás.

RE: Liferay Mobile SDK build issue for custom service

Junior Member Postagens: 28 Data de Entrada: 18/04/16 Postagens Recentes
Hello,
I have experienced a similar issue when I try to execute the command "./gradlew createModule" in my Mac; that is:
1) I have downloaded the version "liferay-mobile-sdk-builder-6.2.0.17" (the .zip file) from:
https://github.com/liferay/liferay-mobile-sdk/releases/tag/builder-6.2.0.17
Note: I have also tried to download the project via github but I could not get it successfully.
2) After unzipping it, I have edited the gradle.properties and I have changed the "url" property to point to my liferay portal
3) Then I have executed ./gradlew createModule -P=all

The problem is that a JSONException appears in the process of generating the custom web services:
Here you are the full information:

DTI-GCODINAs-iMac:liferay-mobile-sdk-builder-6.2.0.17 DTI-GCODINA$ cat gradle.properties 
##
## SDK Builder
##

	platforms=android,ios
	url=http://cmes.sapbo.test
	context=
	filter=
	packageName=com.liferay.mobile.android
	destination=
	portalVersion=62

##
## Build
##

	description=
	group=com.liferay.mobile
	version=1.0
DTI-GCODINAs-iMac:liferay-mobile-sdk-builder-6.2.0.17 DTI-GCODINA$ ./gradlew createModule -P=all
> Building 0% > :createModule
Context: holidays-portlet
Platforms [android,ios]: 
Server URL [http://cmes.sapbo.test]: 
Filter: 
Portal Version [62]: 
Module Version [1.0]: 1.0.0
Package Name [com.liferay.mobile.android]:   
POM Description: Liferay Holidays SDK
:createModule
Module was successfully created at /Users/DTI-GCODINA/Develop/liferay-mobile-sdk-builder-6.2.0.17/modules/holidays-portlet/.
SDK Builder will generate now all services with the details you provided.
:generate
May 04, 2016 11:43:36 AM com.liferay.mobile.sdk.SDKBuilder main
SEVERE: org.json.JSONException: A JSONObject text must begin with '{' at 57 [character 3 line 55]
java.io.IOException: org.json.JSONException: A JSONObject text must begin with '{' at 57 [character 3 line 55]
	at com.liferay.mobile.sdk.http.DiscoveryResponseHandler.handleResponse(DiscoveryResponseHandler.java:39)
	at com.liferay.mobile.sdk.http.DiscoveryResponseHandler.handleResponse(DiscoveryResponseHandler.java:27)
	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:1142)
	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:1076)
	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:1050)
	at com.liferay.mobile.sdk.SDKBuilder.discover(SDKBuilder.java:118)
	at com.liferay.mobile.sdk.SDKBuilder.build(SDKBuilder.java:73)
	at com.liferay.mobile.sdk.SDKBuilder.main(SDKBuilder.java:53)
Caused by: org.json.JSONException: A JSONObject text must begin with '{' at 57 [character 3 line 55]
	at org.json.JSONTokener.syntaxError(JSONTokener.java:433)
	at org.json.JSONObject.<init>(JSONObject.java:194)
	at org.json.JSONObject.<init>(JSONObject.java:321)
	at com.liferay.mobile.sdk.http.Discovery.<init>(Discovery.java:31)
	at com.liferay.mobile.sdk.http.DiscoveryResponseHandler.handleResponse(DiscoveryResponseHandler.java:36)
	... 7 more


BUILD SUCCESSFUL

Total time: 1 mins 10.876 secs
DTI-GCODINAs-iMac:liferay-mobile-sdk-builder-6.2.0.17 DTI-GCODINA$ 
DTI-GCODINAs-iMac:liferay-mobile-sdk-builder-6.2.0.17 DTI-GCODINA$ pwd
/Users/DTI-GCODINA/Develop/liferay-mobile-sdk-builder-6.2.0.17
DTI-GCODINAs-iMac:liferay-mobile-sdk-builder-6.2.0.17 DTI-GCODINA$ cd modules
DTI-GCODINAs-iMac:modules DTI-GCODINA$ ls
holidays-portlet	sync-web
DTI-GCODINAs-iMac:modules DTI-GCODINA$ cd holidays-portlet/
DTI-GCODINAs-iMac:holidays-portlet DTI-GCODINA$ ls
gradle.properties</init></init></init>
thumbnail
Bruno Farache, modificado 7 Anos atrás.

RE: Liferay Mobile SDK build issue for custom service

Liferay Master Postagens: 603 Data de Entrada: 14/05/07 Postagens Recentes
Hi Genar,

I'm not sure why you think your error is related to this thread, the exception you are getting is completely different.

The SDK Builder tries to reach this URL:
http://cmes.sapbo.test/api/jsonws?discover

If this page is not accessible from your computer or is not printing a JSON response, the SDK won't be able to access as well.
thumbnail
Genar Codina, modificado 7 Anos atrás.

RE: Liferay Mobile SDK build issue for custom service

Junior Member Postagens: 28 Data de Entrada: 18/04/16 Postagens Recentes
Hi Bruno,

Yes, your are right, perhaps I should have to create a new issue; sorry for that.
I have checked that I have been able to reach the following URL:
http://cmes.sapbo.test/api/jsonws?discover
I have to admit that it is difficult to discover the problem only from the information I have posted.
I do not know if the following measure could be helpful in case someone would like to reproduce the problem:
I have put my test environment in a public IP address and I have checked that I could access the following URL:
http://cmes.sapbo.test/api/jsonws?discover
from a 3G connection using my mobile (that is; it is really public)
And the content of the /etc/hosts file in my Mac is:
# Development machine
212.36.85.172 cmes.sapbo.test

And after setting the gradle.properties file as:
##
## SDK Builder
##

        platforms=android,ios
        url=http://cmes.sapbo.test
        context=
        filter=
        packageName=com.liferay.mobile.android
        destination=
        portalVersion=62

##
## Build
##

        description=
        group=com.liferay.mobile
        version=1.0

I have executed:

DTI-GCODINAs-iMac:liferay-mobile-sdk-builder-6.2.0.17 DTI-GCODINA$ ./gradlew createModule -P=all
&gt; Building 0% &gt; :createModule
Context: holidays-prototype
Platforms [android,ios]: 
Server URL [http://cmes.sapbo.test]: 
Filter: 
Portal Version [62]: 
Module Version [1.0]: 
Package Name [com.liferay.mobile.android]: com.liferay.mobile.holidays.android
POM Description: Liferay Holidays SDK
:createModule
Module was successfully created at /Users/DTI-GCODINA/Develop/liferay-mobile-sdk-builder-6.2.0.17/modules/holidays-prototype/.
SDK Builder will generate now all services with the details you provided.
:generate
May 05, 2016 4:00:59 PM com.liferay.mobile.sdk.SDKBuilder main
SEVERE: org.json.JSONException: A JSONObject text must begin with '{' at 57 [character 3 line 55]
java.io.IOException: org.json.JSONException: A JSONObject text must begin with '{' at 57 [character 3 line 55]
	at com.liferay.mobile.sdk.http.DiscoveryResponseHandler.handleResponse(DiscoveryResponseHandler.java:39)
	at com.liferay.mobile.sdk.http.DiscoveryResponseHandler.handleResponse(DiscoveryResponseHandler.java:27)
	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:1142)
	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:1076)
	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:1050)
	at com.liferay.mobile.sdk.SDKBuilder.discover(SDKBuilder.java:118)
	at com.liferay.mobile.sdk.SDKBuilder.build(SDKBuilder.java:73)
	at com.liferay.mobile.sdk.SDKBuilder.main(SDKBuilder.java:53)
Caused by: org.json.JSONException: A JSONObject text must begin with '{' at 57 [character 3 line 55]
	at org.json.JSONTokener.syntaxError(JSONTokener.java:433)
	at org.json.JSONObject.<init>(JSONObject.java:194)
	at org.json.JSONObject.<init>(JSONObject.java:321)
	at com.liferay.mobile.sdk.http.Discovery.<init>(Discovery.java:31)
	at com.liferay.mobile.sdk.http.DiscoveryResponseHandler.handleResponse(DiscoveryResponseHandler.java:36)
	... 7 more


BUILD SUCCESSFUL

Total time: 4 mins 44.927 secs</init></init></init>


Thanks in advance,
thumbnail
Bruno Farache, modificado 7 Anos atrás.

RE: Liferay Mobile SDK build issue for custom service

Liferay Master Postagens: 603 Data de Entrada: 14/05/07 Postagens Recentes
Genar,

I've checked it out and, like you said, it's accessible:
http://212.36.85.172/api/jsonws

However, if you look at the "Ruta de contexto" select box, you won't see your holidays-prototype portlet, which means either your portlet is not properly deployed to this server or the remote services weren't correctly generated with "ant build-wsdd" as described in the documentation.
thumbnail
Genar Codina, modificado 7 Anos atrás.

RE: Liferay Mobile SDK build issue for custom service

Junior Member Postagens: 28 Data de Entrada: 18/04/16 Postagens Recentes
Thanks Bruno. You are right, I was pointing to a non-existing "point" and that caused the JSONException. Sorry for that.