React-native-onesignal: Google Play μ„œλΉ„μŠ€ 라이브러리 였λ₯˜

에 λ§Œλ“  2018λ…„ 05μ›” 21일  Β·  37μ½”λ©˜νŠΈ  Β·  좜처: OneSignal/react-native-onesignal

μ„€λͺ…:

λ“±λ‘λœ κΈ°κΈ°λŠ” OneSignal λŒ€μ‹œλ³΄λ“œμ— 였λ₯˜λ₯Ό λ°˜ν™˜ν•˜λ―€λ‘œ ν‘Έμ‹œ μ•Œλ¦Όμ„ 받을 수 μ—†μŠ΅λ‹ˆλ‹€.

ν™˜κ²½

react-native -v
react-native-cli: 2.0.1
react-native: 0.55.4

νŒ¨ν‚€μ§€.json

"dependencies": {
    "react": "16.3.1",
    "react-native": "0.55.4",
    "react-native-onesignal": "^3.2.3"
  }

문제 μž¬ν˜„ 단계:

  1. λ°˜μ‘ λ„€μ΄ν‹°λΈŒ μ΄ˆκΈ°ν™” OneSignalTest
  2. CD OneSignalTest
  3. 원사 μ„€μΉ˜
  4. μ›μ‚¬λŠ” react-native-onesignal을 μΆ”κ°€ν•©λ‹ˆλ‹€.
  5. λ°˜μ‘ λ„€μ΄ν‹°λΈŒ 링크
  6. νŒ”λ‘œμš° : https://documentation.onesignal.com/docs#section -android-specific-instructions
  7. android/app/build.gradleμ—μ„œ 쒅속성에 compile project(':react-native-onesignal') λ₯Ό μ‚½μž…ν•©λ‹ˆλ‹€. κ·Έ μ˜μ‘΄μ„± μ—†μ΄λŠ” μ»΄νŒŒμΌν•  수 μ—†μŠ΅λ‹ˆλ‹€.
  8. App.js ν΄λž˜μŠ€μ—μ„œ λ¦¬μŠ€λ„ˆ μ‚½μž…: https://documentation.onesignal.com/docs#section -usage
  9. ComponentWillMountμ—μ„œ 이 OneSignal.configure()λ₯Ό μ‚½μž…ν•˜μ‹­μ‹œμ˜€. onIds에 λŒ€ν•œ λ°˜ν™˜μ„ κ°•μ œν•©λ‹ˆλ‹€.
    Ids λ¦¬μŠ€λ„ˆμ—μ„œ 클래슀 λ©”μ†Œλ“œλ₯Ό μ§€μš°κ³  둜컬 λ©”μ†Œλ“œλ₯Ό μƒμ„±ν•˜λ©΄ idλ₯Ό λ³Ό 수 μžˆμŠ΅λ‹ˆλ‹€.
    μš°λ¦¬κ°€ ν•˜μ§€ μ•ŠμœΌλ©΄ μ•„μ΄λ””λŠ” μ ˆλŒ€ λŒμ•„μ˜€μ§€ μ•ŠλŠ”λ‹€.
OneSignal.addEventListener('ids', device => {
      console.log('[OneSignal]>>ids: ', device);
    });

Initμ—μ„œ μ•± IDλ₯Ό μ‚½μž…ν•˜μ‹­μ‹œμ˜€.

  1. then : react-native run-android.
    (adb logcatμ—μ„œλŠ” 였λ₯˜λ₯Ό λ°˜ν™˜ν•˜μ§€λ§Œ 디버그 λͺ¨λ“œμ—μ„œλŠ” idκ°€ ν‘œμ‹œλ©λ‹ˆλ‹€.)
  2. OneSignal λŒ€μ‹œλ³΄λ“œμ—μ„œ IDλ₯Ό κ²€μƒ‰ν•˜λ©΄ μžˆμŠ΅λ‹ˆλ‹€.

기타:

E/OneSignal(31234): Unknown error getting FCM Token
E/OneSignal(31234): java.lang.NoSuchMethodError: No static method isDeviceProtectedStorage(Landroid/content/Context;)Z in class Landroid/support/v4/content/ContextCompat; or its super classes (declaration of 'android.support.v4.content.ContextCompat' appears in /data/app/com.onesignaltest-1/base.apk)
E/OneSignal(31234):     at com.google.firebase.FirebaseApp.zza(Unknown Source)
E/OneSignal(31234):     at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
E/OneSignal(31234):     at com.onesignal.PushRegistratorFCM.initFirebaseApp(PushRegistratorFCM.java:64)
E/OneSignal(31234):     at com.onesignal.PushRegistratorFCM.getToken(PushRegistratorFCM.java:50)
E/OneSignal(31234):     at com.onesignal.PushRegistratorAbstractGoogle.attemptRegistration(PushRegistratorAbstractGoogle.java:97)
E/OneSignal(31234):     at com.onesignal.PushRegistratorAbstractGoogle.access$100(PushRegistratorAbstractGoogle.java:37)
E/OneSignal(31234):     at com.onesignal.PushRegistratorAbstractGoogle$1.run(PushRegistratorAbstractGoogle.java:84)
E/OneSignal(31234):     at java.lang.Thread.run(Thread.java:818)

