Skip to content

Commit 2d94cfe

Browse files
committed
Update Android
• Updates react-native-onesignal target SDK and gradle versions • Adds the onesignal-gradle-plugin to fix dependency issues in the demo project
1 parent e80f94e commit 2d94cfe

File tree

4 files changed

+33
-17
lines changed

4 files changed

+33
-17
lines changed

android/build.gradle

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,31 @@ buildscript {
22
repositories {
33
jcenter()
44
mavenCentral()
5+
maven { url 'https://maven.google.com' }
56
}
67

78
dependencies {
8-
classpath 'com.android.tools.build:gradle:2.2.2'
9+
classpath 'com.android.tools.build:gradle:3.0.1'
910
}
1011
}
1112

1213
apply plugin: 'com.android.library'
1314

1415
android {
15-
compileSdkVersion 23
16-
buildToolsVersion "25.0.0"
16+
compileSdkVersion 27
17+
buildToolsVersion '27.0.3'
1718

1819
defaultConfig {
1920
minSdkVersion 16
20-
targetSdkVersion 22
2121
versionCode 1
22-
versionName "1.0"
22+
versionName '1.0'
2323
// Do not set onesignal_app_id here, it will be set in the app project.
2424
// Leave onesignal_google_project_number as it is now pulled from the dashboard.
2525
manifestPlaceholders = [onesignal_app_id: "",
2626
onesignal_google_project_number: "REMOTE"]
2727
}
2828
buildTypes {
2929
release {
30-
minifyEnabled false
3130
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
3231
}
3332
}
@@ -36,9 +35,18 @@ android {
3635
dependencies {
3736
compile fileTree(include: ['*.jar'], dir: 'libs')
3837
compile 'com.facebook.react:react-native:+'
39-
compile 'com.google.android.gms:play-services-gcm:+'
40-
compile 'com.google.android.gms:play-services-analytics:+'
41-
compile 'com.google.android.gms:play-services-location:+'
4238
testCompile 'junit:junit:4.12'
43-
compile 'com.onesignal:OneSignal:3.+@aar'
39+
compile 'com.onesignal:OneSignal:3.+'
4440
}
41+
42+
// Add the following to the top (Line 1) of your app/build.gradle if you run into any issues with duplicate classes.
43+
// Such as the following error
44+
// Error: more than one library with package name 'com.google.android.gms.license'
45+
/*
46+
47+
plugins {
48+
id 'com.onesignal.androidsdk.onesignal-gradle-plugin' version '0.8.1'
49+
}
50+
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
51+
52+
*/

examples/RNOneSignal/android/app/build.gradle

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
plugins {
2+
id 'com.onesignal.androidsdk.onesignal-gradle-plugin' version '0.8.1'
3+
}
4+
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
5+
16
apply plugin: "com.android.application"
27

38
import com.android.build.OutputFile
@@ -83,19 +88,19 @@ def enableSeparateBuildPerCPUArchitecture = false
8388
def enableProguardInReleaseBuilds = false
8489

8590
android {
86-
compileSdkVersion 23
87-
buildToolsVersion "23.0.1"
91+
compileSdkVersion 27
92+
buildToolsVersion "27.0.3"
8893

8994
defaultConfig {
9095
applicationId "com.rnonesignal"
9196
minSdkVersion 16
92-
targetSdkVersion 22
97+
targetSdkVersion 25
9398
versionCode 1
9499
versionName "1.0"
95100
ndk {
96101
abiFilters "armeabi-v7a", "x86"
97102
}
98-
manifestPlaceholders = [onesignal_app_id: "73a522ac-dc37-45f1-9d67-2791f3247179",
103+
manifestPlaceholders = [onesignal_app_id: "78e8aff3-7ce2-401f-9da0-2d41f287ebaf",
99104
onesignal_google_project_number: "REMOTE"]
100105
}
101106
splits {
@@ -130,7 +135,7 @@ android {
130135
dependencies {
131136
compile project(':react-native-onesignal')
132137
compile fileTree(dir: "libs", include: ["*.jar"])
133-
compile "com.android.support:appcompat-v7:23.0.1"
138+
compile "com.android.support:appcompat-v7:27.1.0"
134139
compile "com.facebook.react:react-native:+" // From node_modules
135140
}
136141

examples/RNOneSignal/android/build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
buildscript {
44
repositories {
55
jcenter()
6+
google()
67
}
78
dependencies {
8-
classpath 'com.android.tools.build:gradle:2.2.2'
9+
classpath 'com.android.tools.build:gradle:3.0.1'
910

1011
// NOTE: Do not place your application dependencies here; they belong
1112
// in the individual module build.gradle files
@@ -16,6 +17,7 @@ allprojects {
1617
repositories {
1718
mavenLocal()
1819
jcenter()
20+
google()
1921
maven {
2022
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
2123
url "$rootDir/../node_modules/react-native/android"
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
#Wed Mar 28 17:50:32 PDT 2018
12
distributionBase=GRADLE_USER_HOME
23
distributionPath=wrapper/dists
34
zipStoreBase=GRADLE_USER_HOME
45
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip

0 commit comments

Comments
 (0)