Cordova not detecting launched android emulator

时间:2018-02-26 17:59:31

标签: android cordova ionic3

I am using Ionic to develop cross-platform apps, but recently I am unable to deploy apps to an android emulator launched by Cordova.

After pulling and building the 'super' example application from ionic, I run cordova run android --verbose. This produces the following output:

No scripts found for hook "before_run".
No scripts found for hook "before_prepare".
Checking config.xml and package.json for saved platforms that haven't been added to the project
Config.xml and package.json platforms are the same. No pkg.json modification.
Package.json and config.xml platforms are different. Updating config.xml with most current list of platforms.
PlatformApi successfully found for platform android
Checking config.xml for saved plugins that haven't been added to the project
Checking for any plugins added to the project that have not been installed in android platform
No differences found between plugins added to project and installed in android platform. Continuing...
Generating platform-specific config.xml from defaults for android at /Users/samborick/ionic/super-test/platforms/android/res/xml/config.xml
Merging project's config.xml into platform-specific android config.xml
Merging and updating files from [www, platforms/android/platform_www] to platforms/android/assets/www
Wrote out android application name "Excalibur" to /Users/samborick/ionic/super-test/platforms/android/res/values/strings.xml
android-versionCode not found in config.xml. Generating a code based on version in config.xml (0.0.1): 1
Wrote out Android package name "io.ionic.starter" to /Users/samborick/ionic/super-test/platforms/android/src/io/ionic/starter/MainActivity.java
Updating icons at platforms/android/res
Updating splash screens at platforms/android/res
This app does not have additional resource files defined
Prepared android project successfully
No scripts found for hook "after_prepare".
ANDROID_HOME=/Users/samborick/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
Subproject Path: CordovaLib
Running command: /Users/samborick/ionic/super-test/platforms/android/gradlew cdvBuildDebug -b /Users/samborick/ionic/super-test/platforms/android/build.gradle -Dorg.gradle.daemon=true -Dorg.gradle.jvmargs=-Xmx2048m -Pandroid.useDeprecatedNdk=true
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
    at build_2cqobl60hbcmb2dzjehzt5zko.run(/Users/samborick/ionic/super-test/platforms/android/build.gradle:141)
The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0.
Incremental java compilation is an incubating feature.
The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInputs.file(Object).skipWhenEmpty() instead.
:preBuild UP-TO-DATE
:preDebugBuild UP-TO-DATE
:checkDebugManifest
:CordovaLib:preBuild UP-TO-DATE
:CordovaLib:preDebugBuild UP-TO-DATE
:CordovaLib:checkDebugManifest
:CordovaLib:prepareDebugDependencies
:CordovaLib:compileDebugAidl UP-TO-DATE
:CordovaLib:compileDebugNdk UP-TO-DATE
:CordovaLib:compileLint UP-TO-DATE
:CordovaLib:copyDebugLint UP-TO-DATE
:CordovaLib:mergeDebugShaders UP-TO-DATE
:CordovaLib:compileDebugShaders UP-TO-DATE
:CordovaLib:generateDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugProguardFiles UP-TO-DATE
:CordovaLib:packageDebugRenderscript UP-TO-DATE
:CordovaLib:compileDebugRenderscript UP-TO-DATE
:CordovaLib:generateDebugResValues UP-TO-DATE
:CordovaLib:generateDebugResources UP-TO-DATE
:CordovaLib:packageDebugResources UP-TO-DATE
:CordovaLib:processDebugManifest UP-TO-DATE
:CordovaLib:generateDebugBuildConfig UP-TO-DATE
:CordovaLib:processDebugResources UP-TO-DATE
:CordovaLib:generateDebugSources UP-TO-DATE
:CordovaLib:incrementalDebugJavaCompilationSafeguard UP-TO-DATE
:CordovaLib:compileDebugJavaWithJavac UP-TO-DATE
:CordovaLib:processDebugJavaRes UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForDebug UP-TO-DATE
:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForDebug UP-TO-DATE
:CordovaLib:mergeDebugJniLibFolders UP-TO-DATE
:CordovaLib:transformNative_libsWithMergeJniLibsForDebug UP-TO-DATE
:CordovaLib:transformNative_libsWithSyncJniLibsForDebug UP-TO-DATE
:CordovaLib:bundleDebug UP-TO-DATE
:prepareOrgApacheCordovaCordovaLib630DebugLibrary UP-TO-DATE
:prepareDebugDependencies
:compileDebugAidl UP-TO-DATE
:compileDebugRenderscript UP-TO-DATE
:generateDebugBuildConfig UP-TO-DATE
:generateDebugResValues UP-TO-DATE
:generateDebugResources UP-TO-DATE
:mergeDebugResources UP-TO-DATE
:processDebugManifest UP-TO-DATE
:processDebugResources UP-TO-DATE
:generateDebugSources UP-TO-DATE
:incrementalDebugJavaCompilationSafeguard UP-TO-DATE
:compileDebugJavaWithJavac UP-TO-DATE
:compileDebugNdk UP-TO-DATE
:compileDebugSources UP-TO-DATE
:mergeDebugShaders UP-TO-DATE
:compileDebugShaders UP-TO-DATE
:generateDebugAssets UP-TO-DATE
:mergeDebugAssets UP-TO-DATE
:transformClassesWithDexForDebug UP-TO-DATE
:mergeDebugJniLibFolders UP-TO-DATE
:transformNative_libsWithMergeJniLibsForDebug UP-TO-DATE
:processDebugJavaRes UP-TO-DATE
:transformResourcesWithMergeJavaResForDebug UP-TO-DATE
:validateSigningDebug
:packageDebug UP-TO-DATE
:assembleDebug UP-TO-DATE
:cdvBuildDebug UP-TO-DATE

