我正在開發一個使用Titanium Web視圖,angularjs和移動角度UI的移動應用程序。 我已經創建了一個移動的角度ui站點,我在本地使用Titanium Web視圖加載。Mobile angular ui fail
我的問題是,當我嘗試在Web視圖中加載本地站點時,我看到一個空白頁面。要測試應用程序,我已經將該網站上傳到了一個php服務器,並且如果我嘗試使用移動瀏覽器(例如chrome)加載該網站,那麼一切正常。
我發現,如果我不包括CSS移動角度-UI-base.min我可以在鈦網觀點看不是空白頁
這是我的應用程序在鈦
var link = 'app/index.html';
var win = Ti.UI.createWindow();
var webview = Ti.UI.createWebView({
url:link
});
win.add(webview);
win.open({
modal : true
});
.js文件創建一個新的鈦項目,創建資源文件夾內的文件夾名爲app和複製所有HTML,JS,CSS文件裏面。
如果您執行移動應用程序,結果將是空白頁。如果您從index.html中刪除,您將看到登錄頁面。 最後,您嘗試在android設備(例如chrome)中啓動瀏覽器,並在遠程服務器中加載相同的站點(不刪除mobile-angular-ui-base.min.cs),您將看到正確的登錄頁面(如在plunker例子)
這是我的Android模擬器設置:
Name: Nexus_5_API_23_x86
CPU/ABI: Google APIs Intel Atom (x86)
Target: Google APIs (API level 23)
Skin: 1080x1920
SD Card: 200M
hw.dPad: no
hw.accelerometer: yes
hw.device.name: Nexus 5
vm.heapSize: 64
skin.dynamic: no
hw.device.manufacturer: Google
hw.gps: yes
hw.audioInput: yes
tag.id: google_apis
hw.camera.back: emulated
hw.mainKeys: no
hw.camera.front: emulated
hw.lcd.density: 480
hw.device.hash2: MD5:2fa0e16c8cceb7d385183284107c0c88
hw.ramSize: 1536
hw.trackBall: no
hw.battery: yes
hw.sdCard: yes
tag.display: Google APIs
hw.keyboard: yes
hw.sensors.proximity: yes
disk.dataPartition.size: 200M
hw.sensors.orientation: yes
avd.ini.encoding: UTF-8
hw.gpu.enabled: yes
請幫助。 Thanxs
我認爲路徑是正確的,因爲如果我嘗試在logcat中將angular.min.js的路徑更改爲「app/js/libs/angular/angular.min.js」,我看到這個錯誤「Unable to打開資產URL:file:///android_asset/Resources/app/app/js/libs/angular/angular.min.js「,否則我沒有收到任何錯誤 – Fabry
好吧。您是否嘗試開發工具進行調試? –
我嘗試使用AndroidStrudio,並且在這個IDE中出現錯誤。我不記得確切的錯誤描述,就像「無法加載signIn.html ....」。這個文件是由angularjs使用ajax下載的。我解決了這個錯誤(在Android Strudio中)爲webView「setAllowFileAccessFromFileURLs(true)」設置了這個設置。奇怪的是,在我通過USB連接的物理設備(Galaxy TAB 2)中,Titanium應用程序工作正常。我發送.apk到另一個android手機,我遇到了與模擬器相同的問題 – Fabry