【问题标题】:react native apk build fail when using react-native-razorpay使用 react-native-razorpay 时反应原生 apk 构建失败
【发布时间】:2018-05-02 10:02:18
【问题描述】:

我正在尝试为我的 react-native 代码构建一个签名的 apk。我使用 react-native-razorpay 库进行支付集成。 在我的项目根目录中运行 cd android && ./gradlew assembleRelease 时,我遇到了以下错误。

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-razorpay:verifyReleaseResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt

* 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 22s
102 actionable tasks: 2 executed, 100 up-to-date

在运行./gradlew assembleRelease --info 时,我在最后几行得到关注-

....
....

Successfully started process 'command '/Users/clove/Library/Android/sdk/build-tools/27.0.3/aapt''
/Users/clove/.gradle/caches/transforms-1/files-1.1/appcompat-v7-26.1.0.aar/37abea56216e7a3ad9a6c076b6dd1a92/res/values-v24/values-v24.xml:3:5-157: AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.

/Users/clove/.gradle/caches/transforms-1/files-1.1/appcompat-v7-26.1.0.aar/37abea56216e7a3ad9a6c076b6dd1a92/res/values-v24/values-v24.xml:4:5-135: AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.

/Users/clove/.gradle/caches/transforms-1/files-1.1/appcompat-v7-26.1.0.aar/37abea56216e7a3ad9a6c076b6dd1a92/res/values-v26/values-v26.xml:13:5-16:13: AAPT: No resource found that matches the given name: attr 'android:keyboardNavigationCluster'.


> Task :react-native-razorpay:verifyReleaseResources FAILED
Putting task artifact state for task ':react-native-razorpay:verifyReleaseResources' into context took 0.0 secs.
Up-to-date check for task ':react-native-razorpay:verifyReleaseResources' took 0.0 secs. It is not up-to-date because:
  Task has failed previously.
All input files are considered out-of-date for incremental task ':react-native-razorpay:verifyReleaseResources'.
Unable do incremental execution: full task run
QueuedCruncher is using /Users/clove/Library/Android/sdk/build-tools/27.0.3/aapt

Shutdown finished in 0ms

:react-native-razorpay:verifyReleaseResources (Thread[Daemon worker Thread 18,5,main]) completed. Took 0.402 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-razorpay:verifyReleaseResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt

* Try:
Run with --stacktrace option to get the stack trace. Run with --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 1m 16s
102 actionable tasks: 9 executed, 93 up-to-date

【问题讨论】:

    标签: react-native build aapt


    【解决方案1】:

    找到了解决办法。原来问题是由于配置不匹配造成的。我使用的gradle版本在3以上,需要android sdk 25或以上版本。而 react-native-razorpay 附带 sdk 版本 23。所以我更改了 node_modules 中的这些设置,构建成功完成。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-01-18
      • 1970-01-01
      • 2018-08-12
      • 1970-01-01
      • 2016-03-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多