React native 名称为'的配置;默认值';未找到-文档选择器

React native 名称为'的配置;默认值';未找到-文档选择器,react-native,React Native,我想使用这个库: react-native-document-picker 我遵循以下步骤: npm i --save react-native-document-picker react-native link 我想在android设备上运行我的项目: Incremental java compilation is an incubating feature. FAILURE: Build failed with an exception. * What went wrong: A

我想使用这个库:

react-native-document-picker

我遵循以下步骤:

npm i --save react-native-document-picker

react-native link
我想在android设备上运行我的项目:

Incremental java compilation is an incubating feature.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApk'.
   > Configuration with name 'default' not found.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED
安装前一切正常

我不知道我的问题在哪里,我不知道我该如何解决它

build.gradle:

dependencies {
    compile project(':react-native-document-picker')
    compile project(':react-native-contacts')
    compile project(':react-native-vector-icons')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"
    compile "com.facebook.react:react-native:+"  // From node_modules
}
setting.gradle:

include ':react-native-document-picker'
project(':react-native-document-picker').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-document-picker/android')
include ':react-native-contacts'
project(':react-native-contacts').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-contacts/android')
include ':react-native-vector-icons'
project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')

include ':app'
MainApplication.java:

@Override
protected List<ReactPackage> getPackages() {
  return Arrays.<ReactPackage>asList(
      new MainReactPackage(),
        new ReactNativeDocumentPicker(),
        new ReactNativeContacts(),
        new VectorIconsPackage()
  );
}
@覆盖
受保护的列表getPackages(){
返回数组.asList(
新建MainReactPackage(),
新的ReactNativeDocumentPicker(),
新的ReactNativeContacts(),
新矢量化包()
);
}

我不是这方面的专家,但这是我在测试中发现的

不幸的是,
npmi--save react native document picker
卸载项目中的所有其他包。因此,在执行
npmi--save react native document picker
之后

  • 再次执行
    npm安装
    。它将安装丢失的软件包。然后
  • 执行
    react native link
    链接库
  • 然后用
    android Studio
    打开android项目目录。它会建议您升级gradle版本。接受它,然后重建项目 就这样。工作源代码可以从


    让我知道它是否对您有效。

    您是否在android/app/build.gradle中添加了这一行:
    编译项目(“:react native document picker”)
    @Cherniv是的。我加上去了。