无法在 cordova 中读取 属性 'applicationDirectory
Cannot read property 'applicationDirectory in cordova
我正在开发 Cordova 应用程序。
当我 运行 安装后第一次使用该应用程序时,它运行良好。但是对于随后的 运行s 它会抛出以上错误。
Added the cordova file transfer plugin
cordova plugin add cordova-plugin-file-transfer
Included the cordova script in my index.html
<script type="text/javascript" src="cordova.js"></script>
使用app目录如下
alert(cordova.file.applicationDirectory);
Above line alerts or prints the path correctly when I run my application for the first time, soon after installation. But in the next runs I get the error "Cannot read property 'applicationDirectory' of undefined".
ANSWER IN BELOW COMMENTS
My issue fixed when I used the "file:///android_asset/www/Images/" instead of cordova.file.applicationDirectory+"/Images"
我正在开发 Cordova 应用程序。
当我 运行 安装后第一次使用该应用程序时,它运行良好。但是对于随后的 运行s 它会抛出以上错误。
Added the cordova file transfer plugin
cordova plugin add cordova-plugin-file-transfer
Included the cordova script in my index.html
<script type="text/javascript" src="cordova.js"></script>
使用app目录如下
alert(cordova.file.applicationDirectory);
Above line alerts or prints the path correctly when I run my application for the first time, soon after installation. But in the next runs I get the error "Cannot read property 'applicationDirectory' of undefined".
ANSWER IN BELOW COMMENTS
My issue fixed when I used the "file:///android_asset/www/Images/" instead of
cordova.file.applicationDirectory+"/Images"