googleplayserviceserror

νŽΈμ§‘ 1:
λ‚˜λŠ” 그것듀을 μ‹œλ„ν–ˆμ§€λ§Œ μ„±κ³΅ν•˜μ§€ λͺ»ν–ˆμŠ΅λ‹ˆλ‹€.

κ°€μž₯ μœ μš©ν•œ λŒ“κΈ€

@brunoandradebr @DaniloCouto @ifanfaizal μˆ˜μ •ν•©λ‹ˆλ‹€. sdkVersion 및 버전 appcompat을 λ³€κ²½ν•©λ‹ˆλ‹€.

λ³€κ²½ 사항:
μ•±/λΉŒλ“œ.gradle

compileSdkVersion 26
buildToolsVersion "26.0.2"

쒅속성
λ³€ν™”
compile "com.android.support:appcompat-v7:23.0.1"
μ—κ²Œ
compile "com.android.support:appcompat-v7:26.0.1"

λ‚΄ build.gradle(μ•ˆλ“œλ‘œμ΄λ“œ)

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        maven {  // <-- THIS
            url 'https://maven.google.com/' // <-- THIS
            name 'Google' // <-- THIS
        } // <-- THIS
    }
    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()
        maven { 
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
        maven { // <-- THIS
            url 'https://maven.google.com/' // <-- THIS
            name 'Google' // <-- THIS
        } // <-- THIS
    }
}

cmdμ—μ„œ: cd android && gradlew clean

λ‚΄ AVDμ—μ„œ 앱을 μ œκ±°ν•˜κ³  λ°˜μ‘ λ„€μ΄ν‹°λΈŒλ‘œ 컴파일

λͺ¨λ“  37 λŒ“κΈ€

@DaniloCouto 이것은 ν™•μ‹€νžˆ μ•ˆλ“œλ‘œμ΄λ“œ 지원 라이브러리 버전 λ¬Έμ œμž…λ‹ˆλ‹€. app/build.gradle λ₯Ό κ²Œμ‹œν•  수 μžˆμŠ΅λ‹ˆκΉŒ?

@DaniloCouto λŠ” μƒˆ 버전 3.2.4λ₯Ό ν™•μΈν•˜κ³  μˆ˜μ •ν•©λ‹ˆλ‹€.

@adirzoari , μ—¬μ „νžˆ 3.2.4μ—μ„œ λ°œμƒν•˜λ©° Adb logcat 및 Onesignal μ‚¬μš©μž λŒ€μ‹œλ³΄λ“œμ—μ„œ λ™μΌν•œ 였λ₯˜κ°€ λ°œμƒν•©λ‹ˆλ‹€.
yarn add [email protected]
νŒ¨ν‚€μ§€.json

"dependencies": {
    "react": "16.3.1",
    "react-native": "0.55.4",
    "react-native-onesignal": "3.2.4"
  },

@Nightsd01 λ¬Όλ‘ μž…λ‹ˆλ‹€. μ—¬κΈ° μžˆμŠ΅λ‹ˆλ‹€:
app/build.gradle (μƒμ„±λœ λŒ“κΈ€μ„ μ‚­μ œν–ˆμŠ΅λ‹ˆλ‹€)

apply plugin: "com.android.application"

import com.android.build.OutputFile

project.ext.react = [
    entryFile: "index.js"
]

apply from: "../../node_modules/react-native/react.gradle"

def enableSeparateBuildPerCPUArchitecture = false

def enableProguardInReleaseBuilds = false

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.onesignaltest"
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false 
            include "armeabi-v7a", "x86"
        }
    }
    buildTypes {
        release {
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            def versionCodes = ["armeabi-v7a":1, "x86":2]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) { 
                output.versionCodeOverride =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }
        }
    }
}

dependencies {
    compile project(':react-native-onesignal') // I just added this line 
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"
    compile "com.facebook.react:react-native:+" 
}

task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}

νŽΈμ§‘ 1:
파일 μ‹œμž‘ 뢀뢄에 μΆ”κ°€ν–ˆμŠ΅λ‹ˆλ‹€. 아무것도 λ³€ν•˜μ§€ μ•Šμ•˜λ‹€:

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'
...
...
...
android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"
    ...
    ...
}

λ¬Όλ‘  gradlew clean 둜 Android ν”„λ‘œμ νŠΈλ₯Ό μ •λ¦¬ν•˜κ³  λ‹€μ‹œ λΉŒλ“œν•˜λ €κ³  ν–ˆμŠ΅λ‹ˆλ‹€.

@DaniloCouto react-native-onesignal example ν”„λ‘œμ νŠΈλ₯Ό μ‚¬μš©ν•˜κ³  κ³„μ‹œλ‚˜μš”...?

AndroidManifest.xml νŒŒμΌλ„ κ²Œμ‹œν•  수 μžˆμŠ΅λ‹ˆκΉŒ? 감사 ν•΄μš”

