Reputation: 17383
I want to use this library:
react-native-document-picker
https://github.com/Elyx0/react-native-document-picker
I follow these steps:
npm i --save react-native-document-picker
react-native link
I want to run my project on android device:
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
everything work fine before install it.
I don't know where is my problem and I dont know how can I solve it!
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()
);
}
Upvotes: 1
Views: 183
Reputation: 11754
I am not a pro in this, but this is what i found from the test I did.
Unfortunately, npm i --save react-native-document-picker
uninstalls all other packages in the project. So after executing npm i --save react-native-document-picker
,
npm install
again. It'll install the missing packages. then react-native link
to link the library.Android Studio
. It'll suggest you to upgrade the gradle version. Accept it , and rebuild the project. That's it. Working source code can be found from here
Let me know if it worked for you.
Upvotes: 2