Splashcreen Plugin (Cordova) and icons do not work on Crosswalk

4

I'm using this module that automatically adds a Crosswalk wrapper to a Cordova project.

Obs : It requires that the "platform" be [email protected].

Ok, so I give the command to do the Crosswalk Wrap in the project and everything goes well.

It builds normally with the dialogs plugin and more. However when I install the SplashScreen plugin and try to run it, an error occurs:

-pre-compile:
     [echo] Set jars path to: /home/rop/Projetos/Pray/cordovaa2/platforms/android/CordovaLib/ant-build/classes.jar:/home/rop/Projetos/Pray/cordovaa2/platforms/android/CordovaLib/xwalk_core_library/ant-build/classes.jar:/home/rop/Projetos/Pray/cordovaa2/platforms/android/CordovaLib/xwalk_core_library/libs/xwalk_core_library_java_app_part.jar:/home/rop/Projetos/Pray/cordovaa2/platforms/android/CordovaLib/xwalk_core_library/libs/xwalk_core_library_java_library_part.jar

-compile:
    [javac] Compiling 5 source files to /home/rop/Projetos/Pray/cordovaa2/platforms/android/ant-build/classes
    [javac] warning: /home/rop/Projetos/Pray/cordovaa2/platforms/android/CordovaLib/xwalk_core_library/libs/xwalk_core_library_java_app_part.jar(org/xwalk/core/XWalkView.class): major version 51 is newer than 50, the highest major version supported by this compiler.
    [javac] It is recommended that the compiler be upgraded.
    [javac] /home/rop/Projetos/Pray/cordovaa2/platforms/android/src/org/apache/cordova/splashscreen/SplashScreen.java:232: cannot find symbol
    [javac] symbol  : method canGoBack()
    [javac] location: class org.apache.cordova.CordovaWebView
    [javac]         if (webView.canGoBack()) {
    [javac]                    ^
    [javac] 1 error
    [javac] 1 warning

BUILD FAILED
/opt/android-sdk/tools/ant/build.xml:720: The following error occurred while executing this line:
/opt/android-sdk/tools/ant/build.xml:734: Compile failed; see the compiler error output for details.

Total time: 4 seconds

/home/rop/Projetos/Pray/cordovaa2/platforms/android/cordova/node_modules/q/q.js:126
                    throw e;
                          ^
Error code 1 for command: ant with args: debug,-f,/home/rop/Projetos/Pray/cordovaa2/platforms/android/build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-gen
ERROR running one or more of the platforms: Error: /home/rop/Projetos/Pray/cordovaa2/platforms/android/cordova/run: Command failed with exit code 8
You may not have the required environment or OS to run this project

My folder structure:

Myconfig.xml:

<?xml version="1.0" encoding="utf-8"?> <widget id="io.cordova.hellocordova" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> <name>appName</name> <description> A sample Apache Cordova application that responds to the deviceready event. </description> <author email="[email protected]" href="http://cordova.io"> Apache Cordova Team </author> <content src="index.html" /> <access origin="*" /> <platform name="android"> <splash src="res/android/screen/res-long-port-hdpi/default.png" densitit="port-hdpi"/> <splash src="res/android/screen/res-long-port-ldpi/default.png" densitit="port-ldpi"/> <splash src="res/android/screen/res-long-port-mdpi/default.png" densitit="port-mdpi"/> <splash src="res/android/screen/res-long-port-xhdpi/default.png" densitit="port-xhdpi"/> <icon src="res/android/icon/drawable-ldpi/appicon/png" density="ldpi" /> <icon src="res/android/icon/drawable-mdpi/appicon.png" density="mdpi" /> <icon src="res/android/icon/drawable-hdpi/appicon.png" density="hdpi" /> <icon src="res/android/icon/drawable-xhdpi/appicon.png" density="xhdpi" /> </platform> </widget>

PS : Also, the icons do not work, although they do not depend on Plugins ... Whenever I run, the app installs with Cordova default icon.     

asked by anonymous 06.03.2015 / 07:02

2 answers

3

As commented the problem does not appear before using cordova-android-crosswalk , this is due to the version of the Cordova library, Crosswalk requires version 3.6.3, this version has some differences between a class called CordovaWebView.java , basically it does not implement all class functions and separates between more files. I will not go into too much depth since the problem here is about Cordova and not Java.

But to solve the problem is quite simple, let's just edit a file.

Within the main folder of your project look for the file platforms/android/CordovaLib/src/org/apache/cordova/CordovaWebView.java

Open this file and right after the declaration of class CordovaWebView (line 80) paste the following code.

    public boolean canGoBack() {
        return super.getNavigationHistory().canGoBack();
    }

Then just try again to give the build command of your project.

    
19.03.2015 / 15:12
2

According to wikipedia :

  

J2SE 8 = 52
  J2SE 7 = 51
  J2SE 6.0 = 50
  J2SE 5.0 = 49
  JDK 1.4 = 48
  JDK 1.3 = 47
  JDK 1.2 = 46
  JDK 1.1 = 45

In your mistakes this appears:

  
warning: /home/rop/Projetos/Pray/cordovaa2/platforms/android/CordovaLib/xwalk_core_library/libs/xwalk_core_library_java_app_part.jar(org/xwalk/core/XWalkView.class): major version 51 is newer than 50, the highest major version supported by this compiler.

Let's pay special attention to this:

  

(org / xwalk / core / XWalkView.class): major version 51 is newer than 50, the highest major version supported by this compiler.

You have reported that your compiler (when trying to use javac -version ) is 1.6.0_34, ie major version 50 . However, it seems that the org.xwalk.core.XWalkView class has been compiled with Java 7 ( major version 51 ) and as a consequence the Java 6 compiler is not able to understand or use it. p>

To solve this, I see three possible alternatives (not mutually exclusive):

  • Upgrade your compiler to Java 7 or Java 8. However, care must be taken to make sure android will accept the resulting classes. If these classes use try-with-resources , then they will only work on Android KitKat (API level 19, Android 4.4) or higher ( Source ). Also, Android still does not support Java 8, but you can use it as one of the options when invoking the compiler, -target 1.6 or -target 1.7 .

  • Recompile these classes with the Java 6 compiler if you have source code .

  • Use a tool that downgrades the Java 7 (or 8) class to Java 6. The tool for this most popular purpose is retrolambda .

As for the icons, notice this in your XML:

<icon src="res/android/icon/drawable-ldpi/appicon/png" density="ldpi" />

Instead of appicon/png , it should be appicon.png . However, I do not know if that's all that's wrong or if there's anything else.

To know more details, you'd better describe your folder structure, especially what's inside res .

And some tips on your question:

  • You have forgotten to include tags and . As a result, few people saw their issue and it only caught my attention because of the active reward. Do not forget the tags next time!

  • Do not put code in image format as it is difficult to read (because the browser resizes the image) and text is not selectable. I just noticed the error of your icon when rewriting the entire XML when editing your question.

14.03.2015 / 04:58