Autoincrement VersionCode with gradle extra properties

I would like to read the versionCode from an external file I am sure that there are any number of possible solutions; here is one: android { compileSdkVersion 18 buildToolsVersion “18.1.0” def versionPropsFile = file(‘version.properties’) if (versionPropsFile.canRead()) { def Properties versionProps = new Properties() versionProps.load(new FileInputStream(versionPropsFile)) def code = versionProps[‘VERSION_CODE’].toInteger() + 1 versionProps[‘VERSION_CODE’]=code.toString() versionProps.store(versionPropsFile.newWriter(), null) … Read more

finished with non zero exit value

I was getting this exact same error. I ran the command ./gradlew assembleDebug –info Where “assembleDebug” was replaced with the assemble task for a debug version of the flavor I wanted. Look for output Successfully started process ‘command ‘/usr/local/opt/android-sdk/build-tools/21.1.2/aapt” Right below that was an error describing a resource which I used in a layout file … Read more

android studio 0.4.2: Gradle project sync failed error

I’m assuming I can answer my own question…. This worked for me. File -> Invalidate caches / Restart Shutdown Android Studio Rename/remove .gradle folder in the user home directory Restart Android Studio let it download all the Gradle stuff it needs Gradle build success ! Rebuild project…. success ! Out of curiousity I compared the … Read more

How can I access a BuildConfig value in my AndroidManifest.xml file?

Replace buildConfigField “long”, “FACEBOOK_APP_ID”, FACEBOOK_APP_ID with resValue “string”, “FACEBOOK_APP_ID”, FACEBOOK_APP_ID then rebuild your project (Android Studio -> Build -> Rebuild Project). The two commands both produce generated values – consisting of Java constants in the first case, and Android resources in the second – during project builds, but the second method will generate a string … Read more

How to change app name per Gradle build type

If by “app name”, you mean android:label on <application>, the simplest solution is to have that point at a string resource (e.g., android:label=”@string/app_name”), then have a different version of that string resource in a src/debug/ sourceset. You can see that in this sample project, where I have a replacement for app_name in src/debug/res/values/strings.xml, which will … Read more

Build Android Studio app via command line

Android Studio automatically creates a Gradle wrapper in the root of your project, which is how it invokes Gradle. The wrapper is basically a script that calls through to the actual Gradle binary and allows you to keep Gradle up to date, which makes using version control easier. To run a Gradle command, you can … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)