Phonegap Build app using Crosswalk crashing on Android
Asked Answered
P

2

7

My app built with Phonegap Build and using the Crosswalk plugin is crashing after a little bit of use on Android. I have absolutely no idea why this is happening after constant Googling and debugging attempts. Any help is appreciated.

My logcat output right before and after the crash:

D/XWalkLib(26498): Pre init xwalk core in com.foo.bar.fooBAR
D/XWalkLib(26498): Reserve class class org.xwalk.core.XWalkPreferences to com.foo.bar.fooBAR
D/XWalkLib(26498): Reserve method setValue to com.foo.bar.fooBAR
D/XWalkLib(26498): Reserve class class org.xwalk.core.XWalkPreferences to com.foo.bar.fooBAR
D/XWalkLib(26498): Reserve method setValue to com.foo.bar.fooBAR
D/XWalkLib(26498): Reserve class class org.xwalk.core.XWalkPreferences to com.foo.bar.fooBAR
D/XWalkLib(26498): Reserve method setValue to com.foo.bar.fooBAR
D/XWalkLib(26498): Reserve class class org.xwalk.core.XWalkPreferences to com.foo.bar.fooBAR
D/XWalkLib(26498): Reserve method setValue to com.foo.bar.fooBAR
D/XWalkLib(26498): Reserve object class org.crosswalk.engine.XWalkCordovaView to com.foo.bar.fooBAR
D/XWalkLib(26498): Reserve object class org.crosswalk.engine.XWalkCordovaResourceClient to com.foo.bar.fooBAR
D/XWalkLib(26498): Reserve method setResourceClient to com.foo.bar.fooBAR
D/XWalkLib(26498): Reserve object class org.crosswalk.engine.XWalkCordovaUiClient to com.foo.bar.fooBAR
D/XWalkLib(26498): Reserve method setUIClient to com.foo.bar.fooBAR
W/ContextImpl(26498): Failed to ensure directory: /storage/extSdCard/Android/data/com.foo.bar/files
W/ContextImpl(26498): Failed to ensure directory: /storage/extSdCard/Android/data/com.foo.bar/cache
D/XWalkLib(26498): Reserve method setXWalkViewInternalVisibility to com.foo.bar.fooBAR
D/XWalkLib(26498): Reserve method setSurfaceViewVisibility to com.foo.bar.fooBAR
D/dalvikvm(26498): Trying to load lib /data/app-lib/com.foo.bar-1/libxwalkcore.so 0x42865d60
D/dalvikvm(26498): Added shared lib /data/app-lib/com.foo.bar-1/libxwalkcore.so 0x42865d60
D/dalvikvm(26498): Trying to load lib /data/app-lib/com.foo.bar-1/libxwalkdummy.so 0x42865d60
D/dalvikvm(26498): Added shared lib /data/app-lib/com.foo.bar-1/libxwalkdummy.so 0x42865d60
D/dalvikvm(26498): No JNI_OnLoad found in /data/app-lib/com.foo.bar-1/libxwalkdummy.so 0x42865d60, skipping init
D/XWalkLib(26498): Post init xwalk core in com.foo.bar.fooBAR
W/ContextImpl(26498): Failed to ensure directory: /storage/extSdCard/Android/data/com.foo.bar/cache
W/chromium(26498): [WARNING:xwalk_external_extension.cc(58)] Error loading extension '/data/app-lib/com.foo.bar-1/libxwalkcore.so': couldn't get XW_Initialize function.
W/chromium(26498): [WARNING:xwalk_extension_server.cc(412)] Failed to initialize extension: /data/app-lib/com.foo.bar-1/libxwalkcore.so
W/chromium(26498): [WARNING:xwalk_external_extension.cc(58)] Error loading extension '/data/app-lib/com.foo.bar-1/libxwalkdummy.so': couldn't get XW_Initialize function.
W/chromium(26498): [WARNING:xwalk_extension_server.cc(412)] Failed to initialize extension: /data/app-lib/com.foo.bar-1/libxwalkdummy.so

And the preferences and plugins in my config.xml file:

