Android - Cordova 3.5.0 deviceready 在安装媒体插件后不会触发

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24470166/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 08:14:52  来源:igfitidea点击:

Android - Cordova 3.5.0 deviceready not firing after installing media plugin

androidcordova

提问by AdityaParab

This is interesting and weird issue.

这是一个有趣而奇怪的问题。

First I created Cordova project locally. I'm not using Bd. using

首先我创建了 Cordova 项目locally。我不使用Bd. 使用

cordova create test com.test.project.story "Test"

cordova create test com.test.project.story "Test"

Which worked successfully!

哪个成功!

Then I added androidplatform, using

然后我添加了android平台,使用

cordova platform add android

cordova platform add android

Worked successfully.

工作成功。

Then I built the project using

然后我使用

cordova build

cordova build

Worked, again.

又工作了

I opened the project from Eclipse and ran it on emulator. Worked properly.

我从 Eclipse 打开项目并在模拟器上运行它。工作正常。

Then I thought of adding some plugins in my project using

然后我想在我的项目中添加一些插件使用

cordova plugin add org.apache.cordova.file
cordova plugin add org.apache.cordova.media

Removed the android platform and added the platform again. Then built and ran the project on emulator.

删除了android平台,重新添加了平台。然后在模拟器上构建并运行项目。

The screen was stuck on Connecting to deviceforever.

屏幕Connecting to device永远停留在屏幕上。

I rechecked if I was using the correct cordova.jsfor android platform. It is correct, and it says

我重新检查了我是否使用了正确cordova.js的 android 平台。这是正确的,它说

// Platform: android
// 3.5.0

Checked ADB log and there are a lot of suspicious things going on.

检查亚行日志,有很多可疑的事情正在发生。

D/CordovaWebViewClient( 1581): onPageFinished(file:///android_asset/www/index.html)
D/CordovaActivity( 1581): onMessage(onPageFinished,file:///android_asset/www/index.html)
D/CordovaActivity( 1581): onMessage(spinner,stop)
D/TilesManager( 1581): new EGLContext from framework: 2a1a2a10 
D/GLWebViewState( 1581): Reinit shader
D/dalvikvm(  270): GC_CONCURRENT freed 322K, 46% free 9831K/17991K, paused 813ms+21ms, total 2252ms
D/dalvikvm(  270): WAIT_FOR_CONCURRENT_GC blocked 906ms
D/GLWebViewState( 1581): Reinit transferQueue
W/ApplicationContext( 1581): Unable to create external files directory
D/        ( 1581): HostConnection::get() New Host Connection established 0x4a5f8558, tid 1605
E/PluginManager( 1581): Uncaught exception from plugin
E/PluginManager( 1581): java.lang.NullPointerException
E/PluginManager( 1581):     at org.apache.cordova.file.FileUtils.requestAllPaths(FileUtils.java:866)
E/PluginManager( 1581):     at org.apache.cordova.file.FileUtils.execute(FileUtils.java:348)
E/PluginManager( 1581):     at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:65)
E/PluginManager( 1581):     at org.apache.cordova.PluginManager.execHelper(PluginManager.java:242)
E/PluginManager( 1581):     at org.apache.cordova.PluginManager.exec(PluginManager.java:227)
E/PluginManager( 1581):     at org.apache.cordova.ExposedJsApi.exec(ExposedJsApi.java:53)
E/PluginManager( 1581):     at org.apache.cordova.CordovaChromeClient.onJsPrompt(CordovaChromeClient.java:227)
E/PluginManager( 1581):     at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:655)
E/PluginManager( 1581):     at android.os.Handler.dispatchMessage(Handler.java:99)
E/PluginManager( 1581):     at android.os.Looper.loop(Looper.java:137)
E/PluginManager( 1581):     at android.app.ActivityThread.main(ActivityThread.java:4745)
E/PluginManager( 1581):     at java.lang.reflect.Method.invokeNative(Native Method)
E/PluginManager( 1581):     at java.lang.reflect.Method.invoke(Method.java:511)
E/PluginManager( 1581):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
E/PluginManager( 1581):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
E/PluginManager( 1581):     at dalvik.system.NativeStart.main(Native Method)
D/dalvikvm(  270): GC_FOR_ALLOC freed 593K, 48% free 9509K/17991K, paused 275ms, total 280ms
I/dalvikvm-heap(  270): Grow heap (frag case) to 10.559MB for 1286224-byte allocation
D/dalvikvm(  270): GC_FOR_ALLOC freed 2K, 41% free 10763K/17991K, paused 182ms, total 186ms
D/dalvikvm(  270): GC_CONCURRENT freed 61K, 38% free 11284K/17991K, paused 41ms+11ms, total 304ms
D/CordovaActivity( 1581): onMessage(spinner,stop)
D/dalvikvm(  270): GC_CONCURRENT freed 2676K, 43% free 10293K/17991K, paused 16ms+29ms, total 130ms
D/CordovaLog( 1581): file:///android_asset/www/cordova.js: Line 1154 : deviceready has not fired after 5 seconds.
I/Web Console( 1581): deviceready has not fired after 5 seconds. at file:///android_asset/www/cordova.js:1154
D/CordovaLog( 1581): file:///android_asset/www/cordova.js: Line 1147 : Channel not fired: onFileSystemPathsReady
I/Web Console( 1581): Channel not fired: onFileSystemPathsReady at file:///android_asset/www/cordova.js:1147
E/ThrottleService(  149): problem during onPollAlarm: java.lang.IllegalStateException: problem parsing stats: java.io.FileNotFoundException: /proc/net/xt_qtaguid/iface_stat_all: open failed: ENOENT (No such file or directory)
D/dalvikvm(  251): GC_CONCURRENT freed 384K, 9% free 6556K/7175K, paused 7ms+5ms, total 67ms
D/dalvikvm(  251): GC_CONCURRENT freed 384K, 9% free 6556K/7175K, paused 6ms+13ms, total 62ms
I/EventLogService(  240): Aggregate from 1403981475023 (log), 1403981475023 (data)
E/ThrottleService(  149): problem during onPollAlarm: java.lang.IllegalStateException: problem parsing stats: java.io.FileNotFoundException: /proc/net/xt_qtaguid/iface_stat_all: open failed: ENOENT (No such file or directory)

