Error in building MM2 using phonegap build

Error in building MM2 using phonegap build

by ariyan eghbal -
Number of replies: 8

Hi  

I'm trying to create a custom app from MM2 based on this presentation from Juan Leyva:

https://docs.google.com/presentation/d/1HX5h7zwtay4amaY3qyLuCLfI7kQCiD9IoWuDH-lSa_0/edit#slide=id.ga20278994_0_101


I customized and was able to successfully run emulation using ionic

But when I try to build my android version using phonegap build I get these errors

   > Could not find com.android.support:support-v4:23.4.0.

....

   > Could not find com.android.support:support-v4:23.4.0.

....

   > Could not find com.android.support:support-v4:23.4.0.


The complete error log is attached


What is the problem?  

How can i build my app?


Thanks

Average of ratings: -
In reply to ariyan eghbal

Re: Error in building MM2 using phonegap build

by Dani Palou -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Hi Ariyan,

are you using the config.xml we use in our phonegap build version? It has several differences with the config.xml for building it with Ionic CLI.

https://github.com/moodlehq/moodlemobile-phonegapbuild/blob/master/config.xml

Kind regards,

Dani

In reply to Dani Palou

Re: Error in building MM2 using phonegap build

by ariyan eghbal -
Yes I'm using the phonegap version of config.xml as presentation said from here:

https://github.com/moodlehq/moodlemobile-phonegapbuild/blob/master/config.xml


Surprisingly today I tried again and without any change in code this time it compiled !!!!!

But Now my css and language config are not correct! while in emulator they are correct in built version 

  1. the language is always english while I changed it to "fa" 
  2.  application Icon is not recognized!!!!! 
  3. my css are semi (!) affected! some are there and some not!


I attached my config.json and config.xml 

In reply to ariyan eghbal

Re: Error in building MM2 using phonegap build

by Dani Palou -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Hi again,

I'm glad it builds now.

About 1 and 3, please make sure you've run "gulp" and then copied the build files to your phonegap build repository. Also, about the language, make sure that you haven't selected English in the app preferences.

About 2, did you copy the "resources" folder into your www folder in the phonegap build repository?

Kind regards,

Dani


In reply to Dani Palou

Re: Error in building MM2 using phonegap build

by ariyan eghbal -

Hi

Thank you very much; all problems solved except the language problem; 

Actually I have this in config.json: 

    "languages": {"fa": "فارسی","en":"english"},

    "default_lang" : "fa",


when I Install app I expect that I see "fa" lang but I'm seeing "en" !!!! 

I need to login and change it to "fa" in app settings

I mean the "default_lang" is ignored!

Why?

In reply to ariyan eghbal

Re: Error in building MM2 using phonegap build

by Dani Palou -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Hi ariyan,

the process of determining the language to use is the following:

  1. Use language defined by the user in App Settings.
  2. If not defined, use device language.
  3. If cannot determine device language, use default_lang.

I guess your problem comes from point 2, which language are you using in your device?

Also, you might want to change this variable:

https://github.com/moodlehq/moodlemobile2/blob/master/www/core/lib/lang.js#L27

Kind regards,

Dani

In reply to Dani Palou

Re: Error in building MM2 using phonegap build

by ariyan eghbal -

Hi Daniel

Thank you very much

Yes you're right that second point was the problem

I changed line 28 core/lib/lang.js from

currentLanguage;

to:

currentLanguage = 'fa';

now it uses "fa" 


but Isn't it better to prioritize default_lang to device lang? and add the fallback lang as a setting so app can use these in order:

  1. setting lang
  2. default lang
  3. device lang
  4. config fallback lang
  5. hard-coded fallback lang

So if I think my app must show in only one language I can use it independent of device lang


Anyway thank you very much for helping me

In reply to ariyan eghbal

Re: Error in building MM2 using phonegap build

by Dani Palou -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Hi Ariyan,

I'm not sure about iOS, but in Android it's pretty common to use the device language instead of using a fixed language. In fact, in Android native apps it wasn't easy to use a different language than the device one, Google want apps to use the device language.

A user should have the device configured to use the language he's more comfortable with, and so we should try to use that language too. If you want to force a certain language in your custom app you can just change the order of the calls smile

Kind regards,

Dani

In reply to Dani Palou

Re: Error in building MM2 using phonegap build

by ariyan eghbal -

Hi Dani

Thank you very much for your help and your useful informations both; 

Best regards