升级到phonegap 3.3.0 [英] Upgrade to phonegap 3.3.0

查看:150
本文介绍了升级到phonegap 3.3.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将phonegap项目从phonegap 2.9.0升级到最新版本,phonegap 3.3.0。
因为它有很大的改进。



这是一个Android项目,但很快就是ios,



但是,我很挣扎了几天,还没有工作代码。



我已经这样做了:



安装了手机空间并创建了一个新的项目,如手册: http://phonegap.com / install /



之后,我慢慢地将我的旧代码插入到www文件夹中,并以3.0的方式安装了插件。



但是无论我做什么...我都感到烦人:


初始化Cordova时出错:找不到类因为我曾经在eclipse中运行它并使用这个调试控制台(并没有找到如何从cli中获取调试信息)工作...一些更多的调查在那里),我试图让它在日食中工作。



但是,它没有科尔多瓦罐,我找不到任何地方。
我曾经将cordova-2.9.0.jar添加到构建路径,但没有cordova-3.3.0.jar。
我看到一个答案abouyt创建它yourselve:但是这后来被称为不正确的方式(ans,因为没有电话沟通文档这被提及...我无法想像这样)



在eclipse中,这导致错误:import org.apache.cordova。*;



所以就像我说...没有cordova jar ... hwo你解决这个问题吗?



所以有一些问题一次...


  1. 为了得到更好的调试:我如何使这个工作在eclipse

  2. 为什么我得到这个错误...没有找到类(可能与
    相关的丢失的jar)

没有相关问题给我一个解决方案...

修改
我只是去添加,更详细的步骤就像我奠定了这一步:
http://docs.phonegap.com/en /3.3.0/guide_ cli_index.md.html#%20Command-Line%20Interface



但比我注意到...这个命令:


sudo npm install -g cordova


我以为我做过,但是我已经做了:


sudo npm install -g phonegap


但是这没有任何区别。



运行它:`


phonegap运行android -V - 设备


`提供:

  [phonegap]检测Android SDK环境... 
[phonegap]使用本地环境
[phonegap]编译Android ...
[phonegap]从平台android的默认值生成config.xml
[phonegap]通过命令/我的应用程序/平台/ android / cordova / build路径在平台android上编译应用程序
[phonegap]平台android编译成功。
[phonegap]成功编译Android应用程序
[phonegap]安装应用程序到设备
[phonegap]生成config.xml从默认的平台android
[phonegap]运行应用程序平台android通过命令/路径到我的应用程序/平台/ android / cordova /运行--device
[phonegap]平台android运行成功
pre>

但仍然像以前一样给出错误。
在eclipse中还需要添加Cordova jar,这是无处可找的。

编辑2



我创建了一个新项目,只是为了看看当添加到eclipse中时发生了什么,似乎工作。所以我从ecplise中删除了该项目...并添加了它(淹没了手机文件为thsi:新的android项目;从现有的代码添加)。现在它在文件夹platform / CordovaLib / bin中创建一个名为 - cordova-lib.jar的新jar。

这似乎适用于eclipse ...还是一样cli运行命令中的错误。但现在我可以尝试从日食中运行它,并找出更多...(我会在发现错误后立即发布)



编辑3



在eclipse中运行它会显示错误(奇怪的是,这不显示在-VV的phonegap):

  01-05 09:04:16.557:D / CordovaLog(698):file:///android_asset/www/phonegap.js:Line 1544 :找不到cordova.js脚本标签。插件加载可能会失败。 
01-05 09:04:16.567:I / Web Console(698):找不到cordova.js脚本标签。插件加载可能会失败。在文件:///android_asset/www/phonegap.js:1544

但是为什么不这样js file there ....



EDIT 16-jan-2014



这也正在成为一个受欢迎的问题。所以我不是唯一一个挣扎于phonegap 3.x的人,而这里还有一个未解决的问题: https://stackoverflow.com/questions/20953653 / config-xml-phonegap-3-3-0-ignores-name-and-description



