描述:
将"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 插件,固定 firebase 库版本,同时从 android 插件中排除 gcm 组,将所有 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 是什么版本?
我不得不再做一项改变。 我在gradle-wrapper.properties
改为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您的修改以及@dhamaniasad对gradle-wrapper.properties
的建议更改有效!
@dhamaniasad我试过 23 或 26 可以正常工作,很高兴听到你成功了!
@ avin3sh 恭喜! 这似乎与谷歌播放服务有关。
@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'
}
我的毕业
// 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我可以得到你项目的 repo 来比较吗?
@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 studio 版本? 我已经升级了工作室版本 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 库。 我建议将google()
到您的allprojects { repositories { ... } }
部分,以解决此错误。
allprojects {
repositories {
mavenLocal()
google()
jcenter()
// ...
}
}
@ashishmusale @jkasten2谢谢它现在正在工作。 但是,它没有在 One Signal 注册
这是我的 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如果您可以检查,我已经
一切顺利,谢谢大家
听到那个消息很开心!
任何人都可以给我一个完全配置的项目,运行良好......我被困了2天。 没有什么对我有用..........plz
@nahidmbstu告诉我你卡在哪里每个人都有很奇怪的问题,让我们尝试为你解决它
我是 3.1.4 上的 gcm lincence 错误,当我尝试这个 repo 中的示例项目时,它不起作用......我需要一些配置好的项目,通知工作......
在设备 ID 上获取 Push token null................. @davekedar 。 在一个信号仪表板上也收到 google play 服务初始化错误。
@nahidmbstu你有没有尝试建立一个新的新项目?
谢谢,我在使用 google play 服务时遇到了问题,这就是它造成的原因。 我已经解决了它
https://github.com/geektimecoil/react-native-onesignal/issues/387
@nahidmbstu很棒
最有用的评论
我不得不再做一项改变。 我在
gradle-wrapper.properties
改为distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
gradle-wrapper.properties
,它起作用了。 compileSdkVersion 为 23,buildToolsVersion 为 23.0.1