the economy of the motherland is recovering, and people of all ethnic groups are actively engaged in the task of restoring production. As a codemaker, I have also been nervous for a long time. Recently, I have been busy with several projects, including an app, which needs to be quickly set up for preview and test, so I directly listed Cordova. However, I am surprised to step on it.
, there’s nothing wrong with building the project, it just came to me during the build:
Requirements check failed for JDK 8 ('1.8.*')! Detected version:11.0.7
Check your ANDROID_SDK_ROOT/JAVA_HOME/PATH environment variables.
indicates clearly that jdk11 does not match the required jdk8 for cordova. The reason is also clear, as the native environment was upgraded from JDK8 to JDK11 a while ago.
the problem now is that I don’t want to change java_home back to 8, because all the compiled versions of all the items on the machine have changed to jdk11, which would take me half a day to fix. (and a lot of history projects in Eclipse)
I use [email protected], which was released a year ago, but the latest cordova10 in NPM, which is still at nightly (compiled daily), is not even rc and is obviously not recommended in a production environment. In other words, Cordova9 is the latest stable edition, so I can’t expect to change the status quo by upgrading Cordova9.
also tried to set java.home in IDE (vscode), but it was useless. This setting is only valid for the Java plug-in of VSC, but it is incapable of cordova.
after many thoughts, if cordova cannot be surrendered, I will have to fall back to jdk8.
since cordova is based on nodejs, it occurs to me that all the hints should be in the clear text code. So a hard-hearted search keyword Requirements check failed for the whole project.
is actually retrieved:
in platforms/android cordova/lib/check_reqs js files in the module. Exports. The run method, related to the one and only one place!
and it says:
// Returns a promise.
module.exports.run = function () {
return Q.all([this.check_java(), this.check_android()]).then(function (values) {
console.log('Checking Java JDK and Android SDK versions');
console.log('ANDROID_SDK_ROOT=' + process.env['ANDROID_SDK_ROOT'] + ' (recommended setting)');
console.log('ANDROID_HOME=' + process.env['ANDROID_HOME'] + ' (DEPRECATED)');
if (!String(values[0]).startsWith('1.8.')) {
throw new CordovaError(
'Requirements check failed for JDK 8 (\'1.8.*\')! Detected version: ' + values[0] + '\n' +
'Check your ANDROID_SDK_ROOT/JAVA_HOME/PATH environment variables.'
);
}
if (!values[1]) {
throw new CordovaError('Requirements check failed for Android SDK! Android SDK was not detected.');
}
});
};
sees the 1.8 criterion, and the check_java method also makes it clear that the Java environment is being judged. So the “1.8.” directly changed to “11.”, and the compilation passed smoothly.
postscript:
first of all, I do not recommend arbitrary changes to the dependent framework source code, which will not only affect subsequent updates to the framework, but also cause unknown exceptions. But there is no way, this is only a temporary solution.
I don’t know if cordova9 has a key piece that relies only on jdk8, and I don’t know what effect jdk11 will have on cordova9, but I do think it’s clear that if you want to minimize the impact by changing one piece of code, the impact is really small.
Read More:
- When using ionic to build Android APK, Cordova error is reported: requirements check failed for JDK 1.8 or greater
- The problem of MAC switching JDK version and RN Android JDK version leads to compilation failure. Solve it
- Solve the problem of jdk8 after win7 is installed. Has value ‘1.8’, but ‘1.7’ is required
- How to Solve All masterha_check_repl Error
- How to solve the problem that lightningchart is completely black
- How to solve the problem of creating notebook failed
- ionic android Current working directory is not a Cordova-based project.
- Clion appears cmake error: could not find cmake_ Root! What is the problem and how to solve it?
- How to solve the problem of “version 11 or greater is required” in eclipse 2020
- The spring boot project was first created, pom.xml The error is Maven configuration problem. How to solve it?
- How to solve the problem of “please enter a commit message to explain why this merge is necessary” when git merges branches?
- How to Fix nbconvert failed: Pandoc wasn’t found. Please check that pandoc is installed:
- How to solve problems like curl: (7) failed to connect to raw.githubusercontent.com Port 443: problem with connection used
- When installing oracle12c, the problem of “unable to check whether the specified location is on CFS” appears
- numpy.core.umath How to solve the problem of failed to import
- To solve the problem of failed to load: data in HTML5 game running rmmv locally/ actors.json problem
- How to solve the problem of Cannot find module’npmlog’ when installing nodejs under Linux
- How to solve the problem of failed installation of golang plug-in dependency in vscode under Windows
- Built on Ethereum, puppeth cannot be used to create the initial block, and an error is reported Fatal: Failed to write genesis block: unsupported fork ordering: eip15
- Solve the problem of failed to create the Java virtual machine when eclipse is opened