Unable to build apk from ionic

I am unable to build apk from ionic project pls check my errors and suggest me the solution.

C:\Windows\System32\baechat>ionic cordova build android

cordova build android
Android Studio project detected

cp: copyFileSync: could not write to dest file (code=EPERM):C:\Windows\System32
baechat\platforms\android\app\src\main\assets\www\img\Thumbs.db

Running command: “C:\Program Files\nodejs\node.exe” C:\Windows\System32\baechat
hooks\after_prepare\010_add_platform_class.js C:\Windows\System32\baechat

ANDROID_HOME=C:\Users\win8\android-sdks
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_161
studio
Subproject Path: CordovaLib
Subproject Path: app
publishNonDefault is deprecated and has no effect anymore. All variants are now
published.

The Task.leftShift(Closure) method has been deprecated and is scheduled to be re
moved in Gradle 5.0. Please use Task.doLast(Action) instead.

    at build_4wecvt8k0hv9cy72vm8pbizq0.run(C:\Windows\System32\baechat\platf

orms\android\app\build.gradle:144)
Configuration ‘compile’ in project ‘:app’ is deprecated. Use ‘implementation’ in
stead.

:CordovaLib:preBuild
UP-TO-DATE
:CordovaLib:preDebugBuild UP-TO-DATE

:CordovaLib:compileDebugAidl

UP-TO-DATE
:CordovaLib:compileDebugRenderscript

UP-TO-DATE
:CordovaLib:checkDebugManifest
UP-TO-DATE
:CordovaLib:generateDebugBuildConfig

UP-TO-DATE
:CordovaLib:prepareLintJar

UP-TO-DATE
:CordovaLib:generateDebugResValues
UP-TO-DATE
:CordovaLib:generateDebugResources
UP-TO-DATE
:CordovaLib:packageDebugResources

UP-TO-DATE
:CordovaLib:platformAttrExtractor
UP-TO-DATE
:CordovaLib:processDebugManifest
UP-TO-DATE
:CordovaLib:processDebugResources
UP-TO-DATE
:CordovaLib:generateDebugSources
UP-TO-DATE
:CordovaLib:javaPreCompileDebug
UP-TO-DATE
:CordovaLib:compileDebugJavaWithJavac

UP-TO-DATE
:CordovaLib:processDebugJavaRes NO-SOURCE
:CordovaLib:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug
UP-TO-DATE
:app:preBuild UP-TO-DATE
:app:preDebugBuild
UP-TO-DATE

:app:compileDebugAidl

UP-TO-DATE

:CordovaLib:packageDebugRenderscript
NO-SOURCE

:app:compileDebugRenderscript

UP-TO-DATE
:app:checkDebugManifest
UP-TO-DATE
:app:generateDebugBuildConfig

UP-TO-DATE
:app:prepareLintJar UP-TO-DATE
:app:generateDebugResValues
UP-TO-DATE
:app:generateDebugResources UP-TO-DATE

:app:mergeDebugResources
C:\Windows\System32\baechat\platforms\android\app\build\intermediates\res\merged
\debug: error: directory does not exist.

Error: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exc
eption: AAPT2 error: check logs for details
:app:mergeDebugResources FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:app:mergeDebugResources’.

Error: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2E
xception: AAPT2 error: check logs for details

  • Try:
    Run with --stacktrace
    21 actionable tasks: 1 executed, 20 up-to-date
    option to get the stack trace. Run with --info or --debug option to get more lo
    g output.

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

BUILD FAILED in 4s
(node:5540) UnhandledPromiseRejectionWarning: Error: cmd: Command failed with ex
it code 1 Error output:
C:\Windows\System32\baechat\platforms\android\app\build\intermediates\res\merged
\debug: error: directory does not exist.

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:app:mergeDebugResources’.

Error: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2E
xception: AAPT2 error: check logs for details

  • 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 4s
at ChildProcess.whenDone (C:\Windows\System32\baechat\platforms\android\cord
ova\node_modules\cordova-common\src\superspawn.js:117: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:5540) 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:5540) [DEP0018] DeprecationWarning: Unhandled promise rejections are depre
cated. In the future, promise rejections that are not handled will terminate the
Node.js process with a non-zero exit code.

C:\Windows\System32\baechat>ionic info cli packages: (C:\Users\User\AppData\Roaming\npm\node_modules) @ionic/cli-utils : 1.19.2
ionic (Ionic CLI) : 3.20.0

global packages: cordova (Cordova CLI) : 8.0.0
Gulp CLI : not installed globally

local packages: Cordova Platforms : android 7.0.0
Ionic Framework : ionic1 1.3.1

System: Node : v9.9.0
npm : 5.6.0
OS : Windows 8.1

Environment Variables: ANDROID_HOME : C:\Users\win8\android-sdks;C:\Users\win8\android-sdks\platform-tools;C:\Users\win8\android-sdks\tools

Misc: backend : pro

C:\Windows\System32\baechat>cordova requirements

Android Studio project detected

Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: installed android-27,android-26,android-25
Gradle: installed C:\Program Files\Android\Android Studio\gradle\gradle-4.4\bin
gradle

Your Cordova tooling seems to be out of date, which might be causing all kinds of problems.
You can read about how to figure out the current Cordova versions and how to update CLI, platforms and plugins here: How to update Cordova CLI, Platforms and Plugins · ionic.zone

Apk generated and signed too now i am getting this error at the middle of the screen after installing ionic app “unable to connect to server” kindly find the screenshot attached and i am not getting onesignal push notifications although i have added the plugin successfully this is ionic v1 project