Reputation: 430
When trying to bundle a signed release of my React Native App for Android (on Mac)
./gradlew bundleRelease
fails with message
> Task :app:collectReleaseDependencies FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:collectReleaseDependencies'.
> java.lang.NullPointerException (no error message)
When executing ./gradlew bundleRelease --info
I get this error:
> Task :app:collectReleaseDependencies FAILED
Task :app:collectReleaseDependencies in @react-native-community_async-storage Starting
file or directory '/Users/ingohinterding/github/codegreen/android/app/libs', not found
Caching disabled for task ':app:collectReleaseDependencies' because:
Build cache is disabled
Task ':app:collectReleaseDependencies' is not up-to-date because:
Task has failed previously.
file or directory '/Users/ingohinterding/github/codegreen/android/app/libs', not found
Task :app:collectReleaseDependencies in @react-native-community_async-storage Finished
:app:collectReleaseDependencies (Thread[Execution worker for ':' Thread 2,5,main]) completed. Took 0.396 secs.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:collectReleaseDependencies'.
> java.lang.NullPointerException (no error message)
I added that folder android/app/libs
and when I run ./gradlew bundleRelease --info
again this is the new error:
> Task :app:collectReleaseDependencies FAILED
Task :app:collectReleaseDependencies in @react-native-community_async-storage Starting
Caching disabled for task ':app:collectReleaseDependencies' because:
Build cache is disabled
Task ':app:collectReleaseDependencies' is not up-to-date because:
Task has failed previously.
Task :app:collectReleaseDependencies in @react-native-community_async-storage Finished
:app:collectReleaseDependencies (Thread[Execution worker for ':' Thread 6,5,main]) completed. Took 0.339 secs.
FAILURE: Build failed with an exception.
Note: When trying ./gradlew assembleRelease
it builds successful, but the APK gets rejected from the Google Play Store because it is not optimized.
Since I'm a beginner at RN I'm not sure what to look for and which information is needed here. React Native version is 0.59.9
(lots of stuff breaks if I update so I'll try to keep it this version).
Upvotes: 1
Views: 3317
Reputation: 430
I was successful doing the following:
./gradlew bundleRelease --build-cache
Hope this helps others with the same issue.
Upvotes: 5