問題描述
我開始使用 Cordova 5.0.0 開發和 android 應用程序(cordova -v 打印 5.0.0),并在帶有 Android 4.1.2 的 Moto Razr D1 上對其進行測試.在 Windows 7 下,順便說一句.
I'm starting to develop and android app using Cordova 5.0.0 (cordova -v prints 5.0.0), and testing it on a Moto Razr D1 with Android 4.1.2. Under Windows 7, btw.
cordova build
并手動將平臺/android/build/output/apk/android-degug.apk 復制到 SD 并安裝工作正常.
and manually copying the platforms/android/build/output/apk/android-degug.apk to the SD and installing works fine.
cordova emulate android
在安卓版本>4.1.2的模擬器上運行良好
runs fine on emulator with android version >4.1.2
cordova run android
構建成功,說使用 apk 平臺/android/build/output/apk/android-debugger.apk,看起來還可以,安裝應用程序,啟動和啟動成功.但是,正如您在此屏幕截圖中看到的那樣
builds successfully, says using apk platforms/android/build/output/apk/android-debugger.apk, which seems ok, installing app, launching and LAUNCH SUCCESS. however as you can see in this screenshot
Razr 截圖
這個壁紙/管理/設置"的事情發生了,就是這樣.
This "WALLPAPER/MANAGE/SETTINGS" thing happens, and that's it.
如果我執行:
cordova emulate android
在裝有 Android 4.1.2 Jelly 的模擬器上,輸出相等
On an emulator with Android 4.1.2 Jelly, an equal output
BUILD SUCCESSFUL
Total time: 6.352 secs
Built the following apk(s):
C:androidSomeplatformsandroiduildoutputsapkandroid-debug.apk
Installing app on emulator...
Using apk: C:androidSomeplatformsandroiduildoutputsapkandroid-debug.apk
Launching application...
LAUNCH SUCCESS
相同的WALLPAPAER/MANAGE/SETTINGS",這是另一個屏幕截圖模擬器屏幕截圖
same "WALLPAPAER/MANAGE/SETTINGS", here's another screenshot Emulator Screenshot
任何想法如何解決這個問題?提前謝謝...
Any ideas how to solve this issue? Thanks in advance...
PS:如果我之前安裝了 apk,Razr 將啟動舊版本,而不是 WALLPAPER/MANAGE/SETTINGS 的東西.所以我必須先卸載它,然后再嘗試運行 cordova 運行命令.
PS: If I've installed the apk previously, the Razr will startup the old version, instead of the WALLPAPER/MANAGE/SETTINGS thing. So I have to uninstall it before trying to run the cordova run commands.
推薦答案
我遇到了同樣的問題(Cordova "hello world" 應用程序不會顯示)并找到了通過它的方法(但我不太了解根本原因).
I met the same problem (Cordova "hello world" app won't display) and found a way to pass through it (but I don't really understand the underlying causes).
安裝 apk 時似乎出現問題.在 Cordova 5.0.0 上,安裝 apk 的 adb 命令可以在文件 platformsandroidcordovalibdevice.js 的第 101 行找到(對于 cordova,在 platformsandroidcordovalibemulator.js 的第 311 行)模擬安卓):
Problem seemed to occur when installing the apk. On Cordova 5.0.0, adb commands to install the apk can be found at line 101 of file platformsandroidcordovalibdevice.js (and at line 311 of platformsandroidcordovalibemulator.js for cordova emulate android):
adb -s ' + resolvedTarget.target + ' install -r -d "' + apk_path + '"
當前命令返回給我:錯誤:未知選項 -d"!
Current command returns to me: "Error: unknown option -d"!
如果簡單地刪除-d"選項,應用程序在cordova run android下正常運行.
-d
應該直接出現在 adb
之后(如 --device
中),而不是在安裝之后.所以你可以把它移到那里而不是移除它.
The
-d
is supposed to come directly afteradb
(as in--device
) instead of after install. So you can just move it there instead of removing it.
另外,這是 apache cordova 問題跟蹤器上打開的問題
這篇關于cordova run android 執行良好.但Android 4.1.2 不啟動應用的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!