我正在开发适用于Android的RubyMotion应用。我想为它添加一个图标。 The documentation说:
中存在的图标文件的基名(不带扩展名)
icon
:项目图标名称,作为字符串。该值必须是可绘制资源目录
我把这行放在我的Rakefile中:
Motion::Project::App.setup do |app|
...
app.icon = 'icon'
我已尝试过几个地方放置图标文件,但无法让它正常工作:
将图标放在resources/icon.png
中会出现此错误:
» rake device
Create ./build/Development-23/AndroidManifest.xml
invalid resource directory name: ./resources icon.png
rake aborted!
Command failed with status (1): ["/Users/me/.rubymotion-android/sd...]
/Library/RubyMotion/lib/motion/project/template/android.rb:188:in `block in <top (required)>'
/Library/RubyMotion/lib/motion/project/template/android.rb:786:in `block (2 levels) in <top (required)>'
/Library/RubyMotion/lib/motion/project/template/android.rb:786:in `each'
/Library/RubyMotion/lib/motion/project/template/android.rb:786:in `block in <top (required)>'
/Users/me/.rvm/gems/ruby-2.2.2@rm-android/bin/ruby_executable_hooks:15:in `eval'
/Users/me/.rvm/gems/ruby-2.2.2@rm-android/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => build
(See full trace by running task with --trace)
将图标放在resources/@drawable/icon.png
中会出现同样的错误,invalid resource directory name: ./resources @drawable
。将图标放在项目的根目录中会产生同样的错误。
我在哪里放置我的图标?
答案 0 :(得分:0)
试一试......
创建名为 icon.png 的180x180 PNG文件,并将其保存在资源文件夹中。
现在将以下内容添加到您的rakefile:
Motion::Project::App.setup do |app|
app.icons = ['icon.png']
app.prerendered_icon = true