BUILD SUCCESSFUL

Total time: 1.13 secs
Command finished with error code 0: /Users/samborick/ionic/super-test/platforms/android/gradlew cdvBuildDebug,-b,/Users/samborick/ionic/super-test/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Dorg.gradle.jvmargs=-Xmx2048m,-Pandroid.useDeprecatedNdk=true
Built the following apk(s): 
    /Users/samborick/ionic/super-test/platforms/android/build/outputs/apk/android-debug.apk
No scripts found for hook "before_deploy".
ANDROID_HOME=/Users/samborick/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
Running command: adb devices
Command finished with error code 0: adb devices
No target specified and no devices found, deploying to emulator
Running command: adb devices
Command finished with error code 0: adb devices
Running command: adb devices
Command finished with error code 0: adb devices
Running adb shell command "cat /proc/cpuinfo" on target emulator-5584...
Running command: adb -s emulator-5584 shell cat /proc/cpuinfo
Command finished with error code 0: adb -s,emulator-5584,shell,cat,/proc/cpuinfo
Skipping build...
Built the following apk(s): 
    /Users/samborick/ionic/super-test/platforms/android/build/outputs/apk/android-debug.apk
Running adb shell command "ps" on target emulator-5584...
Running command: adb -s emulator-5584 shell ps
Command finished with error code 0: adb -s,emulator-5584,shell,ps
.Running adb shell command "ps" on target emulator-5584...
Running command: adb -s emulator-5584 shell ps
Command finished with error code 0: adb -s,emulator-5584,shell,ps

The output loops, repeating:

Running command: adb -s emulator-5584 shell ps
Command finished with error code 0: adb -s,emulator-5584,shell,ps

When I run adb -s emulator-5584 shell ps with the emulator running I get the following output:

