IONIC WhitelistPlugin cannot find symbol

Table of Contents

IONIC WhitelistPlugin cannot find symbol

[cordova] D:\sync\websvr\ionic\test\reader\envirotech_book_reader_mobile\platforms\android\app\src\main\java\org\apache\cordova\whitelist\WhitelistPlugin.java:62: error: cannot find symbol
[cordova]             allowedIntents = new Whitelist();
[cordova]                                  ^
[cordova]   symbol:   class Whitelist
[cordova]   location: class org.apache.cordova.whitelist.WhitelistPlugin
[cordova] D:\sync\websvr\ionic\test\reader\envirotech_book_reader_mobile\platforms\android\app\src\main\java\org\apache\cordova\whitelist\WhitelistPlugin.java:63: error: cannot find symbol
[cordova]             allowedRequests = new Whitelist();
[cordova]                                   ^
[cordova]   symbol:   class Whitelist
[cordova]   location: class org.apache.cordova.whitelist.WhitelistPlugin
[cordova] Note: Some input files use or override a deprecated API.
[cordova] Note: Recompile with -Xlint:deprecation for details.
[cordova] 25 errors
[cordova]
[cordova] FAILURE: Build failed with an exception.
[cordova]
[cordova] * What went wrong:
[cordova] Execution failed for task ':app:compileDebugJavaWithJavac'.
[cordova] > Compilation failed; see the compiler error output for details.
[cordova]
[cordova] * Try:
[cordova] Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
[cordova]
[cordova] * Get more help at https://help.gradle.org
[cordova]
[cordova] BUILD FAILED in 5s
[cordova] Command failed with exit code 1: D:\sync\websvr\ionic\test\reader\envirotech_book_reader_mobile\platforms\android\gradlew cdvBuildDebug -b D:\sync\websvr\ionic\test\reader\envirotech_book_reader_mobile\platforms\android\build.gradle
[ERROR] An error occurred while running subprocess cordova.

        cordova.cmd build android --device exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.

Cordova 10+ includes the Whitelist class and no external plugin is required. In addition to removing it you also need to update the file transfer plugin.

So, you need to do two things:

  1. Update the file transfer plugin. Even though this plugin is no longer recommended, the developer has thankfully updated the plugin to support the new Whitelist class, which is now included by default in Cordova. You will have to do this by installing directly from the github repo:

    cordova plugin add https://github.com/apache/cordova-plugin-file-transfer.git

  2. Remove the whitelist plugin

    cordova plugin rm cordova-plugin-whitelist

H/T to the original response in this [thread][1]

checkout the file transfer plugin issues [1]: https://githubmemory.com/repo/apache/cordova-plugin-file-transfer/issues/306


Leave a Reply

Your email address will not be published. Required fields are marked *