我知道这是因为谷歌新版本更新gms到12.0.0这里是链接https://developers.google.com/android/guides/releases
添加android/build.gradle
但现在它不编译信号因为它也使用不同版本的Google服务
github上的其他解决方案建议我在依赖项中添加“+”,但它不起作用
configurations.all {
// #PlayServicesGate — March, 20 2018
resolutionStrategy {
force 'com.google.android.gms:play-services-auth:11.8.0'
// Firebase dependencies
force "com.google.android.gms:play-services-base:11.8.0"
force 'com.google.firebase:firebase-core:11.8.0'
force 'com.google.firebase:firebase-auth:11.8.0'
}
}
如果有人知道这个,请告诉我
:react-native-onesignal:prepareComGoogleAndroidGmsPlayServicesTagmanagerV4Impl1200Library
:react-native-onesignal:prepareComGoogleAndroidGmsPlayServicesTagmanagerV4ImplLicense1200Library
:react-native-onesignal:prepareComGoogleAndroidGmsPlayServicesTasks1200Library
:react-native-onesignal:prepareComGoogleAndroidGmsPlayServicesTasksLicense1200Library
:react-native-onesignal:prepareComOnesignalOneSignal382Library
:react-native-onesignal:prepareOrgWebkitAndroidJscR174650Library
:react-native-onesignal:prepareReleaseDependencies
:react-native-onesignal:compileReleaseAidl
:react-native-onesignal:compileReleaseNdk UP-TO-DATE
:react-native-onesignal:compileLint
:react-native-onesignal:copyReleaseLint UP-TO-DATE
:react-native-onesignal:compileReleaseRenderscript
:react-native-onesignal:generateReleaseBuildConfig
:react-native-onesignal:generateReleaseResValues
:react-native-onesignal:generateReleaseResources
:react-native-onesignal:mergeReleaseResources
:react-native-onesignal:processReleaseManifest
:react-native-onesignal:processReleaseResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-onesignal:processReleaseResources'.
> Error: more than one library with package name 'com.google.android.gms.license'
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 3 mins 7.465 secs
Error: /Users/vsts/agent/2.131.0/work/1/s/android/gradlew failed with return code: 1
at ChildProcess.<anonymous> (/Users/vsts/agent/2.131.0/work/_tasks/Gradle_8d8eebd8-2b94-4c97-85af-839254cc6da4/1.128.0/node_modules/vsts-task-lib/toolrunner.js:569:30)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:886:16)
at Socket.<anonymous> (internal/child_process.js:342:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at Pipe._handle.close [as _onclose] (net.js:497:12)
答案 0 :(得分:1)
转到project.properties并更改以下行:
cordova.system.library.2 = com.google.android.gms:播放服务-GCM:+ cordova.system.library.3 = com.google.android.gms:播放服务-位置:+
要
cordova.system.library.2 = com.google.android.gms:玩服务-GCM:11+ cordova.system.library.3 = com.google.android.gms:播放服务-位置:11 +
它对我有用:)
答案 1 :(得分:0)
只需在代码块中添加这些行
即可 configurations.all{
//here include these line
force 'com.google.android.gms:play-services-gcm:11.8.0'
force 'com.google.android.gms:play-services-analytics:11.8.0'
force 'com.google.android.gms:play-services-location:11.8.0'
}
答案 2 :(得分:0)
它很简单,因为我正在努力学习我的项目,我发现你在项目中使用的任何依赖项都使用'+'而现在它不再起作用所以通过执行特定的版本
in:android / build.gradle
configurations.all {
resolutionStrategy {
force "com.google.android.gms:play-services-gcm:11.8.0"
.... your other dependencies
}
}
这对我有用,因为我陷入了信号,但我得到了所有依赖形式的信号,并给它特定的版本,现在一切都工作正常
答案 3 :(得分:0)
我已尝试过这里发布的一些解决方案但没有成功,我真的不想深入研究node_modules
,但这就是我所做的事情,因为我的项目是时间敏感的。至少在找到永久性解决方案之前。
在我的应用级build.gradle
中,我已将所有Google依赖关系更新为版本11.8.0,例如compile "com.google.android.gms:play-services-base:11.8.0"
。然后在react-native-onesignal's build.gradle
:
我更改了这些内容:
compile 'com.google.android.gms:play-services-gcm:+'
compile 'com.google.android.gms:play-services-analytics:+'
compile 'com.google.android.gms:play-services-location:+'
与以下相同的特定版本:
compile 'com.google.android.gms:play-services-gcm:11.8.0'
compile 'com.google.android.gms:play-services-analytics:11.8.0'
compile 'com.google.android.gms:play-services-location:11.8.0'
这似乎解决了错误。如果有人有更好的解决方案,我很乐意在项目中实施。与此同时,我希望这也有助于其他人。