USER      PID   PPID  VSIZE  RSS   WCHAN            PC  NAME
root      1     0     8504   1532  SyS_epoll_ 00000000 S /init
root      2     0     0      0       kthreadd 00000000 S kthreadd
root      3     2     0      0     smpboot_th 00000000 S ksoftirqd/0
root      5     2     0      0     worker_thr 00000000 S kworker/0:0H
root      7     2     0      0     smpboot_th 00000000 S migration/0
root      8     2     0      0     rcu_gp_kth 00000000 S rcu_preempt
root      9     2     0      0     rcu_gp_kth 00000000 S rcu_bh
root      10    2     0      0     rcu_gp_kth 00000000 S rcu_sched
root      11    2     0      0     smpboot_th 00000000 S migration/1
root      12    2     0      0     smpboot_th 00000000 S ksoftirqd/1
root      14    2     0      0     worker_thr 00000000 S kworker/1:0H
root      15    2     0      0     smpboot_th 00000000 S migration/2
root      16    2     0      0     smpboot_th 00000000 S ksoftirqd/2
root      18    2     0      0     worker_thr 00000000 S kworker/2:0H
root      19    2     0      0     smpboot_th 00000000 S migration/3
root      20    2     0      0     smpboot_th 00000000 S ksoftirqd/3
root      22    2     0      0     worker_thr 00000000 S kworker/3:0H
root      23    2     0      0     rescuer_th 00000000 S khelper
root      24    2     0      0     rescuer_th 00000000 S netns
root      335   2     0      0     rescuer_th 00000000 S writeback
root      337   2     0      0     rescuer_th 00000000 S bioset
root      339   2     0      0     rescuer_th 00000000 S kblockd
root      435   2     0      0     rescuer_th 00000000 S ata_sff
root      446   2     0      0     hub_thread 00000000 S khubd
root      455   2     0      0     rescuer_th 00000000 S md
root      465   2     0      0     rescuer_th 00000000 S cfg80211
root      580   2     0      0         kswapd 00000000 S kswapd0
root      647   2     0      0     fsnotify_m 00000000 S fsnotify_mark
root      665   2     0      0     rescuer_th 00000000 S crypto
root      794   2     0      0     rescuer_th 00000000 S iscsi_eh
root      808   2     0      0     scsi_error 00000000 S scsi_eh_0
root      811   2     0      0     scsi_error 00000000 S scsi_eh_1
root      867   2     0      0     rescuer_th 00000000 S uether
root      888   2     0      0     rescuer_th 00000000 S dm_bufio_cache
root      920   2     0      0     rescuer_th 00000000 S binder
root      923   2     0      0     rescuer_th 00000000 S hd-audio0
root      944   2     0      0     rescuer_th 00000000 S deferwq
root      949   1     3588   972   poll_sched 00000000 S /sbin/ueventd
root      1274  2     0      0     worker_thr 00000000 S kworker/0:1H
root      1275  2     0      0     kjournald2 00000000 S jbd2/vda-8
root      1277  2     0      0     rescuer_th 00000000 S ext4-rsv-conver
root      1278  2     0      0     kjournald2 00000000 S jbd2/vdb-8
root      1279  2     0      0     rescuer_th 00000000 S ext4-rsv-conver
logd      1281  1     15572  4136  sigsuspend 00000000 S /system/bin/logd
root      1286  2     0      0     kauditd_th 00000000 S kauditd
root      1289  1     6968   1236  __skb_recv 00000000 S /system/bin/debuggerd
root      1290  1     15096  2056  hrtimer_na 00000000 S /system/bin/vold
root      1292  1289  6712   416   __skb_recv 00000000 S debuggerd:signaller
root      1329  1     3392   380   SyS_epoll_ 00000000 S /sbin/healthd
root      1332  1     5748   1244  SyS_epoll_ 00000000 S /system/bin/lmkd
system    1333  1     6312   1340  binder_thr 00000000 S /system/bin/servicemanager
system    1334  1     55760  3384  SyS_epoll_ 00000000 S /system/bin/surfaceflinger
shell     1335  1     4884   960   n_tty_read ad5e4424 S /system/bin/sh
shell     1337  1     211160 1096  poll_sched 00000000 S /sbin/adbd
root      1364  2     0      0     rescuer_th 00000000 S kdmflush
root      1368  2     0      0     rescuer_th 00000000 S bioset
root      1369  2     0      0     rescuer_th 00000000 S kcryptd_io
root      1371  2     0      0     rescuer_th 00000000 S kcryptd
root      1372  2     0      0     dmcrypt_wr 00000000 S dmcrypt_write
root      1373  2     0      0     rescuer_th 00000000 S bioset
root      1386  2     0      0     kjournald2 00000000 S jbd2/dm-0-8
root      1387  2     0      0     rescuer_th 00000000 S ext4-rsv-conver
root      1392  2     0      0     worker_thr 00000000 S kworker/3:1H
root      1395  1     1065832 28092 poll_sched 00000000 S zygote
audioserver 1396  1     133892 10736 binder_thr 00000000 S /system/bin/audioserver
cameraserver 1397  1     23212  3292  binder_thr 00000000 S /system/bin/cameraserver
drm       1398  1     18084  2076  binder_thr 00000000 S /system/bin/drmserver
root      1399  1     6868   1568  unix_strea 00000000 S /system/bin/installd
keystore  1400  1     9500   1568  binder_thr 00000000 S /system/bin/keystore
mediacodec 1401  1     25672  4684  binder_thr 00000000 S media.codec
media     1402  1     28472  3392  binder_thr 00000000 S /system/bin/mediadrmserver
mediaex   1403  1     45940  3132  binder_thr 00000000 S media.extractor
media     1404  1     47800  2916  binder_thr 00000000 S /system/bin/mediaserver
root      1405  1     24756  2120  binder_thr 00000000 S /system/bin/netd
radio     1406  1     11420  1332  hrtimer_na 00000000 S /system/bin/rild
system    1408  1     10212  1564  binder_thr 00000000 S /system/bin/fingerprintd
system    1409  1     9188   1476  binder_thr 00000000 S /system/bin/gatekeeperd
root      1432  1     5460   1144  hrtimer_na 00000000 S /system/xbin/perfprofd
root      1583  1     4884   968   poll_sched 00000000 S sh
root      1630  1     5072   912   poll_sched 00000000 S /system/bin/ipv6proxy
wifi      1648  1     7524   1456  poll_sched 00000000 S /system/bin/hostapd
nobody    1649  1     5228   1020  poll_sched 00000000 S /system/bin/dnsmasq
system    1705  1395  1293932 81744 SyS_epoll_ 00000000 S system_server
root      1716  2     0      0     worker_thr 00000000 S kworker/2:1H
u0_a55    1782  1395  1153520 29712 SyS_epoll_ 00000000 S com.android.inputmethod.latin
u0_a28    1798  1395  1214980 61056 SyS_epoll_ 00000000 S com.android.systemui
media_rw  1811  1290  9504   2028  inotify_re 00000000 S /system/bin/sdcard
media_rw  1879  1290  9496   2020  inotify_re 00000000 S /system/bin/sdcard
radio     1911  1395  1173076 38484 SyS_epoll_ 00000000 S com.android.phone
root      1958  2     0      0     worker_thr 00000000 S kworker/1:1H
wifi      1961  1     10424  1964  poll_sched 00000000 S /system/bin/wpa_supplicant
u0_a15    2076  1395  1138824 23724 SyS_epoll_ 00000000 S com.google.android.ext.services
u0_a14    2130  1395  1327300 63908 SyS_epoll_ 00000000 S com.google.android.gms.persistent
u0_a29    2155  1395  1227728 26492 SyS_epoll_ 00000000 S com.google.android.googlequicksearchbox:interactor
u0_a21    2181  1395  1177176 45284 SyS_epoll_ 00000000 S com.google.android.apps.nexuslauncher
u0_a29    2312  1395  1500172 59036 SyS_epoll_ 00000000 S com.google.android.googlequicksearchbox:search
u0_a14    2509  1395  1483596 67088 SyS_epoll_ 00000000 S com.google.android.gms
u0_a54    3005  1395  1362604 43716 SyS_epoll_ 00000000 S com.google.android.talk
root      7158  2     0      0     worker_thr 00000000 S kworker/3:0
root      9213  2     0      0     worker_thr 00000000 S kworker/2:2
u0_a100   10639 1395  1425040 71684 SyS_epoll_ 00000000 S com.datacomand.mobile
u0_a90    12368 1395  1423056 73764 SyS_epoll_ 00000000 S com.ionicframework.ionicmaps365894
root      16636 2     0      0     worker_thr 00000000 S kworker/2:1
root      16637 2     0      0     worker_thr 00000000 S kworker/3:2
root      18693 2     0      0     worker_thr 00000000 S kworker/0:1
root      18703 2     0      0     worker_thr 00000000 S kworker/1:1
u0_a120   19290 1395  1405172 144104 SyS_epoll_ 00000000 S com.hungerperks.mobile
root      19419 2     0      0     worker_thr 00000000 S kworker/u9:4
u0_a52    19505 1395  1207724 47480 SyS_epoll_ 00000000 S com.google.android.tts
u0_a14    19524 1395  1145508 36368 SyS_epoll_ 00000000 S com.google.process.gapps
u0_a91    19597 1395  1598420 196248 SyS_epoll_ 00000000 S host.exp.exponent
u0_a18    19718 1395  1159616 40952 SyS_epoll_ 00000000 S com.google.android.packageinstaller
u0_a86    20112 1395  1145024 34964 SyS_epoll_ 00000000 S com.example.hungerperks.notifier
root      20178 2     0      0     worker_thr 00000000 S kworker/1:0
root      20344 2     0      0     worker_thr 00000000 S kworker/u9:3
root      20468 2     0      0     worker_thr 00000000 S kworker/u8:1
root      21164 2     0      0     worker_thr 00000000 S kworker/u9:0
root      21273 2     0      0     worker_thr 00000000 S kworker/u9:1
root      21940 2     0      0     worker_thr 00000000 S kworker/u8:0
root      22043 2     0      0     worker_thr 00000000 S kworker/0:0
root      22376 2     0      0     worker_thr 00000000 S kworker/u8:2
shell     22478 1337  6268   1404           0 a9635424 R ps

To my understanding this indicates that the adb is in fact running, and that adb is able to connect to it. However cordova never starts the next step of deploying the application after the emulator starts.

What could possibly be causing this issue?

1 个答案:

答案 0 :(得分:0)

已经发布了对Ionic的更新,并且不再出现此问题。