Kurt Wagner
Kurt Wagner

Reputation: 3315

ProguardTokenType.CRLF, ProguardTokenType.FLAG_ARG, ProguardTokenType.LINE_CMT or ProguardTokenType.OPEN_BRACE expected, unexpected end of file

I imported a AWS module in Android Studio 0.8.2, did some work on it, and now want to make a commit to my branch. On the module root I right clicked, Git>Add then when I clicked the 'Commit Changes' button, gradle did some magic and then complained with following error about the following code:

Error:(27, 53) ProguardTokenType.CRLF, ProguardTokenType.FLAG_ARG, ProguardTokenType.LINE_CMT or ProguardTokenType.OPEN_BRACE expected, unexpected end of file

Code:

# These options are the minimal options for a functioning application
# using Proguard and the AWS SDK for Android

-keep class org.apache.commons.logging.**               { *; }
-keep class com.amazonaws.services.sqs.QueueUrlHandler  { *; }
-keep class com.amazonaws.javax.xml.transform.sax.*     { public *; }
-keep class com.amazonaws.javax.xml.stream.**           { *; }
-keep class com.amazonaws.services.**.model.*Exception* { *; }
-keep class com.amazonaws.internal.**                   { *; }
-keep class org.codehaus.**                             { *; }
-keep class org.joda.time.tz.Provider                    { *; }
-keep class org.joda.time.tz.NameProvider                { *; }
-keepattributes Signature,*Annotation*,EnclosingMethod
-keepnames class com.fasterxml.jackson.** { *; }
-keepnames class com.amazonaws.** { *; }

-dontwarn com.fasterxml.jackson.databind.**
-dontwarn javax.xml.stream.events.**
-dontwarn org.codehaus.jackson.**
-dontwarn org.apache.commons.logging.impl.**
-dontwarn org.apache.http.conn.scheme.**
-dontwarn org.apache.http.annotation.**
-dontwarn org.ietf.jgss.**
-dontwarn org.joda.convert.**
-dontwarn org.w3c.dom.bootstrap.**

-dontnote com.amazonaws.services.sqs.QueueUrlHandler

I'm not familiar with ProguardProperty file syntax, but have tried adding stuff like { *; } to the last line (where it's underlined red), but the issue remains the same. This error strangely only cropped up when I did Git add and not when running the Android code it's connected to

https://github.com/awslabs/aws-sdk-android-samples/blob/9c4c37ccfb759415aa094928008742c810141c00/DynamoDBMapper_UserPreference_Cognito/proguard-project.txt

Upvotes: 1

Views: 1000

Answers (2)

DDSports
DDSports

Reputation: 400

Something else I've found that might help someone:

I got this same error and it turned out to be that AS (2.1.2) couldn't handle the opening brace being on the next line, so this doesn't work...

-keepclassmembers class * extends android.app.Activity
{
   public void *(android.view.View);
}

.. but this does ...

-keepclassmembers class * extends android.app.Activity{
   public void *(android.view.View);
}

I have no idea why this is, or why it's suddenly appeared for no reason, but it might help somone.

Upvotes: 1

Kurt Wagner
Kurt Wagner

Reputation: 3315

It's a bug in Android Studio that will be fixed in the 0.8.3 release. https://android-review.googlesource.com/#/c/96030/

Upvotes: 0

Related Questions