rake {simulator,device} now shows application logs in the terminal after running the main activity

This commit is contained in:
Laurent Sansonetti
2014-03-12 17:51:02 +01:00
parent 7788b26d7a
commit 515e62b9d8
2 changed files with 9 additions and 1 deletions

View File

@@ -80,7 +80,7 @@ JNI_OnLoad(JavaVM *vm, void *reserved)
return -1;
}
assert(env != NULL);
rb_vm_init("#{App.config.package.gsub('.', '/')}", env);
rb_vm_init("#{App.config.package_path}", env);
EOS
ruby_objs.each do |_, init_func|
payload_c_txt << " #{init_func}(NULL, NULL);\n"
@@ -294,6 +294,10 @@ def run_apk(mode)
line = "\"#{adb_path}\" #{adb_mode_flag(mode)} shell am start -a android.intent.action.MAIN -n #{activity_path}"
line << " > /dev/null" unless Rake.application.options.trace
sh line
# Show log.
sh "\"#{adb_path}\" #{adb_mode_flag(mode)} logcat -c"
sh "\"#{adb_path}\" #{adb_mode_flag(mode)} logcat #{App.config.package_path}:I"
end
end

View File

@@ -55,6 +55,10 @@ module Motion; module Project;
@package ||= 'com.yourcompany' + '.' + name.downcase.gsub(/\s/, '')
end
def package_path
App.config.package.gsub('.', '/')
end
def api_version
@api_version ||= begin
versions = Dir.glob(sdk_path + '/platforms/android-*').map do |path|