Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAmon Dow III
4,086 PointsI kept getting this error on the last step for Building a Releasse Ready APK
Error:Execution failed for task ':app:proguardRelease'.
proguard.ParseException: Expecting opening '{' at 'Log' in line 18 of file 'C:\Users\Slim Jim\AndroidStudioProjects\FunFacts\app\proguard-rules.pro'
Here is my code
FunFactsActicity Code
package com.example.slimjim.funfacts;
import android.app.Activity; import android.graphics.Color; import android.os.Bundle; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast;
import java.util.Random;
public class FunFactActivity extends Activity { public static final String TAG = FunFactActivity.class.getSimpleName(); private FactBook mFactBook= new FactBook(); private ColorWheel mColorWheel = new ColorWheel();
@Override // used to separate methods
protected void onCreate(Bundle savedInstanceState) { // void is a place holder which let
// let the compiler no you returning nothing
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_fun_fact);
//Declare our View Variables and assign the View label from the layout file
final TextView factLabel = (TextView) findViewById(R.id.factTextView);
final Button showFactButton = (Button) findViewById(R.id.showFactButton);
final RelativeLayout relativeLayout = (RelativeLayout) findViewById(R.id.relativeLayout);
View.OnClickListener listener = new View.OnClickListener() { //listener is the variable for
//on click lister function
@Override // prewritten once a new variable was created for on click variable
public void onClick(View view) {
String fact = mFactBook.getFact();
factLabel.setText(fact);
int color = mColorWheel.getColor();
relativeLayout.setBackgroundColor(color);
showFactButton.setTextColor(color);
}
};// a semicolon had to be added here
showFactButton.setOnClickListener(listener);// you had to add the declare variable here to
//listener inside () to remove function
// Toast.makeText(this,"Yay ! our activity was created", Toast.LENGTH_LONG).show();
Log.d(TAG,"We are logging from the onCreat() method");
/* make toast message long way
String message = "Yay ! our activity was created";
Toast welcomeToast = Toast.makeText(this,message, Toast.LENGTH_LONG);
welcomeToast.show();
*/
}
}
proguard-rules pro code
Add project specific ProGuard rules here.
By default, the flags in this file are appended to flags specified
in C:\android-studio-bundle-windows\android-studio\sdk/tools/proguard/proguard-android.txt
You can edit the include path and order by changing the proguardFiles
directive in build.gradle.
For more details, see
http://developer.android.com/guide/developing/tools/proguard.html
Add any project specific keep options here:
If your project uses WebView with JS, uncomment the following
and specify the fully qualified class name to the JavaScript interface
class:
-keepclassmembers class fqcn.of.javascript.interface.for.webview {
public *;
}
-assumenosideeffects class android.util Log { public static boolean isLoggable(java.lang.String,int); public static int v (...); public static int i (...); public static int w (...); public static int d (...); public static int e (...); }
I don't understand what wrong my code runs fine, but I kept receiving the error above so I cannot generate a sign APK