icyleaf / app-info

Teardown parser tool for mac, windows and mobile app (ipa, apk and aab file) and dSYM.zip file, analysis metedata like version, name, icon etc.
MIT License
51 stars 8 forks source link

/var/lib/gems/2.7.0/gems/app-info-2.5.4/lib/app_info.rb:30:in `parse': app_info.txt (AppInfo::NotFoundError) #33

Closed DreamPWJ closed 2 years ago

DreamPWJ commented 2 years ago

sudo gem install app-info

终端执行 ruby app_info.rb

require 'app-info'

Description: 获取APP包信息

puts ARGV.to_s

Automatic detect file extsion and parse

apk = AppInfo.parse(ARGV[1])

属性文档: https://github.com/icyleaf/app_info/tree/master/spec/app_info

app_name = apk.name app_version = apk.release_version app_build_version = apk.build_version app_size = apk.size(true) app_identifier = apk.bundle_id app_os = apk.os

app_info = "#{app_name},#{app_version},#{app_size},#{app_build_version},#{app_identifier},#{app_os}"

Fastlane与Jenkins数据通信 使用存到文件再读取文件的方式

File.write(ARGV[2], "#{app_info}")

icyleaf commented 2 years ago

你的 ARGV[1] 是啥,感觉没有正确传参

DreamPWJ commented 2 years ago

你的 ARGV[1] 是啥,感觉没有正确传参

是动态参数 如 执行命令 ruby app_info.ruby android.apk , 这几个参数都打印出来了,传入的应该是对的,除非有字符啥的问题

icyleaf commented 2 years ago

那为什么报错提示是 app_info.txt 文件而不是你传的 android.apk?

icyleaf commented 2 years ago

如果文件路径没有问题但不支持文件类型会报 Sorry, AppInfo can not detect file type: /path/to/file (AppInfo::UnkownFileTypeError)

DreamPWJ commented 2 years ago

我错了,数组下标写错了,现在好了,感谢贡献工具库,最早用fastlane那个插件,发现还有各种不适合,现在改用ruby这个库了

icyleaf commented 2 years ago

app-info fastlane 插件仅仅是可视化常用元数据和数据使用,不太适合定制化比较多的场景,当然如果你想详细展开下我也会思考下是否有必要做扩展 😄

DreamPWJ commented 2 years ago

@icyleaf 我现在有个需求是不跟进apk或ipa包获取版本号,而是根据代码,能否实现?

DreamPWJ commented 2 years ago

ios通过fastlane官方插件可以,android是否可以通过代码实现?

icyleaf commented 2 years ago

android 不太好弄因为 gradle 支持多语言且也没有 DSL 暴露,除非是和开发者约束好在做特定的文件解析,但如果是通过类似 https://github.com/icyleaf/fastlane-plugin-humanable_build_number 传递动态参数就无解了

DreamPWJ commented 2 years ago

感谢 感谢 android暂时放弃了,因为需求不大,主要是ios上架的时候必须高于线上版本,所以想做版本对比