- Create a
libs
folder under theapp
directory in your project. - Place
onesignal.aar
in the newly createdapp/libs
directory. - Open your project's root
build.gradle
file and add the folowing underrepositories {...}
.
flatDir {
dirs 'libs'
}
- Open your
app/build.gradle
. - Replace
implementation 'com.onesignal:OneSignal:[3.14.0, 3.99.99]'
withimplementation(name: 'onesignal', ext: 'aar')
. - Add required AndroidX dependencies to your
app/build.gradle
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.fragment:fragment:1.0.0'
implementation 'androidx.browser:browser:1.0.0'
// OR older Android Support Libraries if you haven't migrated to AndroidX yet.
// implementation 'com.android.support:cardview-v7:[26.0.0, 27.99.99]'
// implementation 'com.android.support:support-fragment:[26.0.0, 27.99.99]'
// implementation 'com.android.support:customtabs:[26.0.0, 27.99.99]'
- Add FCM dependency if you need Google push support.
implementation 'com.google.firebase:firebase-messaging:[10.2.1, 17.3.99]'
See the below .gradle
files for full examples of the changes.
I followed these instructions but build was failing. Changing
compile(name: 'OneSignal-release', ext: 'aar')
tocompile(name: 'onesignal-release', ext: 'aar')
fixed it. It is probably because of the fact that your SDK's filename isonesignal-release.aar
instead ofOneSignal-release.aar
. Please test and update the instructions.