@Nightsd01 μƒˆλ‘œμš΄ react-native ν”„λ‘œμ νŠΈλ₯Ό λ§Œλ“€κ³  Yarn을 톡해 react-native-onesignal νŒ¨ν‚€μ§€λ₯Ό μΆ”κ°€ν–ˆμŠ΅λ‹ˆλ‹€.

μ—¬κΈ°μžˆμ–΄:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.onesignaltest">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> <!-- Onesignal Instruction -->
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> <!-- Onesignal Instruction -->

    <application
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:allowBackup="false"
      android:theme="@style/AppTheme"
      > <!-- android:launchMode="singleTop" I Was wrong at this line-->
      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        android:windowSoftInputMode="adjustResize"
        android:launchMode="singleTop"> <!-- brunoandradebr made a pretty nice observation right here -->
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
      </activity>
      <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
    </application>

</manifest>

νŽΈμ§‘ 1:
#387 μ†”λ£¨μ…˜μ— 이어 이 라인을 μΆ”κ°€ν–ˆμŠ΅λ‹ˆλ‹€. 아무것도 λ³€ν•˜μ§€ μ•Šμ•˜λ‹€

<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>

νŽΈμ§‘ 2:
@brunoandradebr μ—μ„œ μ•Œ 수 μžˆλ“―μ΄ android:launchMode="singleTop" λŠ” μ• ν”Œλ¦¬μΌ€μ΄μ…˜ νƒœκ·Έκ°€ μ•„λ‹Œ ν™œλ™ νƒœκ·Έμ— μžˆμ–΄μ•Ό ν•©λ‹ˆλ‹€.
ν•˜μ§€λ§Œ μ—¬μ „νžˆ μž‘λ™ν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€..

여기에 같은 λ¬Έμ œκ°€ μžˆμŠ΅λ‹ˆλ‹€. @DaniloCouto 당신이 그것을 κ³ μ³€μŠ΅λ‹ˆκΉŒ ???

λ‚˜λŠ” 같은 λ¬Έμ œκ°€ μžˆμŠ΅λ‹ˆλ‹€. @DaniloCouto 당신은 그것을 κ³ μΉ  수 μžˆμ—ˆμŠ΅λ‹ˆκΉŒ? μ—¬κΈ°μ €κΈ° κ²€μƒ‰ν–ˆλŠ”λ° 아직 μž‘λ™μ΄ μ•ˆλ˜λ„€μš” :(

@ifanfaizal , @lahed μ£„μ†‘ν•©λ‹ˆλ‹€λ§Œ, 저도 해결책을 μ°ΎκΈ° μœ„ν•΄ μ—¬κΈ° μžˆμŠ΅λ‹ˆλ‹€...
λ‚˜λŠ” 성곡 ν•˜μ§€ λͺ»ν•œ μ‚¬λžŒλ“€μ„ λ”°λ₯΄λ €κ³  λ…Έλ ₯ν–ˆμŠ΅λ‹ˆλ‹€.

λ‹€λ‹λ‘œ, 당신은 μ‚½μž…ν•΄μ•Όν•©λ‹ˆλ‹€
android:launchMode="singleTop"
ν•˜λ‚˜μ˜ μ‹ ν˜Έ λͺ…λ ΉμœΌλ‘œ μ‘μš© ν”„λ‘œκ·Έλž¨μ— μ—†λŠ” λ‚΄λΆ€ ν™œλ™ μ»¨ν…μŠ€νŠΈ.
Btw 잘 μž‘λ™ν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€ =[

@brunoandradebr λ‚΄ 동포λ₯Ό 잘 κ΄€μ°°ν–ˆμŠ΅λ‹ˆλ‹€.
당신이 λ§ν–ˆλ“―μ΄, 그것은 μ—¬μ „νžˆ β€‹β€‹β€‹β€‹μž‘λ™ν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€.

compile "com.google.android.gms:play-services-gcm:+"

Android studio sdk κ΄€λ¦¬μžμ—μ„œ Google Play μ„œλΉ„μŠ€λ₯Ό μ„€μΉ˜ν•œ ν›„ 쒅속성에 μΆ”κ°€ν•˜κ³  μ–΄λ–»κ²Œλ“  μž‘λ™ν–ˆμ§€λ§Œ 앱이 μΆ©λŒν•œ λ‹€μŒ onesignal μ‚¬μš©μž λͺ©λ‘μ„ μƒˆλ‘œ κ³ μ³€κ³  였λ₯˜κ°€ 계속 μ§€μ†λ©λ‹ˆλ‹€. =[

μ§€κΈˆ μž‘λ™ν•˜λŠ” 것 κ°™μ•„μš”! Android Studioμ—μ„œ Google Play μ„œλΉ„μŠ€λ₯Ό μ„€μΉ˜ν–ˆμŠ΅λ‹ˆλ‹€. ν•œ 쀄도 μ‚½μž…ν•˜μ§€ μ•Šμ•„μ•Ό ν•˜λ―€λ‘œ λ²ˆλ“€μ„ λ‹«κ³  λ‹€μ‹œ μ»΄νŒŒμΌν•΄μ•Ό ν•©λ‹ˆλ‹€. 체크 μ•„μ΄μ½˜μœΌλ‘œ ꡬ독 쀑이라고 ν‘œμ‹œλ©λ‹ˆλ‹€! onesignal μΆ”κ°€ 라인을 μ‚½μž…ν•˜μ§€λ„ μ•Šμ•˜λŠ”λ°, react nativeκ°€ μƒμ„±ν•œ 것과 같은 λ°©μ‹μž…λ‹ˆλ‹€.

@brunoandradebr @DaniloCouto @ifanfaizal μˆ˜μ •ν•©λ‹ˆλ‹€. sdkVersion 및 버전 appcompat을 λ³€κ²½ν•©λ‹ˆλ‹€.

λ³€κ²½ 사항:
μ•±/λΉŒλ“œ.gradle

compileSdkVersion 26
buildToolsVersion "26.0.2"

쒅속성
λ³€ν™”
compile "com.android.support:appcompat-v7:23.0.1"
μ—κ²Œ
compile "com.android.support:appcompat-v7:26.0.1"

λ‚΄ build.gradle(μ•ˆλ“œλ‘œμ΄λ“œ)

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        maven {  // <-- THIS
            url 'https://maven.google.com/' // <-- THIS
            name 'Google' // <-- THIS
        } // <-- THIS
    }
    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()
        maven { 
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
        maven { // <-- THIS
            url 'https://maven.google.com/' // <-- THIS
            name 'Google' // <-- THIS
        } // <-- THIS
    }
}

cmdμ—μ„œ: cd android && gradlew clean

λ‚΄ AVDμ—μ„œ 앱을 μ œκ±°ν•˜κ³  λ°˜μ‘ λ„€μ΄ν‹°λΈŒλ‘œ 컴파일

@lahed μ•„μ•„μ•„μ•„μ•„ μž‘λ™ν•˜κ³  μžˆμ–΄ ν˜•!! πŸ’ƒ ν•΄κ²°ν•΄ μ£Όμ…”μ„œ 정말 κ°μ‚¬ν•©λ‹ˆλ‹€.. 3일 λ™μ•ˆ μž‘μ—…ν–ˆμ§€λ§Œ κ²°κ³Όκ°€ μ „ν˜€ μ—†μ—ˆμŠ΅λ‹ˆλ‹€. 그리고 였늘, 당신은 단지 λ‚΄ 생λͺ…을 κ΅¬ν–ˆμŠ΅λ‹ˆλ‹€ πŸ˜ƒ

@lahed , 맀λ ₯처럼 μž‘λ™ν•©λ‹ˆλ‹€.
닫은거 같은데...?
OneSignal νŒ€μ€ 이에 λŒ€ν•΄ 무엇을 ν•  수 μžˆμŠ΅λ‹ˆκΉŒ?
ν–₯μƒλœ λ°˜μ‘ λ„€μ΄ν‹°λΈŒ 링크 ?

@lahed ty, 그 일

ν•˜λ‚˜μ˜ μ‹ ν˜Έλ₯Ό μ‚¬μš©ν•˜λŠ” 2개의 ν”„λ‘œμ νŠΈκ°€ μžˆμŠ΅λ‹ˆλ‹€.
ν”„λ‘œμ νŠΈ 1 ν•„μš” μ—†μŒ OneSignal.init
κ·ΈλŸ¬λ‚˜ ν”„λ‘œμ νŠΈ 2λŠ” OneSignal.initκ°€ ν•„μš”ν•©λ‹ˆλ‹€.
아무도 그것을 μ„€λͺ…ν•  수 μžˆμŠ΅λ‹ˆκΉŒ?

@stevanus1997 μ•„λ§ˆλ„ 당신은 이미 ν”„λ‘œμ νŠΈ 2(?)의 build.gradle에 μ΄ˆκΈ°ν™”λ₯Ό μ •μ˜ν–ˆμ„ 수 μžˆμŠ΅λ‹ˆλ‹€(즉, 이전 λ°©μ‹μœΌλ‘œ OneSignal μ΄ˆκΈ°ν™”λ₯Ό μ •μ˜ν–ˆμŠ΅λ‹ˆλ‹€). λ”°λΌμ„œ App.jsμ—μ„œ λ‹€μ‹œ μ΄ˆκΈ°ν™”ν•  ν•„μš”κ°€ μ—†μ—ˆμŠ΅λ‹ˆλ‹€.

ν”„λ‘œμ νŠΈ 1

defaultConfig {
        applicationId "com.xxxxx"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
        manifestPlaceholders = [
               onesignal_app_id: "xxxxxxxxx",
               onesignal_google_project_number: "xxxxxxxxx"
       ]
    }

ν”„λ‘œμ νŠΈ 2

defaultConfig {
        applicationId "com.xxxx"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
        manifestPlaceholders = [
                onesignal_app_id               : "xxxxx",
                onesignal_google_project_number: "xxxxx"
        ]
        multiDexEnabled true
    }

@ifanfaizal은 λ‚΄ build.gradleμž…λ‹ˆλ‹€.

@lah 정말 κ°μ‚¬ν•©λ‹ˆλ‹€. 이제 맀λ ₯처럼 μž‘λ™ν•©λ‹ˆλ‹€...!!!

@lahed 의 μ†”λ£¨μ…˜μ„ λ”°λžμ§€λ§Œ μ—¬μ „νžˆ OneSignal의 λŒ€μ‹œλ³΄λ“œμ—μ„œ λ™μΌν•œ 였λ₯˜κ°€ λ°œμƒν•©λ‹ˆλ‹€. λˆ„κ΅°κ°€ κ³ μ •λœ android/build.gradle 및 android/app/build.gradle λ₯Ό λ‚˜μ—κ²Œ 보여쀄 수 μžˆμŠ΅λ‹ˆκΉŒ?

컴파일러λ₯Ό λ‹«κ³  λ‹€μ‹œ μ»΄νŒŒμΌν•˜μ‹­μ‹œμ˜€.

벌써 μ—¬λŸ¬λ²ˆ ν–ˆλ„€μš” πŸ˜•

Android Studio와 ν•¨κ»˜ Google Play μ„œλΉ„μŠ€λ₯Ό μ„€μΉ˜ν•˜μ…¨μŠ΅λ‹ˆκΉŒ?

λ„€, μ΅œμ‹  λ²„μ „μž…λ‹ˆλ‹€. Android 8.0μ—μ„œ μ‹€ν–‰ μ€‘μž…λ‹ˆλ‹€.

android/app/build.gradle :

apply plugin: "com.android.application"
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

import com.android.build.OutputFile

apply from: "../../node_modules/react-native/react.gradle"

def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false

android {
    compileSdkVersion 27
    buildToolsVersion "27.0.2"

    defaultConfig {
        applicationId "xxx"
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 31
        versionName "0.3.0"
        multiDexEnabled true
        vectorDrawables.useSupportLibrary = true
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
        manifestPlaceholders = [manifestApplicationId: "${applicationId}",
                                onesignal_google_project_number: "xxx"]
    }
    signingConfigs {
        release {
            if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
                storeFile file(MYAPP_RELEASE_STORE_FILE)
                storePassword MYAPP_RELEASE_STORE_PASSWORD
                keyAlias MYAPP_RELEASE_KEY_ALIAS
                keyPassword MYAPP_RELEASE_KEY_PASSWORD
            }
        }
    }
    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"
            signingConfig signingConfigs.release
        }
    }
    // 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
            }
        }
    }
}

