missing cordova_plugins.js Failed to load resource

  • 2
  • Question
  • Updated 4 years ago
file:///android_asset/www/cordova_plugins.js Failed to load resource: net::ERR_FILE_NOT_FOUND

I have researched this and it seems from everything I have read it something on your end, I am referencing cordova.js not phonegap.js and I am still experiencing this issue.
Photo of Jamie Steele

Jamie Steele

  • 27 Posts
  • 0 Reply Likes

Posted 4 years ago

  • 2
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
Perhaps your option 'frequency' is wrong.
The docs example says 'frequency', but the docs text says 'period'.

Try 'period'.
Photo of Jamie Steele

Jamie Steele

  • 27 Posts
  • 0 Reply Likes
It hits the success now but it always has the same values everytime
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
On a real device, or on some emulator/debugger?
Photo of Jamie Steele

Jamie Steele

  • 27 Posts
  • 0 Reply Likes
On a real device a Nexus 4 It works perfect on an emulator
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
So, what values do you always get?
And do you get different values if you reboot and restart the app?
And are these values any different from your initial getCurrentAcceleration()?
Photo of Jamie Steele

Jamie Steele

  • 27 Posts
  • 0 Reply Likes
It's different values each time I start the app it's always the same as the first time though
Photo of Jamie Steele

Jamie Steele

  • 27 Posts
  • 0 Reply Likes
I read something about the frequency affecting duplicate values on android, possible I need to set the frequency to a lower value
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
I think you should use a much larger value.
Be also aware that the plugin docs mention Milliseconds, while the Android Sensor docs mention Microseconds. My guess is that the plugin docs are wrong here, too.

You should be able to verify this, though, using the timestamp coming with the success callback parameters.
Photo of JesseMonroy650 (Volunteer)

JesseMonroy650 (Volunteer), Champion

  • 3325 Posts
  • 122 Reply Likes
@Jamie
Since this is your first post, please answer the following question.
- Is this your first hybrid App?
- Are you using the Phonegap Desktop App?
- Are you using CLI, SDK or Build? Please do not assume the answer, please read the link.

Jesse
Photo of Jamie Steele

Jamie Steele

  • 27 Posts
  • 0 Reply Likes
This is my first app, I am not using the desktop app, and I'm using Build.
Photo of JesseMonroy650 (Volunteer)

JesseMonroy650 (Volunteer), Champion

  • 3325 Posts
  • 122 Reply Likes
@Jamie
are you using CLI at all?
You mention Ripple emulator. So your comments are inconsistent.
Can you explain?
Jesse
Photo of Jamie Steele

Jamie Steele

  • 27 Posts
  • 0 Reply Likes
I am running a premade build my proffeser made to work with the ripple editor, I am trying to use Adobe phonegap to create a build for android
Photo of JesseMonroy650 (Volunteer)

JesseMonroy650 (Volunteer), Champion

  • 3325 Posts
  • 122 Reply Likes
Okay. Thanks.
Did your proffeser say this would work with build.phonegap.com?
Please be aware that if he used Phonegap CLI to create this "premade build", it will not work with build.phonegap.com without special changes.

AND if you proffeser does not know this, he needs to make very clear that build.phonegap.com will NOT work with Phonegap CLI - AS IS. In addition, using CLI with Build is an advance subject and he should reconsider his lessons (if he is doing this).

Lastly, using CLI created files with Build is a very common mistake.

This FAQ should help. Read the bold sentences first.
Top Mistakes by Developers new to Cordova/Phonegap

Let me know what you want to do.

Jesse
Photo of Jamie Steele

Jamie Steele

  • 27 Posts
  • 0 Reply Likes
Starter Files

This directory contains the working app that will work in the Ripple simulator.
It contains the phonegap.js JavaScript file. This file is really the cordoba.js file that has been re-named to phonegap.js. It's version 2.0 and that's the version that still works well with Ripple emulator. However, Adobe PhoneGap build will substitute the version of phonegap.js specified in the config.xml during the build process.

www directory:
This directory is a copy of the working app that is sent to build.phonegap.com . There are two important differences in this directory:
it is missing the phonegap.js JavaScript file (but not the reference to it in index.html)

It contains a config.xml file that describes the PhoneGap project.
apk file:
This is the file that can be loaded to an android phone and installed as an app.
This file can be generated by build.phonegap.com

www.zip:
This is the zipped contents of the www directory and is the file you upload to build.phonegap.com

Ripple Emulator
Use this Chrome extension to develop and test your app: (Chrome web store)
Important: You will need to load your app from a Web Server and not a local file for it to work.
Install this extension into Chrome. Ripple Emulator is a chrome extension and can be found by googling Ripple Emulator (Beta) for Chrome or following the above link.

This is a description of the files we were given.
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
As far as I can see, that description is correct.
Photo of JesseMonroy650 (Volunteer)

JesseMonroy650 (Volunteer), Champion

  • 3325 Posts
  • 122 Reply Likes
@Jamie,
while I read the entire thread again, I will note the description is a bit convoluted (but essentially correct). Is there any part that seems odd to you?

Jesse
Photo of JesseMonroy650 (Volunteer)

JesseMonroy650 (Volunteer), Champion

  • 3325 Posts
  • 122 Reply Likes
@Jamie,
can you put the code up so Petra & I can look at the current version?
Jesse
Photo of Jamie Steele

Jamie Steele

  • 27 Posts
  • 0 Reply Likes
Here is a link to a pastebin of my code,

http://pastebin.com/m8uUaV1H
Photo of JesseMonroy650 (Volunteer)

JesseMonroy650 (Volunteer), Champion

  • 3325 Posts
  • 122 Reply Likes
@Jamie,
I looked at your code. I could complain about style, but my real concern is
if (previousAcceleration.x == null && previousAcceleration.y == null && previousAcceleration.z == null) {

The assignment to the variable set (previousAcceleration) is buried. How do you know it even gets there? It's also an awkward way of doing things.

Jesse
Photo of Jamie Steele

Jamie Steele

  • 27 Posts
  • 0 Reply Likes
In the debugger it does hit that line of code, I am wondering though what would be another way of setting the previous acceleration the first time the success statement is ran?
Photo of JesseMonroy650 (Volunteer)

JesseMonroy650 (Volunteer), Champion

  • 3325 Posts
  • 122 Reply Likes
@Jamie,
I don't know what you are trying to do, so I can't help. I suggest you write out the logic in English, then work from there. Using Internal values as flags is valid, but generally you want to remove the value from the logical flow.

For instance, I might write.

flagX = previousAcceleration.x
flagY = previousAcceleration.y
flagZ = previousAcceleration.z

if (flagX == null && flagY == null && flagZ == null)


The advantage of this is that you can override the logic and see if the values are the problem.

REMEMBER: Javascript has a notion called "truthy" and "falsey". This means a value can be evaluated to true or false. Javascript does NOT have a strict boolean like other languages. The best you can do is:


if (flagX === null && flagY === null && flagZ === null)


This means the value is null and *must* be null.
The previous was the value is like null.

Jesse