Not compiling with Cordova 9 & Ionic 3
Closed this issue · 12 comments
Hey there, I'm running an app using Cordova 9 and Ionic 3, unfortunately when I add this plugin it fails to compile with following error:
- What went wrong:
A problem occurred configuring project ':app'.
groovy.lang.GroovyRuntimeException: Could not find matching constructor for: java.io.File(org.gradle.api.internal.file.DefaultFilePropertyFactory$DefaultDirectoryVar, String)
Let me know if there's any additional info you need, not sure if this is still maintained but it would be incredible if it does end up working!
Never seen such an error on my end, it works with cordova 9 and even 10 normally. Might be related to gradle but i don't know much about gradle/java.
Could you please tell me what version of gradle you have? Just type gradle in the terminal.
Here it is:
Gradle 6.2
Build time: 2020-02-17 08:32:01 UTC
Revision: 61d3320259a1a0d31519bf208eb13741679a742f
Kotlin: 1.3.61
Groovy: 2.5.8
Ant: Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM: 1.8.0_251 (Oracle Corporation 25.251-b08)
OS: Windows 10 10.0 amd64
Also, I have cordova 10 installed.
That's really weird, I'm on 6.6.1 and I tried 5.4.6 and I'm still getting the same error, it seems to have a problem with this line in the gradle file:
def outFile = new File (mergeTask.outputDir, "xwalk-command-line")
I'll test your same exact gradle version and update you.
Here is something that may help you. Check my project gradle files inside, maybe you see some difference that may cause the error.
Also crosswalk gradle config:
attornaid-xwalk.gradle.txt
So it seems there's some deprecated syntax being used that gradle wasn't liking (I think my project forced me to 6.5), here's what I changed. The very last portion of the xwalk.gradle file that's generated for the project from:
android.applicationVariants.all { variant ->
def variantName = variant.name.capitalize()
def mergeTask = tasks["merge${variantName}Assets"]
def processTask = tasks["process${variantName}Resources"]
def outFile = new File (mergeTask.outputDir, "xwalk-command-line")
def newTask = project.task("createXwalkCommandLineFile${variantName}") << {
mergeTask.outputDir.mkdirs()
outFile.write("xwalk ${xwalkCommandLine}\n")
}
newTask.dependsOn(mergeTask)
processTask.dependsOn(newTask)
}
to:
android.applicationVariants.all { variant ->
def variantName = variant.name.capitalize()
def mergeTask = tasks["merge${variantName}Assets"]
def processTask = tasks["process${variantName}Resources"]
def outFile = new File(file(mergeTask.outputDir), "xwalk-command-line")
def newTask = project.task("createXwalkCommandLineFile${variantName}") doLast {
mkdir(mergeTask.outputDir)
outFile.write("xwalk ${xwalkCommandLine}\n")
}
newTask.dependsOn(mergeTask)
processTask.dependsOn(newTask)
}
After fixing the 'new File' line, I got another issue with the >> being deprecated and a quick search told me to change it to doLast, also .mkdirs() seems to no longer exist, and was replaced by mkdir(object).
Not sure how these changes might affect older versions of gradle, but might be worth a change!
Thanks @tawakol for the detailed report. For now anybody experiencing same issue can make it work by doing manual changes like you did. I ll have a look at it later to reproduce it on my end.
Thanks for letting us able to build the debug-apk. However, there are some of the web components still unable to work even i successfully build it. May i know are those web components only works after i build --release ? thanks
@alvin30595 if something inside the app is not working properly, it is probably an html/javascript issue. You should build a debug build and inspect in chrome using chome://inspect
. Maybe you are using something too new for crosswalk chromium version which is 54.
@ardabeyazoglu Yes, I checked that as well, but nothing wrongs with the code. I believe marquee is not something too new for crosswalk 54