repositories {
    maven { url "https://jitpack.io" }
}

dependencies {
    compile project(':react-native-image-picker')
    compile(project(':react-native-maps')){
        exclude group: 'com.google.android.gms', module: 'play-services-base'
        exclude group: 'com.google.android.gms', module: 'play-services-maps'
    }
    compile 'com.google.android.gms:play-services-base:+'
    compile 'com.google.android.gms:play-services-maps:+'
    compile project(':react-native-svg')
    compile project(':react-native-dialogs')
    compile project(':react-native-onesignal')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile project(':react-native-vector-icons')
    compile project(':react-native-i18n')
    compile project(':react-native-fetch-blob')
    compile (project(':react-native-camera')) {
        exclude group: "com.android.support"
        exclude group: "com.google.android.gms"
    }
    compile ("com.google.android.gms:play-services-vision:+") {
        force = true;
    }
    compile ('com.android.support:exifinterface:27.0.2') {
        force = true;
    }
    compile "com.android.support:appcompat-v7:27.0.2"
    compile 'com.android.support:support-vector-drawable:27.0.2'
    compile 'com.android.support:animated-vector-drawable:27.0.2'
    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()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
        maven { url 'https://plugins.gradle.org/m2/' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.10.1, 0.99.99]'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenLocal()
        jcenter()
        maven { url "$rootDir/../node_modules/react-native/android" }
        maven {
            url "https://maven.google.com"
            name 'Google'
        }
        maven { url "https://jitpack.io" }
    }
}

ν•˜λ‚˜μ˜ μ‹ ν˜Έ λͺ©λ‘ λ‚΄μ—μ„œ μ‹€μ œ μž₯치 Option > μ‚­μ œλ₯Ό μ œκ±°ν•˜κ³  디버그 앱을 μ œκ±°ν•œ λ‹€μŒ λ‹€μ‹œ μ»΄νŒŒμΌν•˜μ‹­μ‹œμ˜€.

+1 λ°˜μ‘ λ„€μ΄ν‹°λΈŒ jsμ—μ„œ μ΄ˆκΈ°ν™” 호좜둜 onIdsλ₯Ό μˆ˜μ‹ ν•˜μ§€ μ•ŠμŒ

