我花了两天时间试图找出如何调试我使用Cordova 3.2创建并部署到Android 2.3设备的HTML5应用程序.我见过的所有文章/帖子都提供了黑客而不是真正的解决方案:(大部分时间,它们都不适合我的情况;调试我的应用程序中的CSS样式和Angularjs代码..
到目前为止我测试了;
debug.phonegap.com
我将脚本注入index.html
文件,然后访问debug.phonegap.com中生成的URL,但没有任何反应; 只有一个空白页面.
Weinre
我发现的大多数文章指向过时的Github存储库,它计算了一个Jar文件..但是没有找到:(
边缘检查
它工作并显示我在移动设备上的PC上浏览的网页..但问题是它使用了一些其他集成的浏览器(或模拟器)而不是运行phonegap应用程序的浏览器.所以结果不准确.
Chrome模拟器
与边缘检查相同; 它不允许查看Android 2.3附带的真实web-kit v530.
梦想的解决方案
完美的解决方案是谷歌Chrome(桌面)的扩展,使您能够将桌面浏览器切换到Android 2.3平台中的同一个浏览器.没有模拟没有黑客,只有浏览器本身与web-kit v 530.
不幸的是,这样的解决方案不存在:(或者我错了?
有什么建议?
使用Cordova CLI,我设置了一个应用程序并构建它:
cordova create hi com.example.hi Hi
cd hi
cordova platform add android
cordova build android
Run Code Online (Sandbox Code Playgroud)
我运行Genymotion并启动一个名为"api9"的设备.我运行Android Debug Bridge adb devices
并显示为
192.168.8.101:5555
Run Code Online (Sandbox Code Playgroud)
我尝试启动应用程序,cordova emulate android
但得到:
Error: An error occurred while emulating/deploying the android project. ...spawn ENOENT
Run Code Online (Sandbox Code Playgroud)
但是,启动Android虚拟设备管理器并启动模拟设备; 该cordova emulate android
作品和adb devices
名单;
192.168.8.101:5555
emulator-5554
Run Code Online (Sandbox Code Playgroud)
我应该怎么做才能让Cordova通过Genymotion设备模拟?
正如您在下图所示,div
(左上角)显示当前标记地址/ directions/save ..
这是使用iframe
谷歌地图的嵌入代码完成的.但是你怎么能用自定义的"编码"地图做同样的事情呢?
geocoder = new google.maps.Geocoder();
geocoder.geocode({
"address": nw.google_pointer
}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var myOptions = {
zoom: parseInt(nw.google_zoom),
center: results[0].geometry.location,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
var marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location,
title: nw.google_pointer
});
} else {
console.log('Geocode was not successful for the following reason: ' + status);
}
});
Run Code Online (Sandbox Code Playgroud) 在一个方法中进行多次尝试并构造这样的代码是不是被认为是不好的做法?
public void whatever() {
try {
methodThatMayThrowIOException();
} catch(IOException io) {
// do something with exception here
}
// do more stuff here that won't throw exceptions
try {
methodThatMayThrowCustomException();
} catch(CustomException ce) {
// do something with custom exception here
}
}
Run Code Online (Sandbox Code Playgroud) 在科尔多瓦文档,关于使用图标和闪屏的Android,指出他们应该被放置在WWW/RES /图标和WWW/RES /屏幕目录分别.但后来,在同一个页面,它说;
你需要将png文件从platforms/android/www/res/screen/android复制 到 platforms/android/res/drawable/*
所以; 如果应将图标和启动画面复制到drawable文件夹,在www/res/icons*和www/res/screens上使用它们有什么用
这很令人困惑(@ _ @)特别是当文档添加更多歧义时;
..When working in the CLI...
Run Code Online (Sandbox Code Playgroud) 虽然Github提供了一种发布软件的方法,但我不知道是否可以指定仅发布当前主存储库的某些文件并以zip文件的形式下载。
我想为用户提供从整个存储库下载某个文件夹/文件的可能性,例如;我的存储库中有 3 个文件,,,, - file_1.js
我想制作一个可下载的 zip 文件版本。file_2.js
file_3.js
file_3.js
my_app_v1.0.zip
这怎么可能?
感谢您的任何想法:)
我正在使用Cordova 3.3.0和我的Galaxy S3(运行最新的Cyanogenmod)来测试我正在使用的应用程序; 我需要应用程序屏幕保持"纵向"模式并即使用户旋转设备也会被锁定.无论我尝试过什么或我遵循的教程,应用程序都忽略了锁定屏幕的首选项.我究竟做错了什么?
这是我的config.xml:
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.numediaweb.test" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Test</name>
<description>
Test.</description>
<author href="http://test.com" email="abdel@test.com">
me
</author>
<content src="index.html" />
<access origin="*" />
<preference name="orientation" value="portrait" />
<preference name="fullscreen" value="true" />
<preference name="SplashScreen" value="splash" />
<preference name="SplashScreenDelay" value="3000" />
</widget>
Run Code Online (Sandbox Code Playgroud) 来自PHP世界,只有一种方法可以编写异常处理..我发现Java中的异常包装有点"丑陋":
public void exampleOneException(String input) throws MyBusinessException {
try {
// do something
} catch (NumberFormatException e) {
throw new MyBusinessException("Error...", e);
}
}
Run Code Online (Sandbox Code Playgroud)
我更喜欢使用这种风格:
public void exampleTwoException() {
try {
// do something
} catch (MyBusinessException e) {
log.error("Error...: " + e);
} catch (NumberFormatException e) {
log.error("Error...: " + e);
}
}
Run Code Online (Sandbox Code Playgroud)
这些处理例外的方法有什么不同或最佳做法吗?
一旦js应用程序(由许多单独的模块构成)得到优化(使用Requirejs优化工具将整个代码放入一个单独的文件中); 是否有可能将文件反编译/取消合并为独立的模块,就像以前在优化之前一样?
用例将是一个场景(即使很难发生)你丢失源代码但可以访问优化的js文件..是否有任何方法/方法将模块自动分成js文件而不是手动做吗?
javascript decompiling reverse-engineering requirejs uglifyjs
我正在使用AngularJS v1.2.7和Cordova 3.3.0(Android)我需要在手机内存中存储一些设置 - 所以当应用程序/设备重新启动时,应用程序仍然可以访问这些存储的数据.
关于这个的任何教程?我找不到任何:(
知道Cordova支持; LocalStorage,WebSQL(不再维护),IndexedDB(Opera和Safari 没有广泛支持).我倾向于使用LocalStorage,但是即使在我重启设备后它仍保留/记住数据?
目前我正在使用Richard Szalay的答案#12969480.
cordova ×5
android ×3
exception ×2
java ×2
javascript ×2
angularjs ×1
coding-style ×1
debugging ×1
decompiling ×1
download ×1
emulation ×1
genymotion ×1
git ×1
github ×1
google-maps ×1
icons ×1
node.js ×1
npm ×1
release ×1
requirejs ×1
settings ×1
uglifyjs ×1
zip ×1