Problems building for iOS with parse4cn1

67 views
Skip to first unread message

moeyn...@gmail.com

unread,
Nov 14, 2015, 4:48:01 PM11/14/15
to CodenameOne Discussions
I am experiencing some problems building for iOS (Debug). Steps to reproduce:
* Create a new CN1 project. Send iOS build -> no errors.
* Drag parse4cn1.cn1lib into the lib folder -> iOS build fails with "java.lang.UnsupportedClassVersionError: com/moe/ibuddy2/iBuddyApplication : Unsupported major.minor version 52.0".
* Some googling reveals that this may mean that JDK 1.8 isn't supported. Therefore, I edit build.xml, replacing "1.8" with "1.7" everywhere. 
* When I send the iOS build now, the error message is "/var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build2564350766160402235xxx/dist/iBuddyApplication-src/com_parse4cn1_nativeinterface_Utils.m:3:9: fatal error: 'com_parse4cn1_ParsePush.h' file not found"

There are no problems running the simulator or building for Android.
Anybody had similar problems?


IDE: NetBeans
Desktop OS: Windows 7
Simulator
Device: iPhone 6

moeyn...@gmail.com

unread,
Nov 14, 2015, 5:13:29 PM11/14/15
to CodenameOne Discussions, moeyn...@gmail.com
EDIT: I just tried this on a Mac, with similar results. 

Shai Almog

unread,
Nov 14, 2015, 11:17:38 PM11/14/15
to CodenameOne Discussions, moeyn...@gmail.com
Don't replace 1.8 with 1.7 since we don't support 1.7. Only 1.5 and 1.8.
Its actually pretty challenging to change it so I would suggest creating a new project and unchecking Java 8 support if that's indeed unsupported.

FYI I worked with an older version of Parse that worked fine with 1.8 support so I have no idea what you are referring to.

The error you are seeing relates to the native code in parse which I haven't used yet, did you compile the cn1lib yourself? Did you use "refresh libs"?

moeyn...@gmail.com

unread,
Nov 15, 2015, 5:14:13 AM11/15/15
to CodenameOne Discussions, moeyn...@gmail.com
Thank you. I found an older version av parse4cn1 at https://github.com/shannah/cn1-social-network-parse, and the iOS build works fine when I use that version. There seems to be a problem with the lib foudn at https://github.com/sidiabale/parse4cn1.

One more question: Is there a bug in the NetBeans plugin? If i create a new CN1 project and open the Codename One Designer, it doesn't open theme.res, but always comes up with "untitled" in the title bar and events disabled for all components. If so, is there a way around it? Some entry in a config file, perhaps?

Regards, Yngve Moe

sidiabale

unread,
Nov 15, 2015, 12:51:13 PM11/15/15
to CodenameOne Discussions, moeyn...@gmail.com
Hi,

I was just able to reproduce the "'com_parse4cn1_ParsePush.h' file not found" problem after creating a new project and adding the latest version of parse4cn1 to it. I'm not sure yet what's causing it but I'm investigating. In the meantime, I suggest you revert to an earlier release (v1.1) in that way, you're sure you're working with a well-defined version. The releases can be found at: https://github.com/sidiabale/parse4cn1/releases

Yngve Moe

unread,
Nov 15, 2015, 1:27:35 PM11/15/15
to sidiabale, CodenameOne Discussions
Ok, thank you very much.

sidiabale

unread,
Nov 15, 2015, 1:40:33 PM11/15/15
to CodenameOne Discussions, moeyn...@gmail.com
Hi Shai, Steve Hannah,

I've figured out what's happening but I'm not sure how to fix it. Perhaps you can help?  

When I look at the error log, it seems that it's a build order issue. com_parse4cn1_nativeinterface_Utils.m is an iOS native helper module contained in parse4cn1/native/ios. It imports "com_parse4cn1_ParsePush.h" which is contained in parse4cn1's sources (parse4cn1/src/com/parse4cn1). However, at the time com_parse4cn1_nativeinterface_Utils.m is being compiled, ParsePush has not yet been compiled yet, hence the file not found error.

