React-native-onesignal: μž‘μ—… ':react-native-onesignal:processReleaseResources'에 λŒ€ν•œ μ‹€ν–‰ μ‹€νŒ¨

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

μ„€λͺ…:

"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'

ν•˜μ§€λ§Œ 차이가 μ—†μŠ΅λ‹ˆλ‹€.

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

ν•œ 번 더 λ³€κ²½ν•΄μ•Ό ν–ˆμŠ΅λ‹ˆλ‹€. I둜 λ³€κ²½ distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip μ—μ„œ gradle-wrapper.properties , κ·Έλ¦¬κ³ ν–ˆλ‹€. compileSdkVersion은 23이고 buildToolsVersion은 23.0.1μž…λ‹ˆλ‹€.

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

@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 멋지닀

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