mirah / pindah

Tools for building Android applications with Mirah
Apache License 2.0
228 stars 27 forks source link

`rake install` doesn't work #38

Closed artagnon closed 11 years ago

artagnon commented 11 years ago
$ rake install bin/chwall2-debug.apk

install:
Install file not specified.

'ant install' now requires the build target to be specified as well.

    ant debug install
    ant release install
    ant instrument install
This will build the given package and install it.

Alternatively, you can use
    ant installd
    ant installr
    ant installi
    ant installt
to only install an existing package (this will not rebuild the package.)
/home/artagnon/.rbenv/versions/jruby-1.7.2/lib/ruby/gems/shared/gems/rake-10.0.2/lib/rake/task.rb:176 warning: singleton on non-persistent Java type Java::OrgApacheToolsAnt::BuildException (http://wiki.jruby.org/Persistence)
rake aborted!
The following error occurred while executing this line:
/home/artagnon/.android/sdk/tools/ant/build.xml:1420: No message

Why is this so complicated? Isn't an adb install -r <file> all you need to do?

abscondment commented 11 years ago

It's complicated because the take tasks map directly to the ant tasks, and the ant tasks changed to behave this way. You need to:

rake debug install

In order to actually build+install.

If all you want is to install an existing apk, then sure, use adb.

Not sure why the ant build works this way now, but it does. Perhaps it's because the install target is ambiguous if you've built multiple files - i.e. debug & release both exist. On Feb 6, 2013 5:56 AM, "Ramkumar Ramachandra" notifications@github.com wrote:

$ rake install bin/chwall2-debug.apk

install: Install file not specified.

'ant install' now requires the build target to be specified as well.

ant debug install
ant release install
ant instrument install

This will build the given package and install it.

Alternatively, you can use ant installd ant installr ant installi ant installt to only install an existing package (this will not rebuild the package.) /home/artagnon/.rbenv/versions/jruby-1.7.2/lib/ruby/gems/shared/gems/rake-10.0.2/lib/rake/task.rb:176 warning: singleton on non-persistent Java type Java::OrgApacheToolsAnt::BuildException (http://wiki.jruby.org/Persistence) rake aborted! The following error occurred while executing this line: /home/artagnon/.android/sdk/tools/ant/build.xml:1420: No message

Why is this so complicated? Isn't an adb install -r all you need to do?

— Reply to this email directly or view it on GitHubhttps://github.com/mirah/pindah/issues/38.

artagnon commented 11 years ago

Fix the rake -T output then:

rake clean             # Removes output files created by other targets.
rake debug             # Builds the application and signs it with a debug key.
rake install           # Installs the newly build package.
rake javac             # Compiles R.java and other gen/ files.
rake logcat            # Tail logs from a device or a device or emulator
rake release           # Builds the application in release mode.
rake release_unsigned  # Builds the application in release mode.
rake spec              # Print the project spec
rake uninstall         # Uninstalls the application from a running emulator or device.

Clearly misleading.

Besides, rake logcat persumably executes adb logcat after spewing some errors and making a fuss. Is there really no way to simplify it?

abscondment commented 11 years ago

I agree that this is confusing. We're pulling these descriptions from the ant tasks, but they appear to be truncated when compared to what ant tells us. E.g.

 [echo]    install:   Installs the newly build package. Must either be

used [echo] in conjunction with a build target (debug/release/ [echo] instrument) or with the proper suffix indicating [echo] which package to install (see below). [echo] If the application was previously installed, the [echo] application is reinstalled if the signature matches.

We pull it in here: https://github.com/mirah/pindah/blob/e4ace16d66995ab3441e24f3724ec54d024b03b4/lib/pindah.rb#L125

This may mean that the 'description' property we use is an incomplete one, or that Rake is trimming the huge paragraph that the Android project supplies. We should figure out how to get the full text.

On Wed, Feb 6, 2013 at 6:15 AM, Ramkumar Ramachandra < notifications@github.com> wrote:

Fix the rake -T output then:

rake clean # Removes output files created by other targets. rake debug # Builds the application and signs it with a debug key. rake install # Installs the newly build package. rake javac # Compiles R.java and other gen/ files. rake clean # Removes output files created by other targets. rake debug # Builds the application and signs it with a debug key. rake install # Installs the newly build package. rake javac # Compiles R.java and other gen/ files. rake logcat # Tail logs from a device or a device or emulator rake release # Builds the application in release mode. rake release_unsigned # Builds the application in release mode. rake spec # Print the project spec rake uninstall # Uninstalls the application from a running emulator or device.

rake logcat # Tail logs from a device or a device or emulator rake release # Builds the application in release mode. rake release_unsigned # Builds the application in release mode. rake spec # Print the project spec rake uninstall # Uninstalls the application from a running emulator or device.

Clearly misleading.

Besides, rake logcat persumably executes adb logcat after spewing some errors and making a fuss. Is there really no way to simplify it?

— Reply to this email directly or view it on GitHubhttps://github.com/mirah/pindah/issues/38#issuecomment-13183457.

abscondment commented 11 years ago

There are two intertwined issues here:

  1. rake -T behavior is surprising
  2. Android's ant tasks are confusing and complex, and some were missing.

The first issue is that rake -T actually truncates long lines. This is (apparently) a well-known rake "feature" -- was news to me! So any Rakefile with long descriptions is actually getting clipped by our use of rake -T. Instead of rake -T, one needs to use rake -D will display the full text. Fixing this is outside of the scope of Pindah :(

The second problem is that Android's install task underspecifies the target package -- it actually requires you to build simultaneously, or explicitly use installd, installr, etc. Pindah formerly did not expose these target-specific tasks. Now we do, yay!

So to summarize: