error:com.android.ide.common.process.ProcessException: Failed to execute aapt

运行命令打包文件

cd android && gradlew assembleRelease

报如下错误

Execution failed for task ':aliyun-oss-react-native:verifyReleaseResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt

解决办法
我这是个ReactNative项目,引用了两个oss包,后来删了其中一个,但是setting.gradle中没删除记录,删除后,继续运行打包,还是有这个问题。
用AndroidStudio打开该项目中的android项目,Rebuild Project一次,发现,项目中存在不同的buildToolsVersion,不管是不是这个因素,我先把AndroidStudio中涉及到的项目,全部统一版本,再次运行,报了个如下错误

 Error: Duplicate resources

错误提示的是“重复内容”,解决办法如下:
https://github.com/facebook/react-native/issues/22234#issuecomment-437812451
具体如下:
Mapsy’s answer should help https://stackoverflow.com/a/52750886
So basically you edit the /node_modules/react-native/react.gradle file
and add the doLast right after the doFirst block, manually.

doFirst { ... }
doLast {
    def moveFunc = { resSuffix ->
        File originalDir = file("$buildDir/generated/res/react/release/drawable-${resSuffix}");
        if (originalDir.exists()) {
            File destDir = file("$buildDir/../src/main/res/drawable-${resSuffix}");
            ant.move(file: originalDir, tofile: destDir);
        }
    }
    moveFunc.curry("ldpi").call()
    moveFunc.curry("mdpi").call()
    moveFunc.curry("hdpi").call()
    moveFunc.curry("xhdpi").call()
    moveFunc.curry("xxhdpi").call()
    moveFunc.curry("xxxhdpi").call()
}

意思讲的很清楚了。
按照上面意思来一遍,clean Project一次之后,再运行打包命令,之后,又有新问题了,真是打包路漫漫

warning: the transform cache was reset.
Loading dependency graph, done.
FATAL ERROR: NewSpace::Rebalance Allocation failed - process out of memory
 1: 00007FF7D71CBAED
 2: 00007FF7D781EC35
 3: 00007FF7D781EB88
 4: 00007FF7D7888B5D
 5: 00007FF7D7709900
 6: 00007FF7D7708D2B
 7: 00007FF7D7707C31
 8: 00007FF7D7420145
 9: 00007FF7D75E8784
10: 00007FF7D78B318A
11: 000002D53D5843C1


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:bundleReleaseJsAndAssets'.
> Process 'command 'cmd'' finished with non-zero exit value 3

process out of memory : 内存不足
我很奇怪,为什么会内存不足
运行命令:

node --max-old-space-size=4096 app

运行一遍命令,mmp,终于打包出来了,打开文件夹:android\app\build\outputs\apk\release
发现里面有一个release的apk,但很奇怪,带了后缀 -unsigned,不用安装,肯定是证书出问题了,安装不了。
不过这个问题也好解决,重新弄一个证书吧
很遗憾,打包没成功,换了证书不行,官方文档,一遍遍的对,还是不行。
最后我的解决办法是,使用AndroidStudio打包,成功。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值