React-native: [Android] Execution failed for task ':app:prepareComAndroidSupportAppcompatV72301Library'.

Created on 25 Sep 2016  路  12Comments  路  Source: facebook/react-native

Issue Description

Can't use 'run-android' already set ANDROID_HOME to android sdk and devices is connected.

List of devices attached
eea80984        device

Steps to Reproduce / Code Snippets

react-native init HelloWorld && cd HelloWorld
react-native run-android

Expected Results

C:\Devs\react\Android\HelloWorld>react-native run-android
JS server already running.
Running D:\Android\sdk/platform-tools/adb -s eea80984 reverse tcp:8081 tcp:8081
Building and installing the app on the device (cd android && gradlew.bat installDebug...
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72301Library FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:prepareComAndroidSupportAppcompatV72301Library'.
> Could not expand ZIP 'D:\Android\sdk\extras\android\m2repository\com\android\support\appcompat-v7\23.0.1\appcompat-v7-23.0.1.aar'.

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

BUILD FAILED

Total time: 3.679 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html

Additional Information

  • React Native version: 0.34.0
  • Platform(s) (iOS, Android, or both?): Android
  • Operating System (macOS, Linux, or Windows?): Windows
Locked

Most helpful comment

Got the same problem. From Gradle stacktrace:
Caused by: org.gradle.api.GradleException: Invalid Timestamp -15693297624000 for 'zip entry C:\Android\sdk\extras\android\m2repository\com\android\support\appcompat-v7\23.0.1\appcompat-v7-23.0.1.aar!AndroidManifest.xml'.

Seems like my machine use local date format (Buddhist era) and Gradle parse that as negative timestamp. Switching to Common era solved the problem.

All 12 comments

Ensure you have the 23.0.1 version of the support libraries installed via the android sdk manager.

@rmevans9
scree nsho112

What version of "Android Support Library" do you have?

@rmevans9 23.2.1
scree nsho112

Got the same problem. From Gradle stacktrace:
Caused by: org.gradle.api.GradleException: Invalid Timestamp -15693297624000 for 'zip entry C:\Android\sdk\extras\android\m2repository\com\android\support\appcompat-v7\23.0.1\appcompat-v7-23.0.1.aar!AndroidManifest.xml'.

Seems like my machine use local date format (Buddhist era) and Gradle parse that as negative timestamp. Switching to Common era solved the problem.

Thanks! timeformat

@rudwna Thanks man!
You've helped us!

Another lesson I learnt today, never rename the directory created by react-native init <project_name>.
for me this was the reason that caused this error.

Using this commands solved my build issue:
cd android
gradlew clean

Seems like my machine use local date format (Buddhist era) and Gradle parse that as negative timestamp. Switching to Common era solved the problem.

Oh! Can't believe! Changing region solves this problem. 馃槺
Thank you.

1 year ago i solved by "downgrade java 8 to java 7" (oracle not support java 7)
But solved by "change region thai to english". It exactly awnser.
Very Thanks

But now it's really annoying to switch region between US and my country. I really hate switching now. 馃槫

Does it have other way to solve this issue?

Was this page helpful?
0 / 5 - 0 ratings