Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android - Cannot build #221

Closed
demiro opened this issue Jun 9, 2016 · 17 comments
Closed

Android - Cannot build #221

demiro opened this issue Jun 9, 2016 · 17 comments

Comments

@demiro
Copy link

demiro commented Jun 9, 2016

So I have installed the package and linked it and when building I get this

:app:dexDebug
Unknown source file : UNEXPECTED TOP-LEVEL EXCEPTION:
Unknown source file : com.android.dex.DexException: Multiple dex files define Landroid/support/v7/appcompat/R$anim;
Unknown source file : at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
Unknown source file : at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
Unknown source file : at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
Unknown source file : at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
Unknown source file : at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
Unknown source file : at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:502)
Unknown source file : at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
Unknown source file : at com.android.dx.command.dexer.Main.run(Main.java:277)
Unknown source file : at com.android.dx.command.dexer.Main.main(Main.java:245)
Unknown source file : at com.android.dx.command.Main.main(Main.java:106)

:app:dexDebug FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:dexDebug'.

    com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_92\bin\java.exe'' finished with non-zero exit value 2

I checked all the android files as suggested for manual link and they are all there (except for extra permissions needed - which I aded)

I opened the android sdk and updated...

but still the issue persists

@marcshilling
Copy link
Contributor

I'm in the middle of updating the package.

npm install react-native-image-picker@latest. Refer to the updated README

@marcshilling
Copy link
Contributor

Also, nothing in your stack trace indicates any issue with this particular package

@demiro
Copy link
Author

demiro commented Jun 9, 2016

Ran from the android studio which warned me there are some problems with the version of gradle?

anyways... after fixing that I ran the build again which produced:

  • What went wrong:
    Execution failed for task ':react-native-image-picker:processReleaseResources'.

    java.io.IOException: Could not delete folder C:\DEVEOPMENT\tCoach\mobile-app\node_modules\react-native-image-picker\android\build\generated\source\r\release\android\support\v7

I did install the latest before.... if you are in the middle of updating I will wait :)

@demiro
Copy link
Author

demiro commented Jun 9, 2016

reinstalled the latest, working now!

@imalbert
Copy link

I'm getting this too. @demiro do you recall what problems you fixed with gradle and how? It seems that is the cause of this problem.

@demiro
Copy link
Author

demiro commented Jun 17, 2016

@imalbert : I don't know much about android studio, but it offered me at the time to auto-fix it for me (guess it installed some missing dependencies and updated)

@imalbert
Copy link

I don't use android studio myself as well. Has it been working well since the fix?

@marcshilling I see this build problem on react-native 0.24 and 0.27. Yet if I run react-native-image-picker example it runs perfectly. Do you have any ideas about this?

@demiro
Copy link
Author

demiro commented Jun 17, 2016

It works OK

@imalbert
Copy link

Hi, running cd android && ./gradlew clean fixed the problem for me. I found it here

@matdehaast
Copy link

@imalbert that worked for me aswell. Thanks

@Ashu-Shah
Copy link

@imalbert Thank you soo much man....

@LannyCodes
Copy link

@imalbert running cd android && ./gradlew clean fixed my problem,Thanks!

@ogie-va
Copy link

ogie-va commented Apr 1, 2018

thanks! this worked for me cd android && gradlew clean

@MadGeorge
Copy link

For me it does not work after cd android && gradlew clean.

$ yarn add react-native-image-picker@latest --save
...
yarn add v1.3.2

react-native link
...
Linking assets to android project 
Assets have been successfully linked to your project

iOS build is ok, but android still failed.

@RajaSaravanan
Copy link

#882
It worked!

@Usamashahid76
Copy link

It works:

android{
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

@engineerbaraazakariya
Copy link

For me on Ubuntu I used:
cd android && gradle clean
hope it helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests