Vikash
Vikash

Reputation: 109

Do we need to upload cordova_plugin.js to phonegap build server?

I am very new to Phonegap. I am trying to build an application which require InApBrowser plugin.

I know we should not upload cordova.js to PhoneGap Build server but I am not sure if we need to upload cordova_plugin.js to build server. I am asking this question because when I download the .ipa package and install it in iPhone and debug the application it says

cordova_plugin.js not found.

I am using cordova 3.6.3.

index.html

<body>
    <p>Hello, your application is ready!</p>

    <!-- Cordova reference, this is added to your app when it's built. -->
    <script src="cordova.js"></script>
    <script src="scripts/platformOverrides.js"></script>

    <script src="scripts/index.js"></script>
</body>

config.xml

<?xml version="1.0" encoding="utf-8"?>
<widget xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:vs="http://schemas.microsoft.com/appx/2014/htmlapps" id="io.cordova.Plugintest" version="1.0.0.0" xmlns="http://www.w3.org/ns/widgets">
  <name>Plugin_test</name>
  <description>
    A blank project.
  </description>
  <author href="http://cordova.io" email="[email protected]">
    Apache Cordova Team
  </author>
  <content src="index.html" />
  <access origin="*" />
  <preference name="SplashScreen" value="screen" />
  <vs:features>
    <vs:feature>[email protected]</vs:feature>
    <vs:feature>[email protected]</vs:feature>
  </vs:features>
  <vs:platformSpecificValues />
</widget>

But still it is not working in iphone Can anyone please help me on this?

Upvotes: 3

Views: 9055

Answers (1)

Roope Hakulinen
Roope Hakulinen

Reputation: 7405

No, you do not need to include cordova_plugin.js to PhoneGap Build. In case of InAppBrowser, what you need to do is to include

<gap:plugin name="org.apache.cordova.inappbrowser" version="0.5.2" />

into your config.xml. After that PhoneGap Build will take care of injecting all the necessary JavaScript files for you. You don't either need to do something like

<script type="text/javascript" src="cordova_plugin.js"></script>

this in your app since PGB will handle it for you. That is one of the major benefits of using PGB.

Update

Here is example config.xml from one of my projects

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.example.com" version="0.0.1"
    xmlns="http://www.w3.org/ns/widgets"
    xmlns:cdv="http://cordova.apache.org/ns/1.0"
    xmlns:gap="http://phonegap.com/ns/1.0"
    xmlns:android="http://schemas.android.com/apk/res/android">
  <name>Plugin_test</name>
  <description>
    A blank project.
  </description>
  <author href="http://cordova.io" email="[email protected]">
    Apache Cordova Team
  </author>
  <content src="index.html"/>
  <access origin="*"/>

  <!-- PhoneGap plugins for PhoneGap Build to attach to build -->
  <gap:plugin name="org.apache.cordova.device" version="0.2.12" source="pgb" />
  <gap:plugin name="org.apache.cordova.inappbrowser" version="0.5.2" source="pgb" />
  <gap:plugin name="org.apache.cordova.splashscreen" version="0.3.4" source="pgb" />

  <!-- Use the newest version of PhoneGap -->
  <preference name="phonegap-version" value="3.6.3" />

  <!-- Device permission is needed -->
  <feature name="http://api.phonegap.com/1.0/device"/>

  <!-- Splash icon is on same directory as this file -->
  <gap:splash src="splash.png" />
</widget>

I left only the details you might need there such as plugins (splash, device and InAppBrowser) and permissions you are using Also move the config.xml under www folder, if not there already

Upvotes: 5

Related Questions