Problems running the command ionic cordova run android

I’m getting the following error when trying to run a project with the appodeal plugin. Does anyone know what this is about, and how could I resolve this error?

* Where:
Build file 'C:\Users\Diego\Desktop\appodeal- 
testar\platforms\android\com.appodeal.plugin\starter-adcolony\build.gradle' 
line: 47

* What went wrong:
A problem occurred evaluating project ':com.appodeal.plugin:starter- 
adcolony'.
> Could not get unknown property 'cdvCompileSdkVersion' for object of type 
com.android.build.gradle.LibraryExtension.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or -- 
debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s
Picked up _JAVA_OPTIONS: -Xmx512M
at ChildProcess.whenDone (C:\Users\Diego\Desktop\appodeal- 
testar\platforms\android\cordova\node_modules\cordova- 
common\src\superspawn.js:169:23)
at ChildProcess.emit (events.js:180:13)
at maybeClose (internal/child_process.js:936:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
(node:5188) UnhandledPromiseRejectionWarning: Unhandled promise rejection. 
This error originated either by throwing inside of an async function without 
a catch block, or by rejecting a promise which was not handled with 
.catch(). (rejection id: 1)
(node:5188) [DEP0018] DeprecationWarning: Unhandled promise rejections are 
deprecated. In the future, promise rejections that are not handled will 
terminate the Node.js process with a non-zero exit code.

The line to which he accuses the error is this:

android {
compileSdkVersion cdvCompileSdkVersion//linha 48 que acusa o erro
buildToolsVersion cdvBuildToolsVersion
publishNonDefault false

Open your Android Studio, click Configure > SDK Manager, in SDK Platforms tab install API level 28 (and 27 if needed), and SDK Tools tab install Android SDK Build-Tools.

After that, go to your project directory and type:

npm install -g ionic
npm install -g cordova
npm outdated
npm update
npm outdated

Check your environment variables in /etc/environment or .bashrc if you’re using Linux, eg:

GRADLE_HOME="/opt/android-studio/gradle/gradle-4.4"
ANDROID_HOME="/opt/android-studio"
JAVA_HOME="/opt/jdk"
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/opt/jdk/bin:/opt/android-studio/bin:/home/rodrigo/Android/Sdk/platform-tools:/home/rodrigo/Android/Sdk/tools:/home/rodrigo/Android/Sdk/build-tools:/opt/android-studio/gradle/gradle-4.4/bin"

Ensure that build-tools and licenses directories are linked into /opt/android (Android Studio) like this:

$ ls -l /opt/android-studio/
total 64
drwxrwxr-x  3 rodrigo rodrigo  4096 jul 23 18:24 bin
lrwxrwxrwx  1 rodrigo rodrigo    38 ago 23 10:22 build-tools -> /home/rodrigo/Android/Sdk/build-tools/
-rw-r--r--  1 rodrigo rodrigo    14 jul 23 14:19 build.txt
drwxrwxr-x  4 rodrigo rodrigo  4096 jul 23 18:24 gradle
-rw-r--r--  1 rodrigo rodrigo  1940 jul 23 14:19 Install-Linux-tar.txt
drwxrwxr-x  6 rodrigo rodrigo  4096 jul 23 18:24 jre
drwxrwxr-x  6 rodrigo rodrigo 12288 jul 23 18:24 lib
drwxrwxr-x  2 rodrigo rodrigo  4096 ago 23 13:00 license
lrwxrwxrwx  1 rodrigo rodrigo    35 ago 23 13:54 licenses -> /home/rodrigo/Android/Sdk/licenses/
-rw-r--r--  1 rodrigo rodrigo 11352 jul 23 14:19 LICENSE.txt
-rw-r--r--  1 rodrigo rodrigo   396 jul 23 14:19 NOTICE.txt
drwxr-xr-x  4 rodrigo rodrigo  4096 ago 27 16:05 platforms
drwxr-xr-x  5 rodrigo rodrigo  4096 ago 23 13:57 platform-tools
drwxrwxr-x 40 rodrigo rodrigo  4096 jul 23 18:24 plugins

Post the results.

Hi good afternoon, thank you for your response. I think the problem is not with my development environment, since I’ve run into several other applications, and I’ve usually compiled other projects that do not have this plugin. I believe that the problem is exclusively with this plugin, and not with the configuration of the machine, because the other procedures related to run and build, I am performing normal in other projects.

At a glance, as a user I would not be very thrilled with an app that brought all that bloaty junk onto my phone just to spam ads at me, but if you insist on trying to use it, first thing I would try is downgrading cordova-android:

$ ionic cordova platform rm android
$ ionic cordova platform add android@6.3.0

I agree with you, but this app consists solely and exclusively of displaying ads, which the owner will profit from and offer rewards through those views, but by the research I’ve done I’ve had unpleasant answers about this product, but as the customer insists, I’ll have what to do. I tried to do a downgrade of the cord exactly for this version, and did not obtain positive result.