Skip to content

Commit

Permalink
Update Android
Browse files Browse the repository at this point in the history
• Updates react-native-onesignal target SDK and gradle versions
• Adds the onesignal-gradle-plugin to fix dependency issues in the demo project
  • Loading branch information
Nightsd01 committed Mar 29, 2018
1 parent e80f94e commit 2d94cfe
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 17 deletions.
28 changes: 18 additions & 10 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,31 @@ buildscript {
repositories {
jcenter()
mavenCentral()
maven { url 'https://maven.google.com' }
}

dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.android.tools.build:gradle:3.0.1'
}
}

apply plugin: 'com.android.library'

android {
compileSdkVersion 23
buildToolsVersion "25.0.0"
compileSdkVersion 27
buildToolsVersion '27.0.3'

defaultConfig {
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
versionName '1.0'
// Do not set onesignal_app_id here, it will be set in the app project.
// Leave onesignal_google_project_number as it is now pulled from the dashboard.
manifestPlaceholders = [onesignal_app_id: "",
onesignal_google_project_number: "REMOTE"]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
Expand All @@ -36,9 +35,18 @@ android {
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.facebook.react:react-native:+'
compile 'com.google.android.gms:play-services-gcm:+'
compile 'com.google.android.gms:play-services-analytics:+'
compile 'com.google.android.gms:play-services-location:+'
testCompile 'junit:junit:4.12'
compile 'com.onesignal:OneSignal:3.+@aar'
compile 'com.onesignal:OneSignal:3.+'
}

// Add the following to the top (Line 1) of your app/build.gradle if you run into any issues with duplicate classes.
// Such as the following error
// Error: more than one library with package name 'com.google.android.gms.license'
/*
plugins {
id 'com.onesignal.androidsdk.onesignal-gradle-plugin' version '0.8.1'
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
*/
15 changes: 10 additions & 5 deletions examples/RNOneSignal/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
plugins {
id 'com.onesignal.androidsdk.onesignal-gradle-plugin' version '0.8.1'
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

apply plugin: "com.android.application"

import com.android.build.OutputFile
Expand Down Expand Up @@ -83,19 +88,19 @@ def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
compileSdkVersion 27
buildToolsVersion "27.0.3"

defaultConfig {
applicationId "com.rnonesignal"
minSdkVersion 16
targetSdkVersion 22
targetSdkVersion 25
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
manifestPlaceholders = [onesignal_app_id: "73a522ac-dc37-45f1-9d67-2791f3247179",
manifestPlaceholders = [onesignal_app_id: "78e8aff3-7ce2-401f-9da0-2d41f287ebaf",
onesignal_google_project_number: "REMOTE"]
}
splits {
Expand Down Expand Up @@ -130,7 +135,7 @@ android {
dependencies {
compile project(':react-native-onesignal')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.android.support:appcompat-v7:27.1.0"
compile "com.facebook.react:react-native:+" // From node_modules
}

Expand Down
4 changes: 3 additions & 1 deletion examples/RNOneSignal/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.android.tools.build:gradle:3.0.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -16,6 +17,7 @@ allprojects {
repositories {
mavenLocal()
jcenter()
google()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#Wed Mar 28 17:50:32 PDT 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip

0 comments on commit 2d94cfe

Please sign in to comment.