Android Studio & Gradle: Cannot run gradlew. Permission denied.

If you are getting the “permission denied” error message while trying to run ./gradlew clean or ./gradlew build manually in your project: -bash: ./gradlew: Permission denied</div> You have to make the gradlew file executable. Open a terminal, navigate to the folder where your gradlew file is, and set execute permissions: chmod +x gradlew  It is also a good idea to close the project in Android Studio while working with the gradle wrapper from the terminal.

» Read more

Where to place the assets folder in Android Studio

If you are having problems with asset files not being included in your compiled apk file, it may be because your assets folder is placed in the wrong directory. The assets folder should usually be inside the following folder: <project>/src/main/. That is the default, but make sure to check the asset folder configuration setting in your projects .iml file, to be sure which folder it really is: <option name=”ASSETS_FOLDER_RELATIVE_PATH” value=”/src/

» Read more

A decent .gitignore file for Android Studio projects

This is a short post, with a decent .gitignore setup for Android Studio projects. I constantly find myself in need of one, so I thought I’d just post it here. Is this similar to your .gitignore files for Android Studio projects? .DS_Store # built application files *.apk *.ap_ # files for the dex VM *.dex # Java class files *.class # generated files bin/ gen/ # Local configuration file (sdk path, etc) local.properties # Eclipse project files .classpath .project # Android Studio .idea/ .gradle

» Read more

A web and mobile developers switch from Windows to OS X

I have been using Windows since win 95, I have some experience with Linux on servers, and a little bit on desktop. I am switching over from a quite powerful stationary htpc computer with Intel i5 3570K, to a Mac… This is the first time I am using a Mac as a daily driver. After using a late 2013 MacBook Pro 13″ “retina” for about 30 days, this is my little review, coming from a web and mobile developers perspective.

» Read more

How to cut off too long lines of text in Lists with ellipsize

If you are using lists in your app, and some of the list items have too long text, making it wrap to several lines like item number three in the following image, then this trick will show you how to create better looking lists. Before, Text wrapping to two lines: Your custom list item xml layout file may look like this: <?xml version="1.0" encoding="utf-8"?> <TextView xmlns:android="http://schemas.android.com/apk/res/android"

» Read more

How to initialize default preferences for Settings in Android

If you are using Androids settings menu to provide your users with settings, you can set default values when the application is first started. The details are explained in further details in the “Defaults” section in the documentation. However, the short version is this: In your preferences.xml file, where you specify your different setting items, use the android:defaultValue attribute to specify the settings default value. <!-- default value is a boolean --> <CheckBoxPreference android:defaultValue=

» Read more

Ambient Temperature Galaxy S4 app Updated, and available in Donate version

Please use the original post for comments and feedback instead of this post. The Ambient Temperature app for Galaxy S4 phones has just been updated with bugfixes and more sensor data. I have received a lot of feedback, in comments, emails and Google Play, and I have listened to many of the wishes. Donate app version I also released a “Donate” version of the temperature app, which you may get to support the development. It uses a different purple icon,

» Read more

How to notify your Fragment of different user navigation events

If you are using Android Fragments in your app, it can sometimes be useful to know when a user is navigation away from your fragment, so that you can act upon the users action, either by saving away data, asking the user for a confirmation, or what else. Here I will describe three methods of registering navigation events. Telling the Fragment that the back button has been pressed, through a reference to your fragment If you would like to know

» Read more

Admob for Android gives error on AdActivity android:configChanges

After experimenting with Admob for Android, I came across an error with the example code that can be downloaded from the developer site about advertising. The error Eclipse gave me, was: You must have AdActivity declared in AndroidManifest.xml with configChanges. and that android:configChanges had to include screenLayout, uiMode, screenSize and smallestScreenSize. After modifying the AdActivity tag in the Manifest file, from: <activity android:name="com.google.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation" /> to including the

» Read more

An update on the BF2Stats Android app for Battlefield 2 players

My app called BF2Stats, was first released in October 2010. This was my first app to be released into the Google Play store, and it was created purely for educational purpose. BF2Stats has now, as of April 2013, reached a total of over 31 000 installs! As I mentioned in this post a while ago, I managed to loose my encrytion key for the BF2Stats app. I therefore created a new app, with a similar name, called BF2Stats2. This new

» Read more