私の研究にもかかわらず、私は問題を理解できませんでした。私を助けてください。どこでエラーを起こしますか?以下のすべての情報を共有しました。すべての方法を試しましたが、問題を解決できませんでした。
build.gradleファイル:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
def googlePlayServicesVersion = '11.8.0'
buildscript {
repositories {
jcenter()
mavenCentral()
maven {
url 'https://maven.google.com/'
name '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
}
}
def versionOverrides = [
"com.facebook.Android:facebook-Android-sdk": "4.22.1",
]
project(':react-native-fbsdk') {
configurations.all {
resolutionStrategy {
force 'com.facebook.Android:facebook-Android-sdk:4.22.1'
}
}
}
allprojects {
repositories {
// Add jitpack repository (added by tipsi-stripe)
maven { url "https://jitpack.io" }
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 {
url 'https://maven.google.com/'
name 'Google'
}
}
configurations.all {
resolutionStrategy {
// react-native-admob
force "com.google.Android.gms:play-services-ads:$googlePlayServicesVersion"
// react-native-onesignal
force "com.google.Android.gms:play-services-gcm:$googlePlayServicesVersion"
force "com.google.Android.gms:play-services-analytics:$googlePlayServicesVersion"
force "com.google.Android.gms:play-services-location:$googlePlayServicesVersion"
force 'com.facebook.Android:facebook-Android-sdk:4.22.1'
}
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def overrideVersion = versionOverrides[details.requested.group + ":" + details.requested.name]
if (overrideVersion != null && details.requested.version != overrideVersion) {
println("********************************************************")
println("Overriding dependency ${details.requested.group}:${details.requested.name} version ${details.requested.version} --> $overrideVersion")
details.useVersion overrideVersion
println("********************************************************")
}
}
}
}
subprojects {
afterEvaluate {
project -> if (project.hasProperty("Android")) {
Android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
}
}
}
}
React-Native run-Androidエラー:
> Could not resolve all dependencies for configuration ':app:_debugApk'.
> A problem occurred configuring project ':react-native-onesignal'.
> Could not find play-services-tasks-license.aar (com.google.Android.gms:play-services-tasks-license:11.8.0).
Searched in the following locations:
https://jcenter.bintray.com/com/google/Android/gms/play-services-tasks-license/11.8.0/play-services-tasks-license-11.8.0.aar
JCenterはhttps://jcenter.bintray.com/com/google/Android/gms/play-services-tasks-license/11.8.0/play-services-tasks-license-11.8.0.aar
を提供しません。これは:
maven { https://maven.google.com/ }
Jcenter()をmaven { url "https://maven.google.com" }
と交換して、再試行してください。
build.gradle
allprojects {
repositories {
mavenLocal()
maven {
url "https://maven.google.com"
}
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/Android"
}
configurations.all {
resolutionStrategy {
force 'com.facebook.Android:facebook-Android-sdk:4.31.0'
force 'com.google.Android.gms:play-services-base:11.8.0'
force 'com.google.Android.gms:play-services-maps:11.8.0'
force 'com.google.Android.gms:play-services-gcm:11.8.0'
force 'com.google.Android.gms:play-services-location:11.8.0'
}
}
}
}
エラーは消えますが、別のエラーが表示されます
error: cannot access AbstractSafeParcelable
if( remoteMessage.getNotification() != null){
^
class file for com.google.Android.gms.common.internal.safeparcel.AbstractSafeParcelable not found
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
同じ問題が発生し、build.gradleファイルの最後のリンクをコメントするか削除しただけです。
Build.gradleファイルの最後からこの行を削除しました
apply plugin: 'com.google.gms.google-services'
dependencies {
compile 'com.Android.support:support-v4:24.0.0'
compile 'com.google.Android.gms:play-services-ads:11.8.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services' //**Comment or Remove this Line**