我的目标是开发一个具有类似调查功能的安卓应用程序。所以我用 Meteor 和 Cordova 做实验(也是为了学习框架)。
我的子步骤:在我的 Android 设备上运行其中一个教程:Samsung Galaxy S3 失败。
这就是我在/var/www/node_development/tutorials/solomo目录中启动应用程序的方式:
meteor run android-device -p 192.168.178.21:3000 --verbose
以下是 --verbose 日志的最后几行:
-dex:
[echo] Library project: do not convert bytecode...
-crunch:
[crunch] Crunching PNG Files in source dir: /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/CordovaLib/res
[crunch] To destination dir: /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/CordovaLib/ant-build/res
[crunch] Crunched 0 PNG files to update cache
-package-resources:
[echo] Library project: do not package resources...
-package:
[echo] Library project: do not package apk...
-post-package:
-do-debug:
[echo] Library project: do not create apk...
[propertyfile] Updating property file: /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/CordovaLib/ant-build/build.prop
[propertyfile] Updating property file: /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/CordovaLib/ant-build/build.prop
[propertyfile] Updating property file: /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/CordovaLib/ant-build/build.prop
[propertyfile] Updating property file: /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/CordovaLib/ant-build/build.prop
-post-build:
debug:
-code-gen:
[mergemanifest] Found Deleted Target File
[mergemanifest] Merging AndroidManifest files into one.
[mergemanifest] Manifest merger disabled. Using project manifest only.
[echo] Handling aidl files...
[aidl] No AIDL files to compile.
[echo] ----------
[echo] Handling RenderScript files...
[echo] ----------
[echo] Handling Resources...
[aapt] Found new input file
[aapt] Generating resource IDs...
[echo] ----------
[echo] Handling BuildConfig class...
[buildconfig] No need to generate new BuildConfig.
-pre-compile:
[echo] Set jars path to: /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/CordovaLib/ant-build/classes.jar
-compile:
[javac] Compiling 2 source files to /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/ant-build/classes
I20150629-10:36:48.553(2)? - waiting for device -
[javac] warning: [options] source value 1.5 is obsolete and will be removed in a future release
[javac] warning: [options] target value 1.5 is obsolete and will be removed in a future release
[javac] warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
[javac] 3 warnings
-post-compile:
-obfuscate:
-dex:
[dex] input: /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/ant-build/classes
[dex] input: /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/CordovaLib/ant-build/classes.jar
[dex] Using Pre-Dexed classes-4340c49ff3fe08c4129acefebb6bbc29.jar <- /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/CordovaLib/ant-build/classes.jar
[dex] Found modified input file
[dex] Converting compiled files and external libraries into /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/ant-build/classes.dex...
=> Started your app.
=> App running at: http://192.168.178.21:3000/
[dx] Merged dex A (94 defs/130,6KiB) with dex B (207 defs/313,5KiB). Result is 301 defs/539,9KiB. Took 0,8s
-crunch:
[crunch] Crunching PNG Files in source dir: /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/res
[crunch] To destination dir: /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/ant-build/res
[crunch] Processing image to cache: /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/res/drawable-hdpi/icon.png => /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/ant-build/res/drawable-hdpi/icon.png
[crunch] (processed image to cache entry /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/ant-build/res/drawable-hdpi/icon.png: 0% size of source)
[crunch] Processing image to cache: /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/res/drawable-land-hdpi/screen.png => /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/ant-build/res/drawable-land-hdpi/screen.png
[crunch] (processed image to cache entry /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/ant-build/res/drawable-land-hdpi/screen.png: 27% size of source)
[crunch] Processing image to cache: /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/res/drawable-land-ldpi/screen.png => /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/ant-build/res/drawable-land-ldpi/screen.png
[crunch] (processed image to cache entry /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/ant-build/res/drawable-land-ldpi/screen.png: 0% size of source)
[crunch] Processing image to cache: /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/res/drawable-land-mdpi/screen.png => /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/ant-build/res/drawable-land-mdpi/screen.png
[crunch] (processed image to cache entry /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/ant-build/res/drawable-land-mdpi/screen.png: 38% size of source)
[crunch] Processing image to cache: /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/res/drawable-land-xhdpi/screen.png => /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/ant-build/res/drawable-land-xhdpi/screen.png
[crunch] (processed image to cache entry /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/ant-build/res/drawable-land-xhdpi/screen.png: 34% size of source)
[crunch] Processing image to cache: /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/res/drawable-ldpi/icon.png => /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/ant-build/res/drawable-ldpi/icon.png
[crunch] (processed image to cache entry /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/ant-build/res/drawable-ldpi/icon.png: 0% size of source)
[crunch] Processing image to cache: /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/res/drawable-port-hdpi/screen.png => /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/ant-build/res/drawable-port-hdpi/screen.png
[crunch] (processed image to cache entry /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/ant-build/res/drawable-port-hdpi/screen.png: 26% size of source)
[crunch] Processing image to cache: /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/res/drawable-port-ldpi/screen.png => /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/ant-build/res/drawable-port-ldpi/screen.png
[crunch] (processed image to cache entry /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/ant-build/res/drawable-port-ldpi/screen.png: 0% size of source)
[crunch] Processing image to cache: /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/res/drawable-port-mdpi/screen.png => /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/ant-build/res/drawable-port-mdpi/screen.png
[crunch] (processed image to cache entry /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/ant-build/res/drawable-port-mdpi/screen.png: 0% size of source)
[crunch] Processing image to cache: /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/res/drawable-port-xhdpi/screen.png => /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/ant-build/res/drawable-port-xhdpi/screen.png
[crunch] (processed image to cache entry /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/ant-build/res/drawable-port-xhdpi/screen.png: 34% size of source)
[crunch] Processing image to cache: /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/res/drawable-xhdpi/icon.png => /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/ant-build/res/drawable-xhdpi/icon.png
[crunch] (processed image to cache entry /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/ant-build/res/drawable-xhdpi/icon.png: 0% size of source)
[crunch] Crunched 11 PNG files to update cache
-package-resources:
[aapt] Found modified input file
[aapt] Creating full resource package...
[aapt] Warning: AndroidManifest.xml already defines debuggable (in http://schemas.android.com/apk/res/android); using existing value in manifest.
-package:
[apkbuilder] Found modified input file
[apkbuilder] Creating solomo-debug-unaligned.apk and signing it with a debug key...
-post-package:
-do-debug:
[zipalign] Running zip align on final apk...
[echo] Debug Package: /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/ant-build/solomo-debug.apk
[propertyfile] Updating property file: /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/ant-build/build.prop
[propertyfile] Updating property file: /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/ant-build/build.prop
[propertyfile] Updating property file: /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/ant-build/build.prop
[propertyfile] Updating property file: /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/ant-build/build.prop
-post-build:
[move] Moving 1 file to /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/ant-build
[move] Moving 1 file to /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/CordovaLib/ant-build
debug:
BUILD SUCCESSFUL
Total time: 31 seconds
/var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
ERROR: Failed to launch application on device: ERROR: Failed to install apk to device: ERROR: Failed to deploy to device, no devices found.
Command finished with error code 8: /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/cordova/run --device
Error: /var/www/node_development/tutorials/solomo/.meteor/local/cordova-build/platforms/android/cordova/run: Command failed with exit code 8
at ChildProcess.whenDone (/home/tokam/.meteor/packages/meteor-tool/.1.0.35.1ahmcpn++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/dev_bundle/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:755:16)
at Process.ChildProcess._handle.onexit (child_process.js:822:5)
Could not start the app on your device. Is it plugged in?
Try running again with the --verbose option.
Instructions for running your app on an Android device:
https://github.com/meteor/meteor/wiki/How-to-run-your-app-on-an-Android-device
tokam@localhost:/var/www/node_development/tutorials/solomo$ adb devices
adb server is out of date. killing...
cannot bind 'tcp:5037'
ADB server didn't ACK
* failed to start daemon *
error:
tokam@localhost:/var/www/node_development/tutorials/solomo$
tokam@localhost:/var/www/node_development/tutorials/solomo$
tokam@localhost:/var/www/node_development/tutorials/solomo$ clear
tokam@localhost:/var/www/node_development/tutorials/solomo$ killall adb
tokam@localhost:/var/www/node_development/tutorials/solomo$ adb devices > /tmp/log
tokam@localhost:/var/www/node_development/tutorials/solomo$ meteor run android-device -p 192.168.178.21:3000 --verbose > /tmp/log
%% Parsing the --port option
%% Will compile mobile builds
%% Running build for platforms: [ 'android' ]
%% Building the cordova build project
%% Bundling the web.cordova program of the app
%% Ensuring the cordova build project
%% Reading the mobile control file
%% Running the mobile control file
%% Copying resources for mobile apps
%% Writing new config.xml
%% Ensuring that platforms in cordova build project are in sync
%% Running synchronously: /home/tokam/.meteor/packages/meteor-tool/.1.0.35.1ahmcpn++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/cordova-scripts/cordova.sh [ 'platform', 'list' ]
%% The output of `cordova platforms list`: Installed platforms: android 3.5.1
Available platforms: amazon-fireos, blackberry10, firefoxos, ubuntu
%% The platform is not in the Cordova project: ios
%% Ensuring plugins in the cordova build project are in sync { 'org.apache.cordova.console': '0.2.10',
'org.apache.cordova.inappbrowser': '0.5.1',
'org.apache.cordova.geolocation': '0.3.10',
'org.apache.cordova.camera': '0.3.2',
'org.apache.cordova.file': '1.3.0',
'org.apache.cordova.file-transfer': '0.4.4',
'org.apache.cordova.device': '0.2.11',
'com.meteor.cordova-update': 'https://github.com/meteor/com.meteor.cordova-update/tarball/92fe99b7248075318f6446b288995d4381d24cd2',
'org.apache.cordova.statusbar': '0.1.7',
'org.apache.cordova.splashscreen': '0.3.3' }
%% Getting installed plugins for project
%% Running synchronously: /home/tokam/.meteor/packages/meteor-tool/.1.0.35.1ahmcpn++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/cordova-scripts/cordova.sh [ 'plugin', 'list' ]
%% The output of `cordova plugins list`: com.meteor.cordova-update 0.0.1 "CordovaUpdate"
org.apache.cordova.camera 0.3.2 "Camera"
org.apache.cordova.console 0.2.10 "Console"
org.apache.cordova.device 0.2.11 "Device"
org.apache.cordova.file 1.3.0 "File"
org.apache.cordova.file-transfer 0.4.4 "File Transfer"
org.apache.cordova.geolocation 0.3.10 "Geolocation"
org.apache.cordova.inappbrowser 0.5.1 "InAppBrowser"
org.apache.cordova.splashscreen 0.3.3 "Splashscreen"
org.apache.cordova.statusbar 0.1.7 "StatusBar"
%% Will check for cordova-tarball-plugins.json for tarball-url-based plugins previously installed.
%% The tarball plugins lock: { 'com.meteor.cordova-update': 'https://github.com/meteor/com.meteor.cordova-update/tarball/92fe99b7248075318f6446b288995d4381d24cd2' }
%% Copying the JS/CSS files one level up
%% Removing the www folder
%% Writing www/application folder
%% Writing index.html
%% Writing meteor_cordova_loader
%% Writing a default index.html for cordova app
%% Running the build command
%% Running synchronously: /home/tokam/.meteor/packages/meteor-tool/.1.0.35.1ahmcpn++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/cordova-scripts/cordova.sh [ '--verbose', 'build', 'android' ]
%% Done building the cordova build project
%% A run on a device requested
WARNING: You are testing your app on a remote device.
For the mobile app to be able to connect to the local server, make
sure your device is on the same network, and that the network
configuration allows clients to talk to each other
(no client isolation).
WARNING: It looks like you are using OAuth2 login in your app.
Meteor's OAuth2 implementation does not currently work with
mobile apps in local development mode, except in the iOS
simulator. You can run the iOS simulator with 'meteor run ios'.
For additional workarounds, see
https://github.com/meteor/meteor/wiki/OAuth-for-mobile-Meteor-clients.
%% Execing cordova for platform android-device
%% isDevice: true
%% Running emulator: /home/tokam/.meteor/packages/meteor-tool/.1.0.35.1ahmcpn++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/cordova-scripts/cordova.sh [ 'run', '--verbose', '--device', 'android' ]
%% Running asynchronously: /home/tokam/.meteor/packages/meteor-tool/.1.0.35.1ahmcpn++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/cordova-scripts/cordova.sh [ 'run', '--verbose', '--device', 'android' ]
%% Clearing logs for Android with `adb logcat -c`, should time-out in 5 seconds
%% Running asynchronously: /home/tokam/.meteor/packages/meteor-tool/.1.0.35.1ahmcpn++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/cordova-scripts/adb.sh [ 'logcat', '-c' ]
%% adb logcat -c timed out
%% Clearing logs failed: Error: clearing logs of Android device timed out: adb logcat -c
at Object.Future.wait (/home/tokam/.meteor/packages/meteor-tool/.1.0.35.1ahmcpn++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/dev_bundle/lib/node_modules/fibers/future.js:326:15)
at execCordovaOnPlatform (/home/tokam/.meteor/packages/meteor-tool/.1.0.35.1ahmcpn++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/commands-cordova.js:1216:14)
at _.extend.start (/home/tokam/.meteor/packages/meteor-tool/.1.0.35.1ahmcpn++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/commands-cordova.js:914:7)
at /home/tokam/.meteor/packages/meteor-tool/.1.0.35.1ahmcpn++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/run-all.js:160:23
at /home/tokam/.meteor/packages/meteor-tool/.1.0.35.1ahmcpn++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/buildmessage.js:313:18
at _.extend.withValue (/home/tokam/.meteor/packages/meteor-tool/.1.0.35.1ahmcpn++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/fiber-helpers.js:112:14)
at /home/tokam/.meteor/packages/meteor-tool/.1.0.35.1ahmcpn++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/buildmessage.js:312:36
at _.extend.withValue (/home/tokam/.meteor/packages/meteor-tool/.1.0.35.1ahmcpn++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/fiber-helpers.js:112:14)
at Object.enterJob (/home/tokam/.meteor/packages/meteor-tool/.1.0.35.1ahmcpn++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/buildmessage.js:303:26)
at /home/tokam/.meteor/packages/meteor-tool/.1.0.35.1ahmcpn++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/run-all.js:159:22
at Array.forEach (native)
at Function._.each._.forEach (/home/tokam/.meteor/packages/meteor-tool/.1.0.35.1ahmcpn++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/dev_bundle/lib/node_modules/underscore/underscore.js:79:11)
at _.extend.start (/home/tokam/.meteor/packages/meteor-tool/.1.0.35.1ahmcpn++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/run-all.js:156:7)
at Object.exports.run (/home/tokam/.meteor/packages/meteor-tool/.1.0.35.1ahmcpn++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/run-all.js:318:10)
at doRunCommand [as func] (/home/tokam/.meteor/packages/meteor-tool/.1.0.35.1ahmcpn++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/commands.js:347:17)
at /home/tokam/.meteor/packages/meteor-tool/.1.0.35.1ahmcpn++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/main.js:1353:23
- - - - -
at null._onTimeout (/home/tokam/.meteor/packages/meteor-tool/.1.0.35.1ahmcpn++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/commands-cordova.js:1211:22)
at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)
%% Done clearing Android logs.
%% Tailing logs for android with `adb logcat -s CordovaLog`
%% Running asynchronously: /home/tokam/.meteor/packages/meteor-tool/.1.0.35.1ahmcpn++os.linux.x86_64+web.browser+web.cordova/meteor-tool-os.linux.x86_64/tools/cordova-scripts/adb.sh [ 'logcat', '-s', 'CordovaLog' ]
%% Done execing cordova for platform android-device
Could not start the app on your device. Is it plugged in?
Try running again with the --verbose option.
Instructions for running your app on an Android device:
https://github.com/meteor/meteor/wiki/How-to-run-your-app-on-an-Android-device
在运行流星adb 设备列表之前:
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached
506c09aa device
运行meteor adb devices后告诉我:
ADB server didn't ACK
* failed to start daemon *
error:
我已经将 adb 超时率更改为 12000 毫秒。我的设备是为开发而设置的。
如何使用流星科尔多瓦运行 android 应用程序?