@congnguyen91 μ˜ˆμƒλ©λ‹ˆλ‹€. onIds μ΄λ²€νŠΈλŠ” ꡬ독 μƒνƒœ(id's)κ°€ μ‹€μ œλ‘œ 변경될 λ•Œλ§Œ λ°œμƒν•©λ‹ˆλ‹€.

onIds λ₯Ό κ°•μ œλ‘œ μ‹€ν–‰μ‹œν‚€λ €λ©΄ μ΄ˆκΈ°ν™” ν›„ OneSignal.configure() λ₯Ό ν˜ΈμΆœν•˜λ©΄ λ©λ‹ˆλ‹€. 이것은 ν˜Όλž€μŠ€λŸ½μŠ΅λ‹ˆλ‹€. 저도 μ•Œκ³  μžˆμŠ΅λ‹ˆλ‹€. μœ μ‚°μž…λ‹ˆλ‹€. μš°λ¦¬λŠ” 이것을 덜 ν˜Όλž€μŠ€λŸ½κ²Œ λ§Œλ“€κΈ° μœ„ν•΄ λ‹€μŒ μ£Όμš” λ¦΄λ¦¬μŠ€μ—μ„œ λ¦¬νŒ©ν† λ§ν•  κ²ƒμž…λ‹ˆλ‹€.

@lahedλ‹˜ , μ•ˆλ…•ν•˜μ„Έμš”. μ œμ•ˆλœ λ³€κ²½ 사항을 보고 μžˆμŠ΅λ‹ˆκΉŒ? https://github.com/geektimecoil/react-native-onesignal/issues/525#issuecomment -392224930, min. ν•„μš”ν•œ compileSdkVersion 및 buildToolsVersion λŠ” 이제 26μž…λ‹ˆλ‹€( Android 8.0 을 의미)? (μ„€μ • κ°€μ΄λ“œμ˜ μ°Έκ³  사항과 일치: https://documentation.onesignal.com/v5.0/docs/react-native-sdk-setup#section-adding-the-gradle-plugin).

이것은 ν˜„μž¬ compileSdkVersion 및 buildToolsVersion κ°€ 23 및 23.0.2이기 λ•Œλ¬Έμ— Android 6.xκ°€ 더 이상 μ§€μ›λ˜μ§€ μ•ŠλŠ”λ‹€λŠ” 것을 μ˜λ―Έν•©λ‹ˆκΉŒ?

λ‹Ήμ‹ μ˜ 도움을 μ£Όμ…”μ„œ κ°μ‚¬ν•©λ‹ˆλ‹€!

@natterstefan 거의 ν™•μ‹€ν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€. ν•˜μœ„ μž₯치λ₯Ό μ •μ˜ν•˜λŠ” 것은 minSdkVersionμ΄λ―€λ‘œ κΈ°λ³Έ APIκ°€ μ§€μ›λ˜μ§€ μ•ŠλŠ” ν•œ λͺ¨λ“  것이 μ™„λ²½ν•˜κ²Œ μž‘λ™ν•©λ‹ˆλ‹€. Android 4.4μ—μ„œ ν…ŒμŠ€νŠΈν–ˆλŠ”λ° 잘 μž‘λ™ν•©λ‹ˆλ‹€.

μ—¬κΈ°μ„œ ν•΄κ²°ν–ˆμŠ΅λ‹ˆλ‹€....
Google Play μ„œλΉ„μŠ€ νŒ¨ν‚€μ§€μ™€ onesignal을 μ°¨λ‘€λ‘œ μ œκ±°ν–ˆμŠ΅λ‹ˆλ‹€.
이 ν›„ onesignal을 μ„€μΉ˜ν–ˆκ³  λͺ¨λ“  것이 이제 μž‘λ™ν•©λ‹ˆλ‹€.
μΆ”μ‹ : λΉŒλ“œ ν›„ μƒμ„±λœ μ•„μΉ΄μ΄λΈŒλ₯Ό μ‚΄νŽ΄λ³΄κ³  google play services dll이 μžˆλŠ”μ§€ ν™•μΈν•˜μ‹­μ‹œμ˜€.
P2s: μ €λŠ” xamarin μ• ν”Œλ¦¬μΌ€μ΄μ…˜κ³Ό ν•¨κ»˜ onesignal을 μ‚¬μš©ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€.

compileSdkVersion 및 buildToolsVersion κ°€ 26μ„Έ 이상인지 ν™•μΈν•˜λŠ” λ‚΄μš©μ„ ν¬ν•¨ν•˜λ„λ‘ μ„€λͺ…μ„œλ₯Ό μ—…λ°μ΄νŠΈν–ˆμŠ΅λ‹ˆλ‹€.
https://documentation.onesignal.com/docs/react-native-sdk-setup#section -adding-the-gradle-plugin

이것은 @lahedκ°€ https://github.com/geektimecoil/react-native-onesignal/issues/525#issuecomment -392224930 μ—μ„œ μ œμ•ˆν•œ 것 쀑 ν•˜λ‚˜μž…λ‹ˆλ‹€.

λ‹€λ₯Έ μƒˆλ‘œμš΄ 뢀뢄은 OneSignal Gradle ν”ŒλŸ¬κ·ΈμΈμ„ ν”„λ‘œμ νŠΈμ— μΆ”κ°€ν•˜λŠ” κ²ƒμž…λ‹ˆλ‹€. μ΄λ ‡κ²Œ ν•˜λ©΄ app/build.gradle appcompat-v7 λ₯Ό μˆ˜λ™μœΌλ‘œ μ—…λ°μ΄νŠΈν•  ν•„μš”κ°€ μ—†κ³  λ‹€λ₯Έ ν”ŒλŸ¬κ·ΈμΈμ—μ„œ μΆ©λŒν•˜λŠ” 버전 문제λ₯Ό ν•΄κ²°ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

μƒˆ 문제λ₯Ό μƒμ„±ν•˜κ±°λ‚˜ λ™μΌν•œ λ¬Έμ œκ°€ ν‘œμ‹œλ˜λŠ” 경우 여기에 νšŒμ‹ ν•˜κΈ° 전에 μƒˆλ‘œμš΄ Adding the Gradle Plugin μ„Ήμ…˜μ„ λ”°λžλŠ”μ§€ ν™•μΈν•˜μ‹­μ‹œμ˜€.

@lahed 정말 κ°μ‚¬ν•©λ‹ˆλ‹€. 이 문제λ₯Ό 2일 λ™μ•ˆ μ•Œμ•„λ‚΄λ €κ³  λ…Έλ ₯ν–ˆκ³  λ§ˆμΉ¨λ‚΄ μ—¬κΈ°μ—μ„œ 맀우 μœ μš©ν•œ 문제λ₯Ό μ°Ύμ•˜μŠ΅λ‹ˆλ‹€. κ°μ‚¬ν•©λ‹ˆλ‹€.

λ‚˜λŠ” 같은 것을 가지고 μžˆμ—ˆμ§€λ§Œ λ‹€μŒκ³Ό 같이 onesignal.configure()λ₯Ό ν˜ΈμΆœν•˜μ—¬ μž‘λ™ν•˜κ²Œ ν–ˆμŠ΅λ‹ˆλ‹€.

OneSignal.init("my-onesignal-id");
OneSignal.configure();

이것은 λ‹€μŒκ³Ό ν•¨κ»˜ν–ˆμŠ΅λ‹ˆλ‹€.
"λ°˜μ‘ λ„€μ΄ν‹°λΈŒ": "~0.56.0",
"react-native-onesignal": "^3.2.6",

쒅에 λŒ€ν•œ onesignal λ¬Έμ„œλ₯Ό λ”°λžκ³ 
ν”ŒλŸ¬κ·ΈμΈ 적용: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

λ‹€λ₯Έ 정보:
그라듀 3.1.3
λ‚΄μ„  {
compileSdkVersion = 27
buildToolsVersion = "27.0.3"
μ΅œμ†Œ SDK 버전 = 16
λŒ€μƒ SDK 버전 = 27
supportLibVersion = "27.1.1"
googlePlayServicesVersion = "12.0.1"
playServicesVersion = googlePlayServicesVersion
}

제 κ²½μš°μ—λŠ” OneSignal λŒ€μ‹œλ³΄λ“œμ—μ„œ 였λ₯˜κ°€ λ°œμƒν•˜μ§€ μ•Šμ•˜μŠ΅λ‹ˆλ‹€. μž₯μΉ˜κ°€ OneSignal에 잘 λ“±λ‘λ˜μ—ˆμŠ΅λ‹ˆλ‹€. onIds 이(κ°€) λ°œμ‚¬λ˜μ§€ μ•Šμ•˜μŠ΅λ‹ˆλ‹€.

OneSignal.init() 직후에 이것을 μΆ”κ°€ν•˜λ©΄ λ‚΄ λ¬Έμ œκ°€ ν•΄κ²°λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

    OneSignal.configure();

이것이 λ‹€λ₯Έ μ‚¬λžŒλ“€μ„ 돕기λ₯Ό λ°”λžλ‹ˆλ‹€.

μ—¬κΈ°μ„œλ„ 같은 문제

νŒ¨ν‚€μ§€.json:

{
  "name": "smartial",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint .",
    "android-linux": "npx react-native run-android --terminal \"$PWD/shkonsole\""
  },
  "dependencies": {
    "@react-native-community/google-signin": "^4.0.3",
    "react-native-onesignal": "^3.7.3",
    "@sentry/react-native": "^1.4.1",
    "react-native-code-push": "^6.2.1",
    "react-native-google-places": "^3.1.2",
    "@react-native-community/datetimepicker": "^2.4.2",
    "@react-native-community/masked-view": "^0.1.10",
    "@react-navigation/material-bottom-tabs": "^5.2.12",
    "@react-navigation/native": "^5.4.3",
    "@react-navigation/stack": "^5.4.0",
    "react-native-gesture-handler": "^1.6.1",
    "native-base": "^2.13.12",
    "react-native-paper": "^3.10.1",
    "react-native-safe-area-context": "^2.0.3",
    "react-native-reanimated": "^1.9.0",
    "react-native-screens": "^2.8.0",
    "apisauce": "^1.1.1",
    "react-native-config": "^1.2.1",
    "react-native-easy-app": "^1.7.3",
    "react-native-vector-icons": "^6.6.0",
    "@thallyssonklein/border-layout-react-native": "^1.0.14",
    "recoil": "github:eveningkid/Recoil#react-native",
    "react": "16.13.1",
    "react-native": "0.63.2"
  },
  "devDependencies": {
    "@babel/core": "^7.10.0",
    "@babel/runtime": "^7.10.0",
    "@bam.tech/react-native-make": "^3.0.0",
    "@react-native-community/eslint-config": "^1.1.0",
    "babel-jest": "^26.0.1",
    "eslint": "^7.1.0",
    "jest": "^26.0.1",
    "metro-react-native-babel-preset": "^0.59.0",
    "react-test-renderer": "16.11.0"
  },
  "jest": {
    "preset": "react-native"
  }
}

