react-native-background-job 加載依賴(lài)報(bào)錯(cuò)處理
加載依賴(lài)時(shí)報(bào)錯(cuò)信息
Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Could not find com.firebase:firebase-jobdispatcher:0.8.5.
原因:歷史包很久不維護(hù),很多地方已經(jīng)下載不到
處理方式:
1、從其他地方下載包:https://mvnrepository.com/artifact/com.firebase/firebase-jobdispatcher/0.8.5

2、直接下載 firebase-jobdispatcher-0.8.5.aar
3、到node_modules 下 找到第三方庫(kù) react-native-background-job,創(chuàng)建libs 目錄,把上面的 firebase-jobdispatcher-0.8.5.aar 放進(jìn)去

4、修改 build.gradle 文件, 遠(yuǎn)程鏈接,改成本地加載
dependencies {
// compile 'com.firebase:firebase-jobdispatcher:0.8.5'
compile files('libs/firebase-jobdispatcher-0.8.5.aar')
compile 'com.facebook.react:react-native:+'
}
5、參考圖:

6、build.gradle 文件參考
buildscript { repositories { maven{ url 'https://maven.aliyun.com/repository/google'} maven{ url 'https://maven.aliyun.com/repository/gradle-plugin'} maven{ url 'https://maven.aliyun.com/repository/public'} maven{ url 'https://maven.aliyun.com/repository/jcenter'} google() jcenter() mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:3.6.3' } } apply plugin: 'com.android.library' def DEFAULT_COMPILE_SDK_VERSION = 27 def DEFAULT_BUILD_TOOLS_VERSION = '25.0.3' def DEFAULT_TARGET_SDK_VERSION = 27 android { compileSdkVersion project.hasProperty('compileSdkVersion') ? project.compileSdkVersion : DEFAULT_COMPILE_SDK_VERSION buildToolsVersion project.hasProperty('buildToolsVersion') ? project.buildToolsVersion : DEFAULT_BUILD_TOOLS_VERSION // Uncomment to develop with yarn link into node_modules // compileOptions.incremental = false defaultConfig { minSdkVersion 16 targetSdkVersion project.hasProperty('targetSdkVersion') ? project.targetSdkVersion : DEFAULT_TARGET_SDK_VERSION versionCode 2 versionName "2.0" ndk { abiFilters "armeabi-v7a", "x86" } } lintOptions { warning 'InvalidPackage' } } repositories { maven{ url 'https://maven.aliyun.com/repository/google'} maven{ url 'https://maven.aliyun.com/repository/gradle-plugin'} maven{ url 'https://maven.aliyun.com/repository/public'} maven{ url 'https://maven.aliyun.com/repository/jcenter'} google() jcenter() mavenCentral() maven { // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm url "$rootDir/../node_modules/react-native/android" } } dependencies { compile files('libs/firebase-jobdispatcher-0.8.5.aar') compile 'com.facebook.react:react-native:+' }

浙公網(wǎng)安備 33010602011771號(hào)