<gap:config-file platform="android" parent="/manifest/application">
    <activity android:launchMode="standard" />
  </gap:config-file>

  <preference name="permissions" value="none"/>
  <preference name="orientation" value="portrait"/>
  <preference name="target-device" value="handset"/>
  <preference name="fullscreen" value="false"/>
  <preference name="webviewbounce" value="true"/>
  <preference name="prerendered-icon" value="true"/>
  <preference name="stay-in-webview" value="false"/>
  <preference name="detect-data-types" value="true"/>
  <preference name="exit-on-suspend" value="false"/>

  <preference name="AutoHideSplashScreen" value="true"/>
  <preference name="ShowSplashScreenSpinner" value="false"/>
  <preference name="FadeSplashScreen" value="false"/>
  <preference name="SplashScreen" value="screen" />

  <preference name="disable-cursor" value="false"/>
  <preference name="android-minSdkVersion" value="14"/>
  <preference name="android-installLocation" value="auto"/>

  <preference name="StatusBarStyle" value="blacktranslucent" />
  <preference name="StatusBarOverlaysWebView" value="false" />
  <preference name="StatusBarBackgroundColor" value="#008b95" />

  <preference name="DisallowOverscroll" value="true" />
  <preference name="android-build-tool" value="gradle" />
  <preference name="UIWebViewBounce" value="false" />

  <preference name="phonegap-version" value="cli-6.1.0" />

  <platform name="android">  
    <preference name="android-versionCode" value="1" />

    <plugin name="cordova-build-architecture"      spec="https://github.com/MBuchalik/cordova-build-architecture.git#v1.0.1"     source="git" />

    <plugin name="cordova-plugin-crosswalk-webview" spec="https://github.com/crosswalk-project/cordova-plugin-crosswalk-webview.git" source="git" />
    <preference name="xwalkMode" value="embedded" />
    <preference name="xwalkVersion" value="org.xwalk:xwalk_core_library_beta:19+" />
  </platform>

  <gap:plugin name="cordova-plugin-inappbrowser" source="npm"/>
  <gap:plugin name="org.apache.cordova.console"/>
  <gap:plugin name="org.apache.cordova.device"/>
  <gap:plugin name="org.apache.cordova.dialogs" />
  <gap:plugin name="cordova-plugin-statusbar" source="npm"/>
  <gap:plugin name="cordova-plugin-splashscreen" source="npm"/>
  <gap:plugin name="pushwoosh-cordova-plugin" source="npm" />
  <gap:plugin name="nl.x-services.plugins.launchmyapp" spec="3.0" source="pgb">
    <param name="URL_SCHEME" value="mosaicties" />
  </gap:plugin>
  <plugin name="com.sharinglabs.cordova.plugin.cache" spec="1.0.0" source="pgb" />
  <plugin name="org.apache.cordova.file-transfer" spec="0.5.0" source="pgb" />
  <plugin name="com.virtualartifacts.webintent" spec="1.0.0" source="pgb" />

Any insight or help that anyone can provide would be great.

Panama answered 22/7, 2016 at 22:15 Comment(11)
Did you try clearing the app data?Kwabena
@Panama Possible to share the code or apk for testing on device?Surra
@AbhishekJain what do you mean clearing the app data?Panama
@Surra How do you recommend I host or get an APK to you for testing? Thanks :)Panama
@Panama you can post the code in githubSurra
@Surra well I would rather just send you an APK or post one somewhere for you to access, the project is quite extensivePanama
@Panama ya should be fine. Just wanna debug the crash logSurra
@tommybond: via the app's setting page on your phone.Kwabena
@Panama Since there is no update on this, i m gonna guess now. Do u have enough memory in your device while testing? Are you running any other resource intensive background process? Does this happen across all devices?Surra
@Panama try with another version of crosswalk, a stable one like <preference name="xwalkVersion" value="org.xwalk:xwalk_core_library:18+" />?Jest
If you use crosswalk lite version, you should check this thread: crosswalk-project.org/jira/si/jira.issueviews:issue-html/…Patentee
B
0

the stacktrace reads:

D/dalvikvm(26498): No JNI_OnLoad found in /data/app-lib/com.foo.bar-1/libxwalkdummy.so 0x42865d60, skipping init

this either means, that the JNI Specification within the Java source is absent and subsequently leads to the Error loading extension and Failed to initialize extension errors - or it might read Failed to load native library elsewhere (probably the root cause, as the error tells).

make sure that a) native assembly gets loaded with System.loadLibrary() and b) that the JNI native interface functions have been defined.

@see Android JNI Tips or Crosswalk's Jira.

Bergschrund answered 1/8, 2016 at 22:23 Comment(5)
Do you know of a way I can ensure these things are happening using Phonegap Build? Or do you know if this is something that is on Crosswalk's end?Panama
@Panama try building with Android Studio or Eclipse. these JNI bindings might also be contained in a jar which accompanies the so. when both, native and java libraries are loaded, the output should look different.Bergschrund
Unfortunately I'm stuck using Phonegap Build for this particular app :/Panama
@Panama Android Studio has a plugin for Cordova/PhoneGap, while it builds with Gradle. just use an IDE, otherwise it's no wonder to be stuck - because Java code with broken references just won't build. it seems, that you may confuse tool-chain with the IDE... because basically can build with any tool-chain. make sure to have the libs and JNIlibs referenced, then it should build the Java/Android project - while this Java project won't build, the phonegap build will fail subsequently (unless removing platform Android).Bergschrund
it doesn't even care if Cordova, PhoneGap or Ionic: jetbrains.com/help/idea/2016.2/using-phonegap-cordova.htmlBergschrund
E
-2

i sugest you remove the android platform then add again. Then build again. This helped me a while ago.

Elutriate answered 1/8, 2016 at 20:9 Comment(2)
This is not an answer, more like a comment.Grimmett
I can't remove specific platforms and re-add them. As stated in the question title and the question text itself, I am using Phonegap Build, not Cordova or Phonegap CLI.Panama

© 2022 - 2024 — McMap. All rights reserved.