μ•ˆλ“œλ‘œμ΄λ“œ/λΉŒλ“œ.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 16
        compileSdkVersion = 28
        targetSdkVersion = 28

        googlePlayServicesAuthVersion = "16.0.1"
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath('com.android.tools.build:gradle:3.6.3')
        classpath 'com.google.gms:google-services:4.1.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenLocal()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }

        google()
        jcenter()
        maven { url 'https://www.jitpack.io' }
    }
}

μ•ˆλ“œλ‘œμ΄λ“œ/μ•±/λΉŒλ“œ.gradle

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. If none specified and
 *   // "index.android.js" exists, it will be used. Otherwise "index.js" is
 *   // default. Can be overridden with ENTRY_FILE environment variable.
 *   entryFile: "index.android.js",
 *
 *   // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format
 *   bundleCommand: "ram-bundle",
 *
 *   // 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 = [
    enableHermes: false,  // clean and rebuild if changing
]

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

/**
 * The preferred build flavor of JavaScriptCore.
 *
 * For example, to use the international variant, you can use:
 * `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
 *
 * The international variant includes ICU i18n library and necessary data
 * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
 * give correct results when using with locales other than en-US.  Note that
 * this variant is about 6MiB larger per architecture than default.
 */
def jscFlavor = 'org.webkit:android-jsc:+'