What's going on here?

这里发生了什么?

UPDATE:

更新:

Works fine on iOS.

在 iOS 上运行良好。

采纳答案by jeff.d

I ran into the same issue.

我遇到了同样的问题。

What worked for me was using a different version of the File plugin found here: https://github.com/onflapp/cordova-plugin-file

对我有用的是使用此处找到的不同版本的文件插件:https: //github.com/onflapp/cordova-plugin-file

Related topic: Cordova File plugin never becomes ready in Android

相关主题:Android 中的 Cordova 文件插件永远不会准备就绪

回答by enRaiser

for me it got solved by adding cordova.js in index.html( though its not required in ripple)

对我来说,它通过在 index.html 中添加 cordova.js 来解决(尽管它在涟漪中不需要)

<script src="cordova.js"></script>

回答by Simone Avogadro

I ran into the same and resolved using apache officialdev build File plugin:

我遇到了同样的问题并使用apache 官方开发构建文件插件解决了:

Funny enough cordova release 1.3.1-dev is more stable then official release 1.2.0 ...

有趣的是,cordova 版本 1.3.1-dev 比正式版本 1.2.0 更稳定......

回答by Henrik H

By now a newer version of the file pluginhas been released. You should no longer experience the issue with the updated version (and there is thus no longer a need to downgrade).

到目前为止,文件插件更新版本已经发布。您应该不会再遇到更新版本的问题(因此不再需要降级)。

回答by Amrudesh

I had a similar issue. deviceReady event was not firing (ionic app on android). Worked after I removed the file plugin v1.2 and then added v1.1 instead.

我有一个类似的问题。deviceReady 事件未触发(Android 上的离子应用程序)。在我删除文件插件 v1.2 然后添加 v1.1 后工作。