Hello World on PhoneGap Build

2019-09-11 11:29发布

I am trying to do Hello World (for Android only) at https://build.phonegap.com/apps/.

I created a directory. Named it www. Added the following index.html. Zipped it. Then uploaded it to https://build.phonegap.com/apps/ hoping to get back an .apk file.

index.html
<!doctype html>
<html>
<head>
  <title>PG Test</title>
</head>
<body> Hello World </body>
</html>

Instead, all I got was this error message.

Error
Error - Some official plugins have to be updated if using
PhoneGap >= 4.0.0. Please upgrade the version of any
plugins that may include the following file:
FileTransfer.java - You can fix this here.

The "here" link in the above error message takes you here: http://plugins.cordova.io/npm/index.html. Where it says "Page not found."

Question

Please supply the necessary source code for Phone Gap Build to generate an .apk file for Android.

5条回答
相关推荐>>
4楼-- · 2019-09-11 12:09

Delete and restart instead of update code

My solution was to delete my existing app (instead of "update code"). Apparently, there was some "caching" of prior code that didn't get overwritten so I had to completely wipe the old .zip file and start over with a new one.

Then it worked.

Plugins are pulled in config.xml

After a little more tinkering, I might be starting to understand what's happening. I just downloaded the phonegap-start app from github.com/phonegap/phonegap-start and the same problem resurfaced. I think the problem is caused by the plugin source files referenced in the config.xml file. And I think these references were not deleted when I selected "update code" instead of deleting the old app and starting over. The relevant section of the config.xml file is below.

config.xml snippet
<!-- Core plugins -->
<gap:plugin name="org.apache.cordova.battery-status" />
<gap:plugin name="org.apache.cordova.camera" />
<gap:plugin name="org.apache.cordova.media-capture" />
<gap:plugin name="org.apache.cordova.console" />
<gap:plugin name="org.apache.cordova.contacts" />
<gap:plugin name="org.apache.cordova.device" />
<gap:plugin name="org.apache.cordova.device-motion" />
<gap:plugin name="org.apache.cordova.device-orientation" />
<gap:plugin name="org.apache.cordova.dialogs" />
<gap:plugin name="org.apache.cordova.file" />
<gap:plugin name="org.apache.cordova.file-transfer" />
<gap:plugin name="org.apache.cordova.geolocation" />
<gap:plugin name="org.apache.cordova.globalization" />
<gap:plugin name="org.apache.cordova.inappbrowser" />
<gap:plugin name="org.apache.cordova.media" />
<gap:plugin name="org.apache.cordova.network-information" />
<gap:plugin name="org.apache.cordova.splashscreen" />
<gap:plugin name="org.apache.cordova.vibration" />
查看更多
你好瞎i
5楼-- · 2019-09-11 12:20

FWIW: you have not mentioned anything about your config.xml. At this point I am assuming you are using the one you get - without modification.

Okay. I'm going to give you the quick fix. But first you should know you have a large amount of errors. This quick fix will get you going, but you should read the document I've laid out more than once.

Top Mistakes by Developers new to Cordova/Phonegap

QUICK FIX Add this to your config.xml for PHONEGAP BUILD ONLY
<preference name="phonegap-version" value="3.7.0" />

There are two large reasons you are getting these errors.

  1. The plugin repository has moved to NPM. Your code shows you are not keeping up. (#11)
  2. If you do NOT set the compiler version when you did your build. (#6)

From #6 on the link above:

With the CLI version, if you do not assign a version for your platform OR in ''Phonegap Build'' if you do not set the phonegap-version in config.xml, YOU WILL GET THE LATEST VERSION. If you are lucky, your program just works as expected. If you are not lucky, you'll get a set of cascading error.

TO repeat, you are not lucky. You are getting the set of cascading error
You should read #6, #7, #10 & #11.

Best of Luck, let me know how it is going.

查看更多
Summer. ? 凉城
6楼-- · 2019-09-11 12:24

Try updating phonegap or any related programmes because one seems to be outdated. If your using any plugins like adding in your app try to see if their the latest version as well.

查看更多
登录 后发表回答