Can not build android after installing OneSignal


#1

I followed the instruction on OneSignal website to build SDK and when I run my application with the command IONIC RUN ANDROID, I get the following error. I am new to Ionic and coding in general, so any help will be appreciated. Here is the link to what I have done so far. I finished everything before step 2, since I am not sure how to and where to add step 2 code. Thank you so much!

Here is the line of code that is causing trouble.

    <!--<gap:plugin name="onesignal-cordova-plugin" source="npm" />-->

https://documentation.onesignal.com/v2.0/docs/android-studio-sdk-installation#2-add-required-code

/Users/xiaofanwu/Desktop/work/examplewithonesignal/platforms/android/res/xml/config.xml:48 : AAPT: Error parsing XML: unbound prefix

FAILURE: Build failed with an exception.

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

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process ‘command ‘/Users/xiaofanwu/Library/Android/sdk/build-tools/23.0.3/aapt’’ finished with non-zero exit value 1

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

BUILD FAILED

Total time: 31.744 secs
Error: Error code 1 for command: /Users/xiaofanwu/Desktop/work/examplewithonesignal/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/xiaofanwu/Desktop/work/examplewithonesignal/platforms/android/build.gradle,-PcdvBuildArch=arm,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true


#2

You don’t need to add anything to your xml files. The following command should add everything for you.
ionic plugin add onesignal-cordova-plugin


#3

Thank you so much for your response! I figured that out after a long time of searching. I basically followed your documentation online, so it might be a good idea to take out that part from the documentation? Or there might be some differences between Cordova and Ionic? I am not sure.


#4

I believe you may have follow part 1B for PhoneGap Build (PGB) instead of 1A. We see if we can clear it up a bit more in our documentation.