EDIT 21-jan-2014
重要提示(有关这方面的许多问题):蓝图www folder中的config.xml与phonegap文档中所述不一样。它有另一个模式,并且是每个平台的config.xml的蓝图,以及许多其他的东西和文件(androoid manifest xml文件,图标等)。不幸的是,我还没有在phonegap文档中找到这个config.xml文件的正确描述(除了模式)(只有平台依赖的目标config.xml文件的很好的消耗)。而且,他们为非常不同的文件选择相同的名称非常混乱...



编辑12-feb-2014
这可能是有帮助的...因为我仍然找不到这个所谓的蓝图config.xml在电话页面上的正确描述: https://github.com/phonegap/phonegap-start/blob/master/www/config.xml



编辑5可能2014



由于phonegap中的所有问题,phonegap背后的原则的好处已经为我。 (我仍然相信潜在的电话沟通可以是解决方案...但现在是过早)。所以我很抱歉我不得不离开电话沟通路径。我让这个答案开放,仍然寻找答案...但不要指望任何答案或'接受正确答案'从我。

解决方案

因为它不断抱怨没有找到类,我怀疑这是关于插件类。所以我删除了所有这些,并重新声明了他们,现在它的工作。



删除所有插件并重新安装

  phonegap plugin list 

[phonegap] org.apache.cordova.camera
[phonegap] org.apache.cordova.console
[phonegap] org.apache.cordova.device
[phonegap ] org.apache.cordova.device-motion
[phonegap] org.apache.cordova.device-orientation
[phonegap] org.apache.cordova.dialogs
[phonegap] org.apache .cordova.file
[phonegap] org.apache.cordova.file-transfer
[phonegap] org.apache.cordova.geolocation
[phonegap] org.apache.cordova.inappbrowser
[phonegap] org.apache.cordova.media
[phonegap] org.apache.cordova.media-capture
[phonegap] org.apache.cordova.network-information
[phonegap ] org.apache.cordova.splashscreen

phonegap插件帮助

安装我这样做(我不能找到一个*来一次卸载它们)

  phonegap plugin remove org.apache.cordova。设备

之后,我重新安装,所以所有插件:

  phonegap plugin add org.apache.cordova.device 

对我而言的窍门....



修改



几天后,我发现,如果你在日食中运行东西。你应该添加2个项目。一个完整的项目(作为一般项目,而不是android)。您可以在蓝色打印WWW文件夹中编辑代码。编辑后,您运行cli(命令行界面)命令:'cordova build',而不是从第二个项目运行它(您将platform / android文件夹作为android项目添加,使用现有代码中的add)。 / p>

I Am upgrading my phonegap project(s) from phonegap 2.9.0 to the latest one, phonegap 3.3.0. Because it has a lot of big improvements.

It's about an android project, but soon to be ios as well

However, I Am struggling with it a few days, and still no working code.

I have done this:

Installed phonegap and creted a new project like the the manual: http://phonegap.com/install/

After this I slowly inserted my old code into the www folder and installed the plugins on the new 3.0 way.

But whatever I do... I get this annoying:

Error initializing Cordova: Class not found

Because I used to run it in eclipse and use this debugging console (And did not find out how tot get the debuging from the cli to work... some more investigation to do there), I tried to get it working in eclipse.

But there, it does not have the cordova jar, and I can't find it anywhere. I used to add the cordova-2.9.0.jar to the build path, but there is no cordova-3.3.0.jar. I saw an answer abouyt creating it yourselve: but this was later remarked as not the proper way (ans since in no phonegap documentation this is mentioned... i cannot imagine that's the way)

In eclipse, this is causing the error: import org.apache.cordova.*;

So like I said... no cordova jar... hwo do you resolve this?

So a few questions all at once...

  1. To get better debugging: how do i get this working in eclipse
  2. Why do I get this error... class not found (probably related with the missing jar)

None of the related questions gave a solution for me...

Edit I was just going add, the steps in more detail, like I floowed this step: http://docs.phonegap.com/en/3.3.0/guide_cli_index.md.html#The%20Command-Line%20Interface

but than I noticed... this command:

sudo npm install -g cordova

which I thought I had done, but I had done:

sudo npm install -g phonegap

But this does not make any difference.

Running it with: `

phonegap run android -V --device

`Gives:

