BuglyDevTeam / Bugly-Android-Demo

Bugly Android SDK 使用例子
Apache License 2.0
810 stars 312 forks source link

Mac M1 打patch包 无法编译 #358

Open helixs opened 2 years ago

helixs commented 2 years ago

设备:MacBookPro M1芯片 执行:buildTinkerPatchRelease 错误:

304 actionable tasks: 20 executed, 284 up-to-date
Execution failed for task ':app:tinkerPatchRelease'.
> Could not resolve all files for configuration ':app:sevenZipToolsLocator'.
   > Could not find SevenZip-1.1.10-osx-aarch_64.exe (com.tencent.mm:SevenZip:1.1.10).
     Searched in the following locations:
         https://jcenter.bintray.com/com/tencent/mm/SevenZip/1.1.10/SevenZip-1.1.10-osx-aarch_64.exe

问题1:我在tinker-support.gradle 下面的tinkerPatch 配置了

sevenZip {
        zipArtifact = "com.tencent.mm:SevenZip:1.2.17" 
     // path = "/usr/local/bin/7za"
}

为什么还会到仓库拉取1.1.10的版本,就算把整个zipArtifact注释掉,还是没用,配置不会有效果。请问该如何配置版本。

问题2:maven仓库下面没有提供osx-aarch_64的版本,有什么办法可以解决吗?

helixs commented 2 years ago

我找到了解决办法其中一种解决办法,动态判断是否是aarch64,因为打包机器是x86的,而我开发的电脑是m1,通过homebrew安装了7zip,直接命令是7zz,有点是7za,看情况吧。

sevenZip {
        zipArtifact = "com.tencent.mm:SevenZip:1.2.17"
        path=isAarch64()?"/opt/homebrew/bin/7zz":null
    }
def isAarch64(){
    String arch = System.getProperty("os.arch")
    println("系统aarch:"+arch)
    return  arch.equalsIgnoreCase("aarch64")
}

另外很多情况下会遇到meta-data 不能插入到AndroidManifest文件中,出错几率很高,百思不得其解, can't find TINKER_ID from the (new/old)apk manifest file, it must be set!

为啥什么文档都不更新

借鉴自这里