/**
 * Whether to enable the Hermes VM.
 *
 * This should be set on project.ext.react and mirrored here.  If it is not set
 * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
 * and the benefits of using Hermes will therefore be sharply reduced.
 */
def enableHermes = project.ext.react.get("enableHermes", false);

android {
    compileSdkVersion rootProject.ext.compileSdkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        applicationId "com.smartial"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 24
        versionName "3.0.9"
        multiDexEnabled true
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
        }
    }
    signingConfigs {
        debug {
            storeFile file('debug.keystore')
            storePassword 'android'
            keyAlias 'androiddebugkey'
            keyPassword 'android'
        }
        release {
            storeFile file('smartial-app.jks')
            storePassword KEYSTORE_PASSWORD
            keyAlias KEY_ALIAS
            keyPassword KEY_PASSWORD
        }
    }
    buildTypes {
        debug {
            signingConfig signingConfigs.debug
        }
        release {
            // Caution! In production, you need to generate your own keystore file.
            // see https://facebook.github.io/react-native/docs/signed-apk-android.
            signingConfig signingConfigs.release
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }

    packagingOptions {
        pickFirst "lib/armeabi-v7a/libc++_shared.so"
        pickFirst "lib/arm64-v8a/libc++_shared.so"
        pickFirst "lib/x86/libc++_shared.so"
        pickFirst "lib/x86_64/libc++_shared.so"
    }

    // 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:
            // https://developer.android.com/studio/build/configure-apk-splits.html
            def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
            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 {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    // implementation 'com.google.android.gms:play-services-auth:18.0.0'
    // implementation "com.google.android.gms:play-services-base:16.0.1"
    // implementation "com.google.firebase:firebase-core:16.0.6"
    // implementation "com.google.firebase:firebase-messaging:17.3.4"
    //noinspection GradleDynamicVersion
    implementation "com.facebook.react:react-native:+"  // From node_modules

    implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
    compile 'com.android.support:multidex:1.0.1' //enter the latest version

    debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
      exclude group:'com.facebook.fbjni'
    }

    debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
        exclude group:'com.facebook.flipper'
    }

    debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
        exclude group:'com.facebook.flipper'
    }

    if (enableHermes) {
        def hermesPath = "../../node_modules/hermes-engine/android/";
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }

    implementation project(':react-native-config')
    compile project(':react-native-onesignal') // I just added this line 
}

// 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'
}

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"

apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"

apply plugin: 'com.google.gms.google-services' // <--- this should be the last line

src/main/AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.smartial">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>


    <application
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:allowBackup="false"
      android:theme="@style/AppTheme">
      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
        android:launchMode="singleTask"
        android:windowSoftInputMode="adjustResize">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
      </activity>
      <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
    </application>

</manifest>

src/디버그/AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>

    <application android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" />
</manifest>

이 νŽ˜μ΄μ§€κ°€ 도움이 λ˜μ—ˆλ‚˜μš”?
0 / 5 - 0 λ“±κΈ‰