The problem is not with the "bat" file, it's with proguard itself. I
checked the Bat file, and it just passes what it gets.
ADT could easily have bypassed this problem by passing it the short
name version of all files passe , including in the ".pro" file.
In the meantime, I created my own script, that converts all scripts,
and allows the export functionality to work fine from within eclipse,
even when there are spaces in the file path (but not in the file
name).
You will have to have Perl installed, with the Win32 module (included
in ActiveState).

The following is the perl script;

#!/usr/bin/perl

# File Name: LaunchProguardShortNames.pl
# Created by: Lionscribe 2011
# License: Public, use completely at own risk.

use strict;
use Win32;

my $fileName;
my $i;
my @lines;
my $line;

my $argc = @ARGV;
if ($argc < 1)
{
        print "\nUsage: perl LaunchProguardShortNames.pl <Executible.exe>
[Args]\n";
        exit;
}

for ($i = 0; $i<$argc; $i++)
{
        $ARGV[$i] = FixFileNameString($ARGV[$i]);
        if ($ARGV[$i] =~ /(.*?)(\D:\\.*pro\b)(.*)/)     #it's a pro file
        {
                $fileName = $2;
                open(FILE, $fileName) or die("Unable to open file '$fileName'");

                # read file into an array
                @lines = <FILE>;
                # close file
                close(FILE);

                open(FILE, ">$fileName") or die("Unable to open file 
'$fileName' for
output");
                my $oldh = select(FILE);        #We select it so that we can 
disable
buffering
                $| = 1;
                foreach $line (@lines)
                {
                        print FixFileNameString($line);
                        print "\n";
                }
                close(FILE);
                select ($oldh);
        }
}
system @ARGV;


sub FixFileNameString
{
        my $str;
        my $shortName;

        $str = $_[0];
        $str =~ /(.*?)(\D:\\.*\\)(.*)/;

        if (defined($1))
        {
                $shortName =  Win32::GetShortPathName($2);
                if (!defined($shortName))
                {
                        $shortName = $2;
                }
                $str = "$1$shortName$3";
        }
        return $str;;
}

# End File: LaunchProguardShortNames.pl

save this file in the android-sdk folder in the subfolder "tools
\proguard\bin" as "LaunchProguardShortNames.pl"
Then edit in the above folder the file called proguard.bat, change the
last line that reads:
call %java_exe% -jar "%PROGUARD_HOME%"\lib\proguard.jar %1 %2 %3 %4 %5
%6 %7 %8 %9
change it to:
call perl LaunchProguardShortNames.pl %java_exe% -jar "%PROGUARD_HOME
%"\lib\proguard.jar %1 %2 %3 %4 %5 %6 %7 %8 %9

and viola, export should work from eclipse.
Enjoy,
Lionscribe



On Dec 6 2010, 11:40 pm, Xavier Ducrohet <x...@android.com> wrote:
> Michael,
>
> We're fixing ADT to properly report what the problem really is but we
> just noticed the .bat thatproguardships with doesn't support path
> with spaces.
> We'll provide our own .bat for the next tools release but in the mean
> time you may want to check this.
>
> Xav
>
>
>
>
>
> On Mon, Dec 6, 2010 at 3:37 PM, Michael A. <michael.aki...@gmail.com> wrote:
> > I'm getting an error when trying to export usingProguard:
>
> > !MESSAGE Failed to export application
> > !STACK 0
> > com.android.ide.eclipse.adt.internal.build.ProguardResultException
> >        at
> > com.android.ide.eclipse.adt.internal.build.BuildHelper.runProguard(Unknown
> > Source)
> >        at
> > com.android.ide.eclipse.adt.internal.project.ExportHelper.exportReleaseApk(­Unknown
> > Source)
> >        at
> > com.android.ide.eclipse.adt.internal.wizards.export.ExportWizard.doExport(U­nknown
> > Source)
> >        at
> > com.android.ide.eclipse.adt.internal.wizards.export.ExportWizard.access
> > $0(Unknown Source)
> >        at com.android.ide.eclipse.adt.internal.wizards.export.ExportWizard
> > $1.run(Unknown Source)
> >        at org.eclipse.jface.operation.ModalContext
> > $ModalContextThread.run(ModalContext.java:121)
>
> > This is a brand new, clean project in Eclipse Helios (Win7) with - as
> > far as I know - the latest plugin and SDK. I'm guessing that there's
> > something in my Eclipse/Windows environment that needs to be set up.
> > Any tips?
>
> > Regards,
>
> > Michael A.
>
> > On Dec 7, 12:18 am, "Michael A." <michael.aki...@gmail.com> wrote:
> >> Thanks. I found it shortly after posting this (incidentally, the link
> >> in the Android market points to the wrong page).
>
> >> Great stuff. I love the many small things like these in 2.3 that help
> >> makes the lives of the developers easier. :-)
>
> >> Regards,
>
> >> Michael A.
>
> >> On Dec 7, 12:07 am, Xavier Ducrohet <x...@android.com> wrote:
>
> >> > Doc about the integration is 
> >> > there:http://developer.android.com/guide/developing/tools/proguard.html
>
> >> > In a nutshell:
> >> > - it's packaged with the SDK
> >> > - all you have to do is create aproguardconfig file somewhere and
> >> > specify its location in default.properties.
> >> > - Whenever you do a release build (ant release or export
> >> > signed/unsigned package from Eclipse) it'll runproguardon your code.
>
> >> > more 
> >> > info:http://developer.android.com/guide/developing/tools/proguard.html
>
> >> > On Mon, Dec 6, 2010 at 3:01 PM, Michael A. <michael.aki...@gmail.com> 
> >> > wrote:
> >> > > Hi,
>
> >> > > The release notes for the new ADT/SDK mentions integratedProGuard
> >> > > support, which I find very interesting, as I've been holding off on
> >> > > the latest release partly for this feature.
>
> >> > > Unfortunately, it does not appear that easy. There are not any obvious
> >> > > interface changes that I have been able to find, and a search of the
> >> > > website does not turn up any documentation (at this moment). Has
> >> > > anyone been able to find the documentation for this or been able to
> >> > > figure out in what wayProGuardhas been "integrated"?
>
> >> > > Regards,
>
> >> > > Michael A.
>
> >> > > --
> >> > > You received this message because you are subscribed to the Google
> >> > > Groups "Android Developers" group.
> >> > > To post to this group, send email to 
> >> > > android-developers@googlegroups.com
> >> > > To unsubscribe from this group, send email to
> >> > > android-developers+unsubscr...@googlegroups.com
> >> > > For more options, visit this group at
> >> > >http://groups.google.com/group/android-developers?hl=en
>
> >> > --
> >> > Xavier Ducrohet
> >> > Android SDK Tech Lead
> >> > Google Inc.
>
> >> > Please do not send me questions directly. Thanks!
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> Xavier Ducrohet
> Android SDK Tech Lead
> Google Inc.
>
> Please do not send me questions directly. Thanks!- Hide quoted text -
>
> - Show quoted text -

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to