μ€λͺ
:
"react-native-onesignal": "^3.2.4"
λ₯Ό "react-native": "0.55.4"
μ ν¨κ» μ¬μ©νλ©΄ λ€μ λΉλ μ€λ₯κ° λ°μν©λλ€.
μμ ':react- native -
μ€λ₯: ν¨ν€μ§ μ΄λ¦μ΄ 'com.google.android.gms.license'μΈ λ μ΄μμ λΌμ΄λΈλ¬λ¦¬
https://documentation.onesignal.com/docs/react-native-sdk-setup#section -adding-the-gradle-pluginμ ν¬ν¨νμ¬ κ³΅μ μ¬μ΄νΈμ λͺ¨λ μ€μ λ¨κ³λ₯Ό λ°λμ΅λλ€.
λν .../node_modules/react-native-onesignal/android/build.gradle
μ λ°λ₯κΈ μ£Όμμμ μΈκΈνλ―μ΄ .../android/app/build.gradle
\:- μλ¨μ λ€μ μΉμ
μ μΆκ°νλ €κ³ μλνμ΅λλ€.
plugins {
id 'com.onesignal.androidsdk.onesignal-gradle-plugin' version '0.8.1'
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
νμ§λ§ μ°¨μ΄κ° μμ΅λλ€.
@avin3sh λΉμ μ μ΄μ λ²μ μ OneSignal Gradle νλ¬κ·ΈμΈμ μ¬μ©νκ³ μμ΅λλ€.
μ λ²μ μ μ¬μ©ν΄ 보μμμ€. μ΄μ Gradle νλ¬κ·ΈμΈμ μ κ±°νκ³ κ°μ λ°©μμΌλ‘ μ νλ¬κ·ΈμΈμ μΆκ°νμμμ€( app/build.gradle
μλ¨).
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/'}
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.10.0, 0.99.99]'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
@Nightsd01 μ루μ
μ 곡μ κ°μ¬λ립λλ€.
μ΄ λ¬Έμ λ μμ§λ§ μλνμ§ μκ³ μ€λ₯κ° κ³μ λνλ©λλ€.
λμκ²λ μΌμ΄λλ€. μ΅μ gradle νλ¬κ·ΈμΈμ μλνμ¬ Android νλ¬κ·ΈμΈμμ gcm κ·Έλ£Ήμ μ μΈνκ³ Firebase λΌμ΄λΈλ¬λ¦¬ λ²μ μ κ³ μ νκ³ λͺ¨λ Firebase λΌμ΄λΈλ¬λ¦¬λ₯Ό λ²μ 15λ‘ μ λ°μ΄νΈνμ§λ§ μ§κΈκΉμ§λ μ΄μ΄ μμμ΅λλ€. μ΄κ²μ λ΄κ° μ»μ λ§μ§λ§ μ€λ₯μμ΅λλ€. https://github.com/OneSignal/OneSignal-Android-SDK/issues/298 ,νμ§λ§ κ·Έκ²μ μ§λμΉ μ μμμ΅λλ€.
μ react-native info
μ
λλ€. λκ° μ΄μν΄ λ³΄μ΄μ£ ?
Environment:
OS: macOS High Sierra 10.13
Node: 10.3.0
Yarn: 1.7.0
npm: 6.1.0
Watchman: 4.7.0
Xcode: Not Found
Android Studio: 2.3 AI-162.4069837
Packages: (wanted => installed)
react: 16.3.1 => 16.3.1
react-native: ~0.55.2 => 0.55.4
μ¬κΈ°λ λ§μ°¬κ°μ§μ
λλ€. λλ λν κ°μ μ€λ₯κ° λ°μν©λλ€. μμ μ루μ
μ μλνμ§λ§ μλνμ§ μμμ΅λλ€.
μ무λ λμΈ μ μμ΅λκΉ?
@Nightsd01 μ΄λ―Έ build.gradle
ν΄λΉ λΌμΈμ μΆκ°νμ§λ§ μ¬μ ν λ¬Έμ μ μ§λ©΄ν΄ μμ΅λλ€.
λΉμ (λλ μ΄ λ¬Έμ μ μ§λ©΄ν λ€λ₯Έ μ¬λ)μ΄ μ¬μ© μ€μΈ λͺ¨λ μ’
μμ±μ μ 곡ν μ μμ΅λκΉ? package.json
κ²μν μ μμ΅λλ€.
λν μ΄ λ¬Έμ μ μ§λ©΄ν λͺ¨λ μ¬μ©μμκ² app/build.gradle
νμΌμ 볡μ¬νμ¬ λΆμ¬λ£μΌμμμ€. νΉν compileSdkVersion
, buildToolsVersion
, minSdkVersion
λ° targetSdkVersion
맀κ°λ³μ μ€ μΌλΆλ₯Ό μκ³ μΆμ΅λλ€.
λλ κ°μ λ¬Έμ κ° μμ΅λλ€. μ¬κΈ° λ΄ package.jsonμ΄ μμ΅λλ€.
{
"dependencies": {
"native-base": "^2.4.3",
"react": "16.3.2",
"react-native": "0.55.3",
"react-native-cookies": "^3.2.0",
"react-native-elements": "^0.19.1",
"react-native-haptic-feedback": "^1.1.0",
"react-native-iphone-x-helper": "^1.0.3",
"react-native-navigation": "^1.1.452",
"react-native-onesignal": "^3.2.3",
"react-native-scrollable-tab-view": "^0.8.0",
"react-native-share": "^1.0.27",
"react-native-vector-icons": "^4.6.0",
"react-native-wkwebview-reborn": "^1.20.0",
"react-native-xml2js": "^1.0.3",
"react-redux": "^5.0.7",
"redux": "^4.0.0",
"redux-logger": "^3.0.6",
"redux-persist": "^5.9.1",
"redux-thunk": "^2.2.0",
"rn-sliding-up-panel": "^1.2.0",
"url-parse": "^1.4.0"
},
"devDependencies": {
"babel-jest": "22.4.3",
"babel-preset-react-native": "4.0.0",
"jest": "22.4.3",
"react-native-dotenv": "^0.1.1",
"react-test-renderer": "16.3.1"
},
"jest": {
"preset": "react-native"
}
}
λ€μμ λ€λ₯Έ 맀κ°λ³μ μΈλΆμ 보μ λλ€.
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
λ μ΄μ λ΄ build.gradle νμΌμ΄ μμ§λ§ λͺ¨λ κ²μ > λ²μ 23 λλ λ²μ 26μΌλ‘ μ€μ νλ €κ³ μλνμ§λ§ λ μ€ νλκ° μλνλλ‘ ν μ μμμ΅λλ€.
λλμ΄ μ΄ μνμ μ»μλ€
https://documentation.onesignal.com/docs/react-native-sdk-setup#section -adding-the-gradle-pluginμ μ κ±°νμ¬
app/build.gradleμ compile "com.google.android.gms:play-services-base:12.0.1"
μ½μ
& μλμ κ°μ΄ android/build.gradleμ google() μΆκ°
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
allprojects {
repositories {
google()
mavenLocal()
jcenter()
maven {
url "$rootDir/../node_modules/react-native/android"
}
}
}
@neo125874 compileSdkVersion λ° buildToolsVersion λ²μ μ 무μμ λκΉ?
ν λ² λ λ³κ²½ν΄μΌ νμ΅λλ€. Iλ‘ λ³κ²½ distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
μμ gradle-wrapper.properties
, κ·Έλ¦¬κ³ νλ€. compileSdkVersionμ 23μ΄κ³ buildToolsVersionμ 23.0.1μ
λλ€.
@Nightsd01
λ€μμ λ΄ package.jsonμ λ΄μ©μ λλ€.
"dependencies": {
"native-base": "^2.3.9",
"react": "16.3.1",
"react-native": "0.55.4",
"react-native-onesignal": "^3.2.4",
"react-native-router-flux": "^4.0.0-beta.28",
"react-native-smart-splash-screen": "^2.3.5"
},
"devDependencies": {
"babel-jest": "22.4.1",
"babel-preset-react-native": "4.0.0",
"jest": "22.4.2",
"react-test-renderer": "16.2.0"
},
"jest": {
"preset": "react-native"
}
app/build.gradle
νλ¬κ·ΈμΈ μ μ©: "com.android.application"
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/' } // Gradle Plugin Portal
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.10.0, 0.99.99]'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
import com.android.build.OutputFile
project.ext.react = [
entryFile: "index.js"
]
apply from: "../../node_modules/react-native/react.gradle"
def enableProguardInReleaseBuilds = false
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
//compileSdkVersion 27 //made no difference
//buildToolsVersion "27.0.1" //made no difference
defaultConfig {
applicationId "com.fpapp"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a":1, "x86":2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
dependencies {
compile project(':react-native-smart-splash-screen')
compile project(':react-native-onesignal')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
//compile "com.google.android.gms:play-services-base:12.0.1" //github onesignal experiment
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
κΆμ₯ λ° κΈ°λ³Έ buildTool λ° CompileSdkλ‘ μλνμ§λ§ μλ¬΄λ° μ°¨μ΄κ° μμμ΅λλ€.
@neo125874 gradle-wrapper.properties
λν @dhamaniasad μ μ μλ λ³κ²½ μ¬νκ³Ό ν¨κ» μμ μ¬νμ΄ μ μ©λμμ΅λλ€!
@dhamaniasad λλ 23 λλ 26μ μλνμ§λ§ μ μλν μ μμκ³ μλ
@avin3sh μΆνν©λλ€ ! κ΅¬κΈ νλ μ΄ μλΉμ€ sthμ κ΄λ ¨λ κ² κ°μ΅λλ€.
@avin3sh @dhamaniasad μ μν λλ‘ μλνμ§λ§ μ΄ μ€λ₯κ° λ°μν©λλ€.
νλ‘μ νΈ ':app'μ(λ₯Ό) ꡬμ±νλ λμ λ¬Έμ κ° λ°μνμ΅λλ€.
νλ‘μ νΈ νκ° λ¦¬μ€λμκ² μλ¦¬μ§ λͺ»νμ΅λλ€.
com.android.build.gradle.tasks.factory.AndroidJavaCompile.setDependencyCacheDir(Ljava/io/File;)V
μ΄ λ¬Έμ λ₯Ό ν΄κ²°ν μ μλλ‘ λμμ£ΌμΈμ. 미리 κ°μ¬ν©λλ€.
λ΄ app/build.gradle
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/' } // Gradle Plugin Portal
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.10.0, 0.99.99]'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: "com.android.application"
import com.android.build.OutputFile
/**
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
* and bundleReleaseJsAndAssets).
* These basically call `react-native bundle` with the correct arguments during the Android build
* cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
* bundle directly from the development server. Below you can see all the possible configurations
* and their defaults. If you decide to add a configuration block, make sure to add it before the
* `apply from: "../../node_modules/react-native/react.gradle"` line.
*
* project.ext.react = [
* // the name of the generated asset file containing your JS bundle
* bundleAssetName: "index.android.bundle",
*
* // the entry file for bundle generation
* entryFile: "index.android.js",
*
* // whether to bundle JS and assets in debug mode
* bundleInDebug: false,
*
* // whether to bundle JS and assets in release mode
* bundleInRelease: true,
*
* // whether to bundle JS and assets in another build variant (if configured).
* // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
* // The configuration property can be in the following formats
* // 'bundleIn${productFlavor}${buildType}'
* // 'bundleIn${buildType}'
* // bundleInFreeDebug: true,
* // bundleInPaidRelease: true,
* // bundleInBeta: true,
*
* // whether to disable dev mode in custom build variants (by default only disabled in release)
* // for example: to disable dev mode in the staging build type (if configured)
* devDisabledInStaging: true,
* // The configuration property can be in the following formats
* // 'devDisabledIn${productFlavor}${buildType}'
* // 'devDisabledIn${buildType}'
*
* // the root of your project, i.e. where "package.json" lives
* root: "../../",
*
* // where to put the JS bundle asset in debug mode
* jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
*
* // where to put the JS bundle asset in release mode
* jsBundleDirRelease: "$buildDir/intermediates/assets/release",
*
* // where to put drawable resources / React Native assets, e.g. the ones you use via
* // require('./image.png')), in debug mode
* resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
*
* // where to put drawable resources / React Native assets, e.g. the ones you use via
* // require('./image.png')), in release mode
* resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
*
* // by default the gradle tasks are skipped if none of the JS files or assets change; this means
* // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
* // date; if you have any other folders that you want to ignore for performance reasons (gradle
* // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
* // for example, you might want to remove it from here.
* inputExcludes: ["android/**", "ios/**"],
*
* // override which node gets called and with what additional arguments
* nodeExecutableAndArgs: ["node"],
*
* // supply additional arguments to the packager
* extraPackagerArgs: []
* ]
*/
project.ext.react = [
entryFile: "index.js"
]
apply from: "../../node_modules/react-native/react.gradle"
/**
* Set this to true to create two separate APKs instead of one:
* - An APK that only works on ARM devices
* - An APK that only works on x86 devices
* The advantage is the size of the APK is reduced by about 4MB.
* Upload all the APKs to the Play Store and people will download
* the correct one based on the CPU architecture of their device.
*/
def enableSeparateBuildPerCPUArchitecture = false
/**
* Run Proguard to shrink the Java bytecode in release builds.
*/
def enableProguardInReleaseBuilds = false
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.onesignal"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a":1, "x86":2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
dependencies {
compile project(':react-native-onesignal')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
compile "com.google.android.gms:play-services-base:12.0.1" //github onesignal experiment
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
λ΄ gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
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"
}
}
}
`
package.json
`{
"name": "onesignal",
"version": "0.1.0",
"private": true,
"devDependencies": {
"babel-preset-react-native-stage-0": "^1.0.1",
"jest": "^23.1.0",
"jest-react-native": "^18.0.0",
"react-test-renderer": "16.3.1"
},
"scripts": {
"start": "react-native start",
"android": "react-native run-android",
"ios": "react-native run-ios",
"test": "jest"
},
"jest": {
"preset": "react-native"
},
"dependencies": {
"react": "16.3.1",
"react-native": "~0.55.2",
"react-native-onesignal": "^3.2.4"
}
}
@avin3sh @dhamaniasad λΉκ΅ν νλ‘μ νΈμ
@Nightsd01 λμμ£ΌμΈμ
@davekedar gradle λνΌ λ²μ μ μ
λ°μ΄νΈνμ΅λκΉ?
κ·Έλ λ€λ©΄ λ€μμμ gradle νμΌ μ’
μμ±μ μ
λ°μ΄νΈν΄μΌ ν©λλ€.
classpath 'com.android.tools.build:gradle:2.2.3'
μκ²
classpath 'com.android.tools.build:gradle:4.4'
(λλ μ¬μ© μ€μΈ λ²μ )
λ€μμ μλνλλ‘ μ°Έμ‘°ν κΈ°μ¬μ λλ€. https://medium.com/@chuckyong_3313/react -native-android-build-compilation-issue-with-google-play-api-for-android-v12-0-0-ccb2f1a0fb9c
@ashishmusale κ·νμ Android μ€νλμ€ λ²μ μ 무μμ λκΉ? μ€νλμ€ λ²μ 3.1.3μ μ κ·Έλ μ΄λνμ΅λλ€.
gradle-wrapper.properties
#Fri Jun 08 10:09:57 IST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
app/build.gradle
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/' } // Gradle Plugin Portal
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.10.0, 0.99.99]'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: "com.android.application"
import com.android.build.OutputFile
/**
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
* and bundleReleaseJsAndAssets).
* These basically call `react-native bundle` with the correct arguments during the Android build
* cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
* bundle directly from the development server. Below you can see all the possible configurations
* and their defaults. If you decide to add a configuration block, make sure to add it before the
* `apply from: "../../node_modules/react-native/react.gradle"` line.
*
* project.ext.react = [
* // the name of the generated asset file containing your JS bundle
* bundleAssetName: "index.android.bundle",
*
* // the entry file for bundle generation
* entryFile: "index.android.js",
*
* // whether to bundle JS and assets in debug mode
* bundleInDebug: false,
*
* // whether to bundle JS and assets in release mode
* bundleInRelease: true,
*
* // whether to bundle JS and assets in another build variant (if configured).
* // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
* // The configuration property can be in the following formats
* // 'bundleIn${productFlavor}${buildType}'
* // 'bundleIn${buildType}'
* // bundleInFreeDebug: true,
* // bundleInPaidRelease: true,
* // bundleInBeta: true,
*
* // whether to disable dev mode in custom build variants (by default only disabled in release)
* // for example: to disable dev mode in the staging build type (if configured)
* devDisabledInStaging: true,
* // The configuration property can be in the following formats
* // 'devDisabledIn${productFlavor}${buildType}'
* // 'devDisabledIn${buildType}'
*
* // the root of your project, i.e. where "package.json" lives
* root: "../../",
*
* // where to put the JS bundle asset in debug mode
* jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
*
* // where to put the JS bundle asset in release mode
* jsBundleDirRelease: "$buildDir/intermediates/assets/release",
*
* // where to put drawable resources / React Native assets, e.g. the ones you use via
* // require('./image.png')), in debug mode
* resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
*
* // where to put drawable resources / React Native assets, e.g. the ones you use via
* // require('./image.png')), in release mode
* resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
*
* // by default the gradle tasks are skipped if none of the JS files or assets change; this means
* // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
* // date; if you have any other folders that you want to ignore for performance reasons (gradle
* // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
* // for example, you might want to remove it from here.
* inputExcludes: ["android/**", "ios/**"],
*
* // override which node gets called and with what additional arguments
* nodeExecutableAndArgs: ["node"],
*
* // supply additional arguments to the packager
* extraPackagerArgs: []
* ]
*/
project.ext.react = [
entryFile: "index.js"
]
apply from: "../../node_modules/react-native/react.gradle"
/**
* Set this to true to create two separate APKs instead of one:
* - An APK that only works on ARM devices
* - An APK that only works on x86 devices
* The advantage is the size of the APK is reduced by about 4MB.
* Upload all the APKs to the Play Store and people will download
* the correct one based on the CPU architecture of their device.
*/
def enableSeparateBuildPerCPUArchitecture = false
/**
* Run Proguard to shrink the Java bytecode in release builds.
*/
def enableProguardInReleaseBuilds = false
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.nesignal"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a":1, "x86":2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
dependencies {
compile project(':react-native-onesignal')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
android/build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:3.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
}
ext {
googlePlayServicesVersion = '11.8.0'
compileSdkVersion = 27
buildToolsVersion = '27.0.3'
supportLibrariesVersion = '27.1.0'
}
// Force sub libs to use the compile sdk & build tools version
subprojects { subproject ->
afterEvaluate{
if((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
}
}
}
}
μ€λ₯κ° λ°μν©λλ€.
firebase-messaging.jar(com.google.firebase:firebase-messaging:12.0.0)μ μ°Ύμ μ μμ΅λλ€.
λ€μ μμΉμμ κ²μ:
https://jcenter.bintray.com/com/google/firebase/firebase-messaging/12.0.0/firebase-messaging-12.0.0.jar
https://github.com/davekedar/onesignal-error.git μ΄κ²μ ν μ€νΈλ₯Ό μν λ΄ μ μ₯μμ λλ€. ν΄κ²°νλ λ° λμμ μ£Όμκ² μ΅λκΉ?
미리 κ°μ¬λ립λλ€ @ashishmusale @Nightsd01
@davekedar νλ‘μ νΈλ₯Ό μ»΄νμΌν μ μμ΅λλ€.
@davekedar λλ jcenterκ° λ μ΄μ Google λΌμ΄λΈλ¬λ¦¬λ₯Ό ν΄κ²°νμ§ λͺ»νλ μ΅κ·Ό λͺ κ°μ§ λ¬Έμ λ₯Ό 보μμ΅λλ€. μ΄ μ€λ₯λ₯Ό μμ ν΄μΌ νλ allprojects { repositories { ... } }
μΉμ
μ google()
λ₯Ό μΆκ°νλ κ²μ΄ μ’μ΅λλ€.
allprojects {
repositories {
mavenLocal()
google()
jcenter()
// ...
}
}
@ashishmusale @jkasten2 κ°μ¬ν©λλ€. μ§κΈ μλνκ³ μμ΅λλ€. λ¨, μμκ·Έλμ λ±λ‘μ΄ λμ§ μμ΅λλ€.
μ΄κ²μ λ΄ app.jsμ λλ€.
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import OneSignal from 'react-native-onesignal'; // Import package from node modules
export default class App extends React.Component {
state = {
device : ''
}
componentWillMount() {
OneSignal.init("206a6513-b453-4807-89c1-040389fa8dea");
OneSignal.addEventListener('received', this.onReceived);
OneSignal.addEventListener('opened', this.onOpened);
OneSignal.addEventListener('ids', this.onIds);
}
componentWillUnmount() {
OneSignal.removeEventListener('received', this.onReceived);
OneSignal.removeEventListener('opened', this.onOpened);
OneSignal.removeEventListener('ids', this.onIds);
}
onReceived(notification) {
console.log("Notification received: ", notification);
}
onOpened(openResult) {
console.log('Message: ', openResult.notification.payload.body);
console.log('Data: ', openResult.notification.payload.additionalData);
console.log('isActive: ', openResult.notification.isAppInFocus);
console.log('openResult: ', openResult);
}
onIds(device) {
this.setState({device: device})
}
render() {
return (
<View style={styles.container}>
<Text>Open up App.js to start working on your app!</Text>
<Text>Changes you make will automatically reload.</Text>
<Text>Shake your phone to open the developer menu.</Text>
<Text>Device Info : {this.state.device}</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});
@ashishmusale νμΈν μ μλ€λ©΄ μ΅μ’ μ»΄νμΌλ λ²μ μ 컀λ°νμ΅λλ€.
λͺ¨λ κ²μ΄ μ±κ³΅μ μΌλ‘ μλ£λμμ΅λλ€ λͺ¨λ κ°μ¬ν©λλ€
κ·Έκ²μ λ£κ³ κΈ°λ»!
μ무λ λμκ² μμ ν confiured νλ‘μ νΈλ₯Ό μ€ μ μμ΅λκΉ, μ μλν©λλ€ .... λλ 2 μΌ λμ λΆμ΄ μμ΅λλ€. λλ₯Ό μν΄ μΌνμ§ μλ .............. plz
@nahidmbstu μ΄λκ° λ§ν λμ§ μλ €μ£ΌμΈμ λͺ¨λμκ² λ§€μ° μ΄μν λ¬Έμ κ° μμ΅λλ€. λ¬Έμ λ₯Ό ν΄κ²°ν΄ λ³΄κ² μ΅λλ€.
μ λ 3.1.4μμ gcm lincence μ€λ₯μ΄λ©° μ΄ repoμμ μμ νλ‘μ νΈλ₯Ό μλν λ μλνμ§ μμ΅λλ€. ..... μλ¦Όμ΄ μλνλ ꡬμ±λ νλ‘μ νΈκ° νμν©λλ€...
μ¬κΈ°μμ λ€μ΄λ‘λ https://github.com/davekedar/onesignal-error
μ₯μΉ IDμμ νΈμ ν ν° nullμ κ°μ Έμ€λ μ€........... @davekedar . λν νλμ μ νΈ λμ보λμμ Google Play μλΉμ€ μ΄κΈ°ν μ€λ₯κ° λ°μν©λλ€.
@nahidmbstu μλ‘μ΄ μλ‘μ΄ νλ‘μ νΈλ₯Ό ꡬμΆνλ €κ³ νμ΅λκΉ?
κ°μ¬ν©λλ€. Google Play μλΉμ€μ λ¬Έμ κ° μμ΄μ μμΈμ΄ λμμ΅λλ€. λλ κ·Έκ²μ λ°λΌ ν΄κ²°νλ€
https://github.com/geektimecoil/react-native-onesignal/issues/387
@nahidmbstu λ©μ§λ€
κ°μ₯ μ μ©ν λκΈ
ν λ² λ λ³κ²½ν΄μΌ νμ΅λλ€. Iλ‘ λ³κ²½
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
μμgradle-wrapper.properties
, κ·Έλ¦¬κ³ νλ€. compileSdkVersionμ 23μ΄κ³ buildToolsVersionμ 23.0.1μ λλ€.