[phonegap] detecting Android SDK environment...
[phonegap] using the local environment
[phonegap] compiling Android...
[phonegap] Generating config.xml from defaults for platform "android"
[phonegap] Compiling app on platform "android" via command "/Path to my app/platforms/android/cordova/build" 
[phonegap] Platform "android" compiled successfully.
[phonegap] successfully compiled Android app
[phonegap] installing app onto device
[phonegap] Generating config.xml from defaults for platform "android"
[phonegap] Running app on platform "android" via command "/Path to my app/platforms/android/cordova/run" --device
[phonegap] Platform "android" ran successfully

but still gives the error as before. And in eclipse still need to add the cordova jar, which is nowhere to be found..

Edit 2

I created a new project, just to see what happened when adding this to eclipse.. and it seemed to work. So I removed the project from ecplise... and added it (floowing the phonegap docs for thsi: new android project; Add from existing code). And now it creates a new jar named - cordova-lib.jar in the folder platforms/CordovaLib/bin

and this seems to work for eclipse... still the same error in the cli run command. But now I can try to run it from eclipse and find out more... (I will post it as soon as I find out what is the error)

Edit 3

running it in eclipse shows the error (weird that this is not shown in the -V mode of phonegap):

01-05 09:04:16.557: D/CordovaLog(698): file:///android_asset/www/phonegap.js: Line 1544 : Could not find cordova.js script tag. Plugin loading may fail.
01-05 09:04:16.567: I/Web Console(698): Could not find cordova.js script tag. Plugin loading may fail. at file:///android_asset/www/phonegap.js:1544

But why isn't this js file there....

EDIT 16-jan-2014

This is becoming a popular question too look at. So I am not the only one struggling with phonegap 3.x And here is another yet unsolved question: https://stackoverflow.com/questions/20953653/config-xml-phonegap-3-3-0-ignores-name-and-description

EDIT 21-jan-2014 Important note (see a lot of questions about this): the config.xml in the blueprint www folderis not the same as described in the phonegap docs. It has another schema, and is the blueprint for both the config.xml per platform, as a lot of other things and files (androoid manifest xml files, icons etc.). Unfortunately I have not found a proper description (besides the schema) of this config.xml file (only a good descrition of the platform dependent targets config.xml file) in the phonegap docs yet. And it is very confusing they choose the same name for a very different file...

EDIT 12-feb-2014 This might be helpfull... since I still cannot find a proper description of this so called blueprint config.xml on the phonegap pages: https://github.com/phonegap/phonegap-start/blob/master/www/config.xml

Edit 5 may 2014

Due to all problems in phonegap, the benefits of the principle behind phonegap has gone for me. (I still believe in potential phonegap can be the solution... but for now it's to premature). So I Am sorry i have to leave the phonegap path. I let this answer open for the ones still searching for answers... but do not expect any answers or the 'acceptance of the right answer' from me.

解决方案

Because it kept complaining about the classes not being found, I suspected this was about the plugin classes. So I removed them all and reisntalled them, now it's working.

Remove all plugins and reinstall them

phonegap plugin list

[phonegap] org.apache.cordova.camera
[phonegap] org.apache.cordova.console 
[phonegap] org.apache.cordova.device
[phonegap] org.apache.cordova.device-motion
[phonegap] org.apache.cordova.device-orientation
[phonegap] org.apache.cordova.dialogs 
[phonegap] org.apache.cordova.file 
[phonegap] org.apache.cordova.file-transfer 
[phonegap] org.apache.cordova.geolocation 
[phonegap] org.apache.cordova.inappbrowser    
[phonegap] org.apache.cordova.media 
[phonegap] org.apache.cordova.media-capture
[phonegap] org.apache.cordova.network-information
[phonegap] org.apache.cordova.splashscreen

phonegap plugin help

for all installs I did this (I couldnot find a * to deinstall them all at once)

phonegap plugin remove org.apache.cordova.device

and after that I reinstalled them, so for all plugins:

phonegap plugin add org.apache.cordova.device

This did the trick for me....

Edit

By the way, a few days later I found out that in case you run things in eclipse. You should add 2 projects. One of the complete project (as a general project, not android). There you can edit the code in the blue print WWW folder. And after editing, you run the cli (command line interface) command: 'cordova build' and than you can run it from the second project (you add the platforms/android folder as a android project, using add from existing code).

这篇关于升级到phonegap 3.3.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