react-native-webview icon indicating copy to clipboard operation
react-native-webview copied to clipboard

Android: Upgrade from 5.2.1 to 5.12.0 build error

Open linnett opened this issue 7 years ago • 4 comments

Bug description: When upgrading this package from 5.2.1 to 5.12.0 by using yarn upgrade [email protected], iOS works fine but Android has build errors. These are the errors:

Task :react-native-webview:compileDebugJavaWithJavac Note: /node_modules/react-native-webview/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: /node_modules/react-native-webview/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details.

Task :react-native-webview:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug FAILED

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':react-native-webview:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug'. java.lang.RuntimeException: java.util.zip.ZipException: duplicate entry: com/reactnativecommunity/webview/events/TopLoadingErrorEvent.class

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 27s

I am using React Native version 0.57.8

To Reproduce:

  • Upgrade react-native-webview via yarn from 5.2.1 to 5.12.0 by using yarn upgrade [email protected].
  • Run react-native run-android
  • See error as above

Expected behavior: Compiles app and runs in a simulator.

Environment:

  • OS: Android
  • OS version: Any
  • react-native version: 0.57.8
  • react-native-webview version: 5.12.0

linnett avatar Jun 18 '19 10:06 linnett

请问你是如何解决的?

cnpmge avatar Jul 15 '19 05:07 cnpmge

I'm encountering the same issue. Has it been closed by mistake?

damrem avatar Jul 17 '19 12:07 damrem

cd ./android;./gradlew clean ;

HuangZhe007 avatar Aug 07 '19 16:08 HuangZhe007

你可以降低下webview的版本,因为版本会引起这个错误,cd ./android;./gradlew clean;这个命令可以解决现在这个错误,但是你如果要给项目添加新的组件的话,会再次出现这个错误,cd ./android;./gradlew clean;需要再次执行这个命令才会正常!

cnpmge avatar Aug 08 '19 00:08 cnpmge