Я запускаю ./gradlew build
после добавления facebook-android-sdk и получаю следующую ошибку.Это как для Windows, так и для Mac с Gradle 4.10.1.
> Task :react-native-fbsdk:lint
Ran lint on variant debug: 19 issues found
Ran lint on variant release: 19 issues found
Wrote HTML report to file:///C:/Foo/Bar/src/ReactNative/node_modules/react-native-fbsdk/android/build/reports/lint-results.html
Wrote XML report to file:///C:/Foo/Bar/src/ReactNative/node_modules/react-native-fbsdk/android/build/reports/lint-results.xml
> Task :react-native-fbsdk:lint FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-fbsdk:lint'.
> Lint found errors in the project; aborting build.
Fix the issues identified by lint, or add the following to your build script to proceed with errors:
...
android {
lintOptions {
abortOnError false
}
}
...
Errors found:
C:\Foo\Bar\src\ReactNative\node_modules\react-native-fbsdk\android\build.gradle: Error: All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 28.0.0, 27.0.2. Examples include com.android.support:animated-vector-drawable:28.0.0 and com.android.support:cardview-v7:27.0.2 [GradleCompatible]
В частности, существует проблема совместимости между com.android.support:animated-vector-drawable:28.0.0
и com.android.support:cardview-v7:27.0.2
.Другие исправили подобные проблемы, изменив эту строку в build.gradle
implementation 'com.facebook.android:facebook-android-sdk:[4,5)'
... примерно так:
implementation('com.facebook.android:facebook-android-sdk:[4,5)') {
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.android.support', module: 'appcompat-v7'
exclude group: 'com.android.support', module: 'cardview-v7'
exclude group: 'com.android.support', module: 'customtabs'
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'com.android.support', module: 'support-core-utils'
exclude group: 'com.android.support', module: ':animated-vector-drawable'
}
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:animated-vector-drawable:28.0.0'
implementation 'com.android.support:exifinterface:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:customtabs:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
Когда я смотрю на зависимости, они кажутся разрешеннымиправильно до 28.0.0, а не 27.0.2, как указано в ошибке:
./gradlew -q dependencies app:dependencies --configuration debugAndroidTestCompileClasspath
=>
// ...
+--- com.facebook.android:facebook-android-sdk:4.40.0
| +--- com.facebook.android:facebook-core:4.40.0
| | +--- com.parse.bolts:bolts-android:1.4.0
| | | +--- com.parse.bolts:bolts-tasks:1.4.0
| | | \--- com.parse.bolts:bolts-applinks:1.4.0
| | | \--- com.parse.bolts:bolts-tasks:1.4.0
| | +--- com.android.support:support-annotations:27.0.2 -> 28.0.0
| | \--- com.android.support:support-core-utils:27.0.2 -> 28.0.0 (*)
| +--- com.facebook.android:facebook-common:4.40.0
| | +--- com.facebook.android:facebook-core:4.40.0 (*)
| | +--- com.android.support:support-v4:27.0.2 -> 28.0.0
| | | +--- com.android.support:support-compat:28.0.0 (*)
| | | +--- com.android.support:support-media-compat:28.0.0
| | | | +--- com.android.support:support-annotations:28.0.0
| | | | +--- com.android.support:support-compat:28.0.0 (*)
| | | | \--- com.android.support:versionedparcelable:28.0.0 (*)
| | | +--- com.android.support:support-core-utils:28.0.0 (*)
| | | +--- com.android.support:support-core-ui:28.0.0 (*)
| | | \--- com.android.support:support-fragment:28.0.0 (*)
| | +--- com.android.support:appcompat-v7:27.0.2 -> 28.0.0 (*)
| | +--- com.android.support:cardview-v7:27.0.2 -> 28.0.0
| | | \--- com.android.support:support-annotations:28.0.0
| | +--- com.android.support:customtabs:27.0.2 -> 28.0.0
| | | +--- com.android.support:support-compat:28.0.0 (*)
| | | +--- com.android.support:support-annotations:28.0.0
| | | +--- com.android.support:interpolator:28.0.0 (*)
| | | +--- com.android.support:collections:28.0.0 (*)
| | | \--- com.android.support:support-core-ui:28.0.0 (*)
| | \--- com.google.zxing:core:3.3.0
Есть идеи, что здесь происходит?
edit Другие вещи, которые нене работает:
- добавление lintOptions к
build.gradle
, как указано в сообщении об ошибке, не имеет никакого эффекта. - очистка кэша
$HOME/.gradle
и кэша ReactNative/android/.gradle
- Обновление до Gradle 4.10.3
- добавление
disable "GradleDependency"
в lintOptions
- пометка строк с
//noinspection GradleDependency
lintOptions.tasks.lint.enabled = false