NullPointer exception in Cordoba 3.5.

I recently updated the application for cordova from version 2.9 to version 3.5. I added the necessary plugins via the command line and made a cordless build of my application. I get a Nullpointer exception when reading / writing a file through a plugin. The following is a stack trace:

07-08 18:58:40.750: W/System.err(6670): java.lang.NullPointerException
07-08 18:58:40.750: W/System.err(6670):     at org.apache.cordova.file.LocalFilesystem.filesystemPathForURL(LocalFilesystem.java:67)
07-08 18:58:40.750: W/System.err(6670):     at org.apache.cordova.file.LocalFilesystem.getFileForLocalURL(LocalFilesystem.java:189)
07-08 18:58:40.750: W/System.err(6670):     at org.apache.cordova.file.FileUtils.getFile(FileUtils.java:749)
07-08 18:58:40.760: W/System.err(6670):     at org.apache.cordova.file.FileUtils.access$5(FileUtils.java:742)
07-08 18:58:40.760: W/System.err(6670):     at org.apache.cordova.file.FileUtils$16.run(FileUtils.java:397)
07-08 18:58:40.760: W/System.err(6670):     at org.apache.cordova.file.FileUtils$23.run(FileUtils.java:525)
07-08 18:58:40.760: W/System.err(6670):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
07-08 18:58:40.760: W/System.err(6670):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
07-08 18:58:40.760: W/System.err(6670):     at java.lang.Thread.run(Thread.java:856)

I need immediate help here.

Nullpointer exception thrown but need help accessing files

I would like to know what the URL pattern should be for accessing the file from a private application. In cordova 2.9 I referred to it as /data/data/com.myapp.android/abc.txtwith Javascript. Can I find out which URL format is now in cordova 3.5?

+4
source share
4 answers

, /mnt/sdcard/Android/data/com.myapp.android/. , .

/ javascript Cordova, : Android/data/com.myapp.android/abc.txt. File Compatibility AndroidPersistentFileLocation config.xml, /mnt/sdcard ( ), Android.

: Google

+4

config.xml

<preference name="AndroidPersistentFileLocation" value="Internal" />

<preference name="AndroidPersistentFileLocation" value="Compatibility" />

, ( 1.0) , "". "" , , , , .

EDTT

,

cdvfile:///data/data/com.myapp.android

+5

window.resolveLocalFileSystemURI(URI, function(f){
    var filePath = f.fullPath;
}

URI /data/data/com.myapp.android/abc.txt abc.txt

+2

Android. config.xml

preference name= "AndroidPersistentFileLocation" = ""

+1
source

Source: https://habr.com/ru/post/1547234/


All Articles