Do you know any way, if possible to force compilation of parse4cn1's src directory before compiling the files in /native/ios? I expect that to solve the problem but I'm not sure if it's possible and/or how to achieve that.

sidiabale

unread,
Nov 15, 2015, 1:43:44 PM11/15/15
to CodenameOne Discussions, moeyn...@gmail.com
Here's a screenshot of parse4cn1.cn1lib expanded in Netbeans. It should the dependencies I described in text in my previous post
parse4cn1.cn1lib build error.png

Shai Almog

unread,
Nov 15, 2015, 10:20:02 PM11/15/15
to CodenameOne Discussions, moeyn...@gmail.com
Hi,
I doubt that's the issue. These error logs are notoriously hard to read and somewhat confusing. Can you please attach the error log here?

sidiabale

unread,
Nov 16, 2015, 6:26:07 AM11/16/15
to CodenameOne Discussions, moeyn...@gmail.com
Hi,

The error log is attached.
a353848f-15c0-42e6-a90a-891a6dc2217b-1447609314598-error.txt

Shai Almog

unread,
Nov 16, 2015, 11:29:42 PM11/16/15
to CodenameOne Discussions, moeyn...@gmail.com
Hi,
not 100% sure about this but I think the problem is that you use #import instead of #include.
Our headers are C not Objective-C so you might be running into oddities of the import statement.

sidiabale

unread,
Nov 17, 2015, 4:29:32 AM11/17/15
to CodenameOne Discussions, moeyn...@gmail.com
Hi, 

Unfortunately that doesn't help: The problem persists after changing #import to #include (see attached log).

Any other ideas?
bb08b25a-abc2-489e-84a1-d8cda837711f-1447751562045-error.txt

sidiabale

unread,
Nov 17, 2015, 5:57:38 AM11/17/15
to CodenameOne Discussions, moeyn...@gmail.com
BTW, the parse4cn1 TestApp successfully compiles (which is why I didn't notice this problem earlier during release testing). The only difference is that parse4cn1.cn1lib is compiled as part of the build process of the TestApp. However, since the build log is not posted on successful builds, I cannot compare the logs. 

I also tried compiling the test app with the released version of parse4cn1.cn1lib and that also worked. So it's really confusing to me why the error occurs when I use the same cn1lib in a new project.

Shai Almog

unread,
Nov 17, 2015, 10:58:36 PM11/17/15
to CodenameOne Discussions, moeyn...@gmail.com
I think I understand the issue which is odd.
Our VM strips away unused classes/methods to reduce size. Its supposed to detect usage from native code (in Parser.java line 422) and prevent this code from being stripped.

I have no idea why this isn't working...

As a workaround just implement the interface in one of your core classes that won't be stripped away. This will prevent it from being removed by the optimizer.

sidiabale

unread,
Nov 18, 2015, 7:17:29 AM11/18/15
to CodenameOne Discussions, moeyn...@gmail.com
Hi,

That was exactly the problem! I've implemented a workaround and created a new release: https://github.com/sidiabale/parse4cn1/releases/tag/parse4cn1-2.0.1

@Yngve: Can you please try using the latest release and let me know if you still face problems? If not, please mark this thread as solved.

Chidiebere Okwudire

unread,
Nov 21, 2015, 6:07:08 PM11/21/15
to codenameone...@googlegroups.com


On 20 Nov 2015 7:29 pm, "Yngve Moe" wrote:
>
> Hi,
> I can now build it for iOS without problems, so the problem is solved. Thank you all!
>
>
> 2015-11-19 10:25 GMT+01:00 Chidiebere Okwudire:
>>
>> Hi,
>>
>> Were you able to try? Did it work (using both the version with Push Notification support and the version without)?
>>
>> On Wed, Nov 18, 2015 at 3:15 PM, Yngve Moe wrote:
>>>
>>> Ok, I will try it out tonight.

Reply all
Reply to author
Forward
0 new messages