FAQ Database Discussion Community


Build library jar with Gradle

android,gradle,sdk,android-gradle
I'm developing a library on Android Studio (a SDK, let's say module A). To test it out, I also got a demoApp I also have another lib with the SDK dependencies (a plugin, let's say module B) So in my project, there are 3 modules : the SDK (A), the...

Define buildconfigfield for an specific flavor AND buildType

android,gradle,android-gradle,build-tools
I have 2 flavors, lets say Vanilla and Chocolate. I also have Debug and Release build types, and I need Vanilla Release to have a field true, while the other 3 combinations should be false. def BOOLEAN = "boolean" def VARIABLE = "VARIABLE" def TRUE = "true" def FALSE =...

java.lang.NoClassDefFoundError on android studio

java,android,gradle,android-gradle,noclassdeffounderror
I noticed that in some phones after I gave people an update to my app it crashes on launch. On phones that did not have the app before it works just fine. This is the crash log: 06-05 14:52:13.006 30819-30819/? I/SELinux﹕ Function: selinux_android_load_priority [0], There is no sepolicy file. 06-05...

Android build project error trying to build apps > 65K (65536) methods

android,android-studio,gradle,build,android-gradle
I have added these two new dependencies in my build.gradle compile 'com.android.support:appcompat-v7:22.2.0' compile 'com.android.support:design:22.2.0' And right now, I can't build my project because I've got an error. I have found information about the error and the solution that I have found says that I have to add ... compile 'com.parse.bolts:bolts-android:1.+'...

Android Studio with AndroidAnnotations NoClassDefFoundError

java,android,android-studio,android-gradle,android-annotations
I have an app with Android annotations that is giving me a NoClassDefFoundError when I try to run it. java.lang.NoClassDefFoundError: br.socialcondo.app.rest.services.UserService_ In the annotations log I can see that this class is generated: Note: Generating class: br.socialcondo.app.rest.services.UserService_ What I am doing wrong here? EDIT Sharing build.gradle buildscript { repositories {...

Android: Managing different server Url for development and release

android,android-gradle
I am developing an Android application that interacts with server via REST APIs. Obviously I need to use different URL for development and release builds. Commenting and un-commenting code is very tedious and error pron. Which is the best way to handle this situation? Using different build types in gradle...

Travis CI for Android - Build Error: Failed to find target & Could not find dependencies

android,android-gradle,travis-ci
I am trying to set up Travis CI for my existing Android project. I've added the .travis.yml: language: android android: components: - build-tools-21.1.2 - android-22 - extra-google-google_play_services But it always fails in Travis CI with the following error: FAILURE: Build failed with an exception. * What went wrong: A problem...

Changed build.gradle now can't install app delete faild internal error

java,android,gradle,android-gradle,build.gradle
I changed my gradles compileSdkVersion from 21 to 22 and forgot about it, a day later I plugged my phone in and wanted to debug my app, after trying to install once i get this message: Installation failed since the device possibly has stale dexed jars that don't match the...

Findbugs android gradle plugin

android,android-gradle,build.gradle,findbugs,gradlew
I have an android project. I want to introduce findbugs in my project as a gradle plugin. I tried to edit the project's build.gradle as below. buildscript { repositories { mavenCentral() maven { url 'https://maven.fabric.io/public' } } dependencies { classpath 'com.android.tools.build:gradle:1.0.0+' classpath 'io.fabric.tools:gradle:1.+' } } apply plugin: "java" apply plugin:...

Android studio gradle flavor dimensions build varients not working correctly

android-studio,gradle,android-gradle,build.gradle,android-productflavors
I have two dimensions of an app, call then green and blue. There will only be these two dimensions but an unlimited number of product flavors. This is the way I'm setting it up in gradle flavorDimensions "green", "blue" productFlavors { one { applicationId "com.app.green.one" versionCode 1 versionName "1.0.0.1"; flavorDimension...

Build Failure on Android Studio

android,compilation,compiler-errors,android-gradle,build.gradle
After updating all the Google support libraries to the latest versions, from v21 to v22.2.0 and Play Services to v7.5, my project no longer builds successfully. The log i get is as follows: app:preDexDebug AGPBI: {"kind":"simple","text":"Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar ","sources":[{}]} AGPBI: {"kind":"simple","text":"Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar ","sources":[{}]} AGPBI: {"kind":"simple","text":"Picked up JAVA_TOOL_OPTIONS:...

Auto increment versioncode only on releases

android,gradle,android-gradle
Currently I'm trying to improve our buildscript with auto incrementing the versioncode so our QA team has got a clue what build they are testing and can log against a specific versioncode. We have got 3 productFlavors (staging, qa, production) and 2 signing configs (debug, release). I looked into different...

How to declare a constant that is visible to all modules' build.gradle file?

android,gradle,android-gradle
I have a project that has multiple Modules - libraries and applications. Everytime a new version of Android comes out, I need to upgrade the targetSdk, compileSdk, buildToolsVersion, etc. for all the modules. A constant could help with this tedious work! How could I define project-level constant that is visible...

Android studio 1.1.0 setting minifyEnabled true causing issues with app

android,android-studio,android-gradle,proguard,retrofit
Here's my gradle.build file defaultConfig { minSdkVersion 15 targetSdkVersion 21 versionCode 2 versionName "1.0" } buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } Proguard-rules.pro file -keepclassmembers class * extends de.greenrobot.dao.AbstractDao { public static java.lang.String TABLENAME; } -keep class **$Properties -dontwarn com.squareup.** -dontwarn okio.** -dontwarn retrofit.** -dontwarn org.joda.time.**...

Gradle Build Failure

android,android-gradle,release,build.gradle
My project compiles and executes well on debug mode but when i try to generate a signed apk, errors arise. This appears on the message log: :app:proguardRelease Warning:android.support.v4.app.DialogFragment: can't find referenced class android.support.v4.app.DialogFragment$DialogStyle Warning:android.support.v4.app.FragmentTransaction: can't find referenced class android.support.v4.app.FragmentTransaction$Transit Warning:android.support.v4.view.ViewCompat: can't find referenced class...

Android Build with Gradle and ProGuard : “The output jar must be specified after an input jar, or it will be empty”

android,gradle,android-gradle,proguard,android-progaurd
I'm creating a build with different flavors with Gradle. It used to run quite good until now, until I wanted to enable Proguard. I enabled minifyEnabled for my Release Build and now I'm having an exception saying : "Caused by: org.gradle.internal.UncheckedException: java.io.IOException: The output jar [.../app/build/intermediates/multi-dex/dev/release/componentClasses.jar] must be specified after...

Gradle build error with Simpleframework

gradle,dependencies,android-gradle,build.gradle,simple-framework
I upload my library module to jcenter and I use this module with my application project. I try to build my application it returns an error. I searched this issue and This issue is due to be aware of what simpleframework. I have to use this library both My library...

AndroidStudio ExternalSystemException with kotlin 0.12.213

android,android-studio,android-gradle,kotlin
Environment Given I have: Kotlin 0.12.213 dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.google.android.gms:play-services:7.5.0' compile 'com.android.support:appcompat-v7:22.2.0' compile 'com.android.support:support-v4:22.2.0' compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" } buildscript { ext.kotlin_version = '0.12.213' repositories { mavenCentral() } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath...

ProcessException: ExecException: Process 'command ' /Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Content/Home/bin/java

java,android,android-studio,android-gradle,build.gradle
I am getting exception: Error:Execution failed for task ':app:dexDebug'. > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2 after i updated the Google Play services to 7.5.0 as: compile 'com.google.android.gms:play-services:7.5.0' but if i change it back to: compile 'com.google.android.gms:play-services:7.0.0' everything is working fine, i am also facing...

android studio “Gradle project sync failed. Basic functionality (e.g. editing, debugging) will not work properly”

android-studio,gradle,android-gradle
I don't understand the error says Error:Failed to create parent directory 'C:\Program Files\Android\Android Studio\gradle\daemon' when creating directory 'C:\Program Files\Android\Android Studio\gradle\daemon\2.2.1' ...

Android Studio - Failed to resolve: com.android.support libraries

android,android-gradle,android-sdk-manager
I got 2 gradle errors when compiling. Failed to resolve: com.android.support:recyclerview-v7:22.0.1 Failed to resolve: com.android.support:appcompat-v7:22.0.1 I try to install the repositories and it starts to install v14 support libraries and after it finishes and sync's it displays the same error again. Also tried cleaning and rebuilding the project. Android studio...

How to make dependency transitive in Gradle

maven,javamail,android-gradle,build.gradle,gmail-api
I have downloaded javax.mail-api-1.5.3.jar file copied into app/libs folder and then right click , add as library. Then following line appears under dependency compile files('libs/javax.mail-api-1.5.3.jar') I want to make this dependency transitive.Because I have mention javax.mail-api library dependencies in pom.xml file like follows. <dependencies> <dependency> <groupId>javax.mail</groupId> <artifactId>javax.mail-api</artifactId> <version>1.5.3</version> <scope>test</scope>...

How to Import Github non Android Studio Project as library into Android Studio?

android-studio,android-gradle,android-standout
I am trying to import standout library which is a github project as library in my project.What i tried is below: created a folder in my root project directory named 'libs' copied the complete folder 'library' of the Standout project on git into 'libs' renamed the folder 'library' that i...

How to update project using gradle automatically when executing sonar-runner?

android,sonarqube,android-gradle,lint,sonar-runner
I am using: Android Studio 1.2 SonarQube 5.1 ...and I want to force the project build of Android app before passing SonarQube, maybe modifying gradle configuration file. I have added the next lines to build.gradle file: apply plugin: "sonar-runner" sonarRunner { sonarProperties { property "sonar.host.url", "http://localhost:9000" property "sonar.analysis.mode", "incremental" property...

Android studio issue with PNG

android-studio,android-gradle,libpng,aapt
I migrated a project from eclipse to Android Studio. When I try to run the app, the build crashes with the following: AAPT err(102196253): I:\Workspace\AudioRecStudio\app\build\intermediates\exploded-aar\AudioRecStudio\audiorecresources\unspecified\res\drawable-xxhdpi-v4\ic_playback.png: libpng warning: iCCP: Not recognizing known sRGB profile that has been edited AAPT err(892575140):...

Automatically Migrating projects to gradle in Android studio

android,android-studio,android-gradle
I made some apps in the past with android studio, and there was no problems with them. And I could open example projects from many sites, for example: developer.android.com/. Now after an update of android studio, I can't open projects in android studio without migrating them manually, which was done...

How do I go about adding a library to gradle that is on Maven Central?

android,android-gradle
https://github.com/premnirmal/Magnet That is the library I'm trying to add to my project. WHere am I supposed to add <dependency> <groupId>com.premnirmal.magnet</groupId> <artifactId>library</artifactId> <version>1.1.1</version> <type>aar</type> </dependency> ...

Unable to import ActivityChooserModel

android,android-studio,gradle,android-gradle,shareactionprovider
For some reason, I am unable to access the ActivityChooserModel class in my Android activity. I am trying to access it as follows: ActivityChooserModel dataModel = ActivityChooserModel.get(this, ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME); But when I try to build the project I get the following: cannot find symbol class ActivityChooserModel I have attempted using both...

Ignore Gradle Build Failure and continue build script?

android,jenkins,gradle,android-gradle
Managing Android's dependencies with Gradle is done in a weird way. They have to be downloaded differently into a local repo. This is a pain when setting up CI build as there are multiple nodes this could run on. As such I'm using the sdk-manager-plugin to have the Android dependencies...

java.util.zip.ZipException: duplicate entry

android,android-studio,android-gradle,zxing,android-developer-api
I have been battling this error all day in Android Studio. Project was imported from an eclipse solution. I have been trying to implement all fixes that are listed for similar posts, nothing is working. I am an Android beginner. I will be happy to provide any further information. Error:Execution...

Android - gradle.properties windows

android-gradle
I need to put some signing variables into gradle and in mac you can put it in HOME/.gradle/gradle.properties but what about windows?...

Why does Gradle disregard release{} and implement a rule on debug build as well?

android-studio,android-gradle
I am not sure if this happened before, but I think it happened after the recent updates of Android Studio and its Gradle. Namely, I am trying to set the output path of the release APK. So I made a code like this buildTypes { release { minifyEnabled false proguardFiles...

Gradle is stuck on mergeDebugAssets, doesn't even fail

android,android-gradle
I have an Android project, which I run in Android Studio. I have ran this project before, but now I've made some changes (though I don't quite remember what I did), and then when I build it using Gradle, it gets stuck in mergeDebugAssets. I don't even get to see...

How to add Android Studio plugin as dependency in Gradle?

android-studio,gradle,testng,android-gradle,build.gradle
I installed the TestNG plugin through Android Studio. On my filesystem the following files were installed: C:\Program Files\Android\Android Studio\plugins\testng\lib\testng.jar C:\Program Files\Android\Android Studio\plugins\testng\lib\testng-plugin.jar C:\Program Files\Android\Android Studio\plugins\testng\lib\resources_en.jar C:\Program Files\Android\Android Studio\gradle\gradle-2.2.1\lib\plugins\testng-6.3.1.jar I added the the TestNG dependency to the build.gradle of my Module--not "Project": dependencies { compile fileTree(dir:...

Android Studio: BuildConfig.java not getting generated properly

android,android-gradle
In my Android Studio project there are two build configuration with some buildConfigField: buildTypes { def SERVER_URL = "SERVER_URL" def APP_VERSION = "APP_VERSION" debug { buildConfigField "String", SERVER_URL, "http://dev.myserver.com" buildConfigField "String", APP_VERSION, "0.0.1" } release { buildConfigField "String", SERVER_URL, "https://myserver.com" buildConfigField "String", APP_VERSION, "0.0.1" minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' }...

Android build fails over com.android.dex.DexException: Multiple dex files define Landroid/support

java,android,gradle,android-gradle
In Android project were team primarily still uses Eclipse were added some 3rd parties libs, then Android Studio fails to run on device anf when running gradle build there is error: :preDexDebug warning: Ignoring InnerClasses attribute for an anonymous inner class (com.umeng.socialize.bean.a) that doesn't come with an associated EnclosingMethod attribute....

Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE environment variable to

android,android-studio,gradle,android-gradle
today I just imported a sample app from Android SDK as a module in my project (analytics) and suddenly I got this gradle error when I try to sync it: Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE envrinment variable to... This is my...

Generate custom package names for Android apps with Gradle

android,android-gradle
Let's say I would like to have fours apps with package name com.demo_uat, com.demo_prod, com.demo1_prod and com.demo1_uat. To do this, I'm using Gradle and buildTypes/productFlavors mechanism. I tried by doing the following : buildTypes { uat.initWith(buildTypes.debug) uat { applicationIdSuffix "_uat" } prod.initWith(buildTypes.release) prod { applicationIdSuffix "_prod" } } productFlavors {...

Android - Only execute Gradle task on release build variant

android,android-gradle,build.gradle
I am trying to configure my build.gradle file to only execute a gradle task when the release build variant is selected. So far, my task always gets executed, whether it is in my debug or release build types or signing configs. I have tried adding my task inside an applicationsVariants...

What is the best way to find out new version is available for external libraries used in Android Studio project

android,maven,android-studio,android-gradle,jcenter
I am new to Android development. so the external libraries (aka. dependencies) are defined in build.gradle like dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:support-v13:21.0.0' compile 'com.squareup.dagger:dagger:1.2.1' compile 'com.google.code.gson:gson:2.1' compile 'de.greenrobot:eventbus:2.4.0' } Is there an easy way to find out if any of these libraries has got a newer...

Android Studio - Download Gradle 0.12.2?

android,android-gradle
How I can download Gradle 0.12.2 in Android Studio (automatically)? I see this website gradle but I can't find it . I find local path Gradle : C:\Users\Makarem01\.gradle\wrapper\dists\gradle-0.12.2 get me error Gradle location is incorrect. What can I do ? I upload photo of error. When i use from gradle...

Issue building project on Android Studio - support-v4

android,gradle,android-gradle,build.gradle
I'm having trouble running and building apk's on my Android studio Project, I'm searching and searching but can't find any suitable solution for my problem. Gradle console stacktrace: trouble writing output: D:\android-sdk-windows\Shairlook-Def-git\app\build\intermediates\pre-dexed\debug\internal_impl-22.0.0-f0c61aa475a654ffa9a9c544ec7d938bf31cfae2.jar (El sistema no puede encontrar la ruta especificada) FAILED FAILURE: Build failed with an exception. * What went...

Can Powermockito be used with Android Studio 1.2

android,android-studio,mockito,android-gradle,powermock
I am using Android Studio 1.2 and the com.android.tools.build:gradle:1.2.2 plugin. Attempt 1 I include the following in my app/build.gradle: androidTestCompile ('com.google.dexmaker:dexmaker-mockito:1.2') androidTestCompile ('org.powermock:powermock-mockito-release-full:1.6.2') but then the PowerMockito package in not available for import: error: cannot find symbol PowerMockito.mockStatic(DatastoreFactory.class); ^ Attempt 2 I include the following in my app/build.gradle: androidTestCompile ('org.powermock:powermock-api-mockito:1.6.2')...

enable dexoptions based on buildtype android gradle

android,android-gradle
I want to use the incremental dex option but because its still experimental I only want it enabled when doing debug builds. However, I can't find a way to reference the current buildType in the context of the dex options. Something like this, is it possible? android { .... dexOptions{...

Android Gradle fails to build after clean (depends on AAR with native libraries)

android-gradle
I have an Android library project (projA) that depends on another library project (projB). I also have an internal Maven server (Archiva). projA contains these lines: dependencies { maven { url 'http://company.com/internal/repository' } compile 'com.company:projB:[email protected]' ... } projB is an AAR that was built with the Android library plugin, published...

Understanding different variants of declaring a task in Gradle

android-studio,gradle,task,android-gradle,build.gradle
There are two different variants of declaring a task in Gradle. 1. task myTask() {} 2. task task3 << {} To test how they behave, I´ve created a sample android project apply plugin: 'com.android.application' android { compileSdkVersion 22 buildToolsVersion "21.1.2" defaultConfig { applicationId "com.android.gradletest" minSdkVersion 15 targetSdkVersion 22 versionCode 1...

Gradle - Executor singleton not started

android,gradle,android-gradle,gradlew
When doing ./gradlew assembleDebug gradle gives me this error : Build exception Executor singleton not started This was working fine with a project I cloned from github, until I deleted it and cloned a new one....

Can't build project after adding RxJava to dependencies

java,android,android-gradle,rx-java
I've seen hundreds of stackoverflow questions with this exact error, but none of which could help me. I know there's a problem with dependencies, but I can't point a finger to it. My dependencies dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') compile 'com.google.android.gms:play-services:7.3.0' compile 'com.jpardogo.materialtabstrip:library:1.0.9' compile('com.crashlytics.sdk.android:crashlytics:[email protected]') { transitive = true;...

android gradle build set class attribute value

android,android-studio,android-gradle,build.gradle
I want to set attribute values in my Application class from the build.gradle file like for example: MyApplication.URL = "someurl.com" that should be determined per build, I tried : productFlavors { myApp { qualified.package.path.MyApplication.URL = "someurl.com" } } but it failed...

How to download a library dependence on gradle for external use?

cordova,android-studio,gradle,android-gradle,cordova-plugins
I have a project on PhoneGap and I am trying to build a plugin to use a FilePicker library. So, I build one Android Studio Project and I have it working. So, right now, that I know that I know how to do it, I just need to know how...

java.exe finished with non-zero exit value 2 when using Facebook SDK

java,android,gradle,android-gradle,facebook-android-sdk
When I try to compile my app I get a following error Error:Execution failed for task ':app:dexDebug'. > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_60\bin\java.exe'' finished with non-zero exit value 2 If I get rid of Facebook Android SDK it compiles without a problem. My build.gradle: apply plugin: 'com.android.application' android {...

java.exe finished with non-zero exit value 2

android,dependencies,android-gradle
My previous play service version is 6.5.87 and I upgraded to 7.0.0 then Got this error com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdkx.x.x_xx\bin\java.exe'' finished with non-zero exit value 2 compile 'com.google.android.gms:play-services:6.5.87' I have upgraded play service Then....Now my gradle is dependencies { compile project(':com_facebook_android') compile project(':pullToRefreshLib') compile project(':smoothProgressbarLib') compile...

Error:(10, 0) gradle method not found classpath()

android,facebook,gradle,android-gradle,build.gradle
Hello i'm newbie with Android studio , i imported facebook as, and first i got this error Error:(111) Cannot call getBootClasspath() before setTargetInfo() is called. and i followed the right answer here. i.e i changed my depencies from dependencies { compile 'com.android.support:support-v4:[21,22)' compile 'com.parse.bolts:bolts-android:1.1.4' } to dependencies { classpath 'com.android.tools.build:gradle:1.1.3'...

android.applicationVariants.size() always returns 0

gradle,android-gradle
I noticed that application.applicationVariants.size() always returns 0, although I know there are variants, since I can iterate them: android.applicationVariants.all {println it}. Because of that I am also not able to iterate the collection with each. What am I missing here?...

How to Install Google Play Services GMS SDK on CircleCI

android,linux,gradle,android-gradle,circleci
I am using a CircleCI server to build and test and Android application and have trouble installing the Android SDK for Google Play Services (including GMS services) on the server. My circle.yml file is: environment: ANDROID_HOME: /usr/local/android-sdk-linux dependencies: pre: - echo y | sudo /usr/local/android-sdk-linux/tools/android update sdk --no-ui --all --filter...

how to use renderscriptSupportModeEnabled?

android,android-imageview,android-gradle,android-library,renderscript
I'm trying to import this library, but it is missing the ScriptC_blur class, so I did some research and found out that I had to use the renderscriptSupportModeEnabled option to import that, but it is not working at all, I can't import that class what am I missing here? My...

Where to put Gradle 2.2.1 manually

android,android-studio,android-gradle
I am working on an android app on android studio, my app is trying to fetch a zip from this url http://services.gradle.org/distributions/gradle-2.2.1-all.zip but to some unknown reasons it is not able to fetch it, now my question is if I download this zip manually where should I put it to...

Gradle project sync failed. Basic functionality will not work properly

android-studio,android-gradle
I updated to Android Studio 1.2 and now have a two errors. When I first open my project I get this error at the top of the screen. "Gradle project sync failed. Basic functionality will not work properly." In the Messages Gradle Sync I get My gradle files are: //...

Functions are missing from the Application object, when using multidex and Dagger 2

android,android-gradle,dagger-2,multidex,android-multidex
We've been having problems recently with Multidexing, specifically when building for the Dalvik VM using the gradle multidex plugin ('com.android.support:multidex:1.0.0'). It appears as if gradle has difficulty resolving the correct classes which should be included in the main dex file. As a result, we end up with a build process...

Android Studio broke down Error:error: package xxx does not exist, error: cannot find symbol class

android,git,android-studio,android-gradle,android-sdk-tools
Android Studio broke down after merge in git this is the correct path but Android studio thinks otherwise I tried everything, any advice ? the path is valid, on another computer the same repository working ofc i made hard reset git,checkout, i tryed Invalidate caches also sometimes have same like...

Why do some tasks in Gradle not show up as properties?

gradle,android-gradle
I want to make one of the default gradle tasks depend on a custom task (to do some work before the default task kicks in), but the dependsOn construct doesn't seem to work for every task available. For example: apply plugin: 'com.android.application' android { compileSdkVersion 21 buildToolsVersion "21.1.2" defaultConfig {...

:app:dexDebug ExecException finished with non-zero exit value 2

java,android,android-studio,gradle,android-gradle
Could anyone help me out with the following error. When i clean the project is show no error but everytime i try to run i get this message. Error:Execution failed for task ':app:dexDebug'. com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_45\bin\java.exe'' finished with non-zero exit value 2 The application was running with...

Android Support Design gradle error

android,android-gradle,appcompat,android-support-design
This was my build.gradle file: ... dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:22.0.0' compile 'com.android.support:cardview-v7:21.0.+' ... } before I add: compile 'com.android.support:design:22.2.0' Now when I build or rebuild my project (I've synced gradle a few times) I get this errors: .../utils/CustomEditText.java Error:(6, 42) Gradle: error: cannot find symbol...

Why does Android Studio say “Test events were not received”?

unit-testing,android-studio,junit,gradle,android-gradle
I'm trying to unit test in my android application, and this is the simple test tutorial what i'm doing. import static org.junit.Assert.*; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; @RunWith(RobolectricTestRunner.class) public class ServerListManagerTest extends AndroidTestCase{ @Test public void testTrueIsTrue() throws Exception { assertEquals(true, true); } } The directory is like this,...

how to solve this error aapt.exe

android,debugging,android-gradle
Please help me what is error I did everything I could but as before \Project\TEST\app\build\intermediates\res\debug\drawable-xxhdpi\ic_launcher.png: Original is here. The version qualifier may be implied. \Project\TEST\\app\build\intermediates\res\debug\drawable-xxhdpi-v4\ic_launcher.png: error: Duplicate file. I'm try delete ic_launcher.png from intermediates\res\debug\drawable-xxhdpi-v4 and clean and rebuild but as before Error:Execution failed for task ':app:processDebugResources'. com.android.ide.common.process.ProcessException:...

How do I add a dependency to the android gradle task 'test'?

gradle,android-gradle
I've introduced a dependency for my unit tests to a custom task I've written in gradle. In android-gradle v1.2.3 the unit test task is named test. So I assumed you add a dependency with test.dependsOn. Gradle doesn't like that. Error: C:\coding\source\testapp\app\build.gradle Error:(30, 0) Could not find property 'test' on project...

Android Studio : UNEXPECTED TOP-LEVEL EXCEPTION:

java,android,android-studio,android-gradle,build.gradle
How Can I solve this error Error:Execution failed for task ':app:dexDebug'. com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2 App Build.gradle apply plugin: 'com.android.application' android { compileSdkVersion 22 buildToolsVersion "22.0.1" packagingOptions { exclude 'META-INF/DEPENDENCIES' exclude 'META-INF/ASL2.0' exclude 'META-INF/NOTICE' exclude...

Android Studio incorrect package name

android,eclipse,android-studio,android-gradle,packages
I recently changed the package name of my Android application in the Eclipse IDE. Then, I imported it into Android Studio. However, I noticed when running the app that it said Target device: AVD_for_10_1_WXGA_Tablet [emulator-5556] Uploading file local path: C:\Users\User\StudioProjects\AppName\app\build\outputs\apk\app-debug.apk remote path: /data/local/tmp/com.oldpackage.appname Installing com.oldpackage.appname DEVICE SHELL COMMAND: pm install...

BuildConfig Failure error ';' expected

android,android-gradle,buildconfig
I am importing the project: https://github.com/Kennyc1012/OpenImgur and after receiving Imgurs Client ID and API Client Secret, bulding the project is fine, but then attempting to run the app notes the errors: Within the BuildConfig.java file: public final class BuildConfig { public static final boolean DEBUG = Boolean.parseBoolean("true"); public static final...

AAR class library stored in bintray doesn't link to the extended class

android,android-gradle,build.gradle,aar,bintray
I created an Android library made by a class named WordUtils2 which extends the Java class WordUtils. The entire project can be found in github here: https://github.com/dequadelisonz/WordUtils2 I also published the generated aar file into BinTray so to be able to use it through Gradle in other Android projects. The...

Aidl is missing error

android,android-gradle,build.gradle
I want to try out android m preview in my app. I have downloaded the latest build tools and the m platform. I have included this in my build.gradle file (of module app) : compileSdkVersion 'android-MNC' buildToolsVersion '23.0.0 rc2' In the project build.gradle file, I have included this in my...

IDEA - Not detecting changes in build.gradle

intellij-idea,android-studio,gradle,android-gradle
I used to be told and annoyed upon every change I put down on build.gradle or settings.gradle. However, lately after messing some things up on the project structure, I don't have this feature anymore. Any way to turn this back on? I miss it....

Gradle :app:preDexDebug error Android Studio Project

android,android-studio,android-gradle,build.gradle
I'm writing an app with Android platform, In my app im using some external jars, due to some errors connected with version of common codecs in android SDK I had to change one of functions in external jar like here Apache Commons Codec with Android: could not find method and...

Gradle Android Project with Java 8 module

java,android,gradle,java-8,android-gradle
As I've seen in this post, Java 8 is not officially supported by Android right now. So I'm interested if it is possible to build Android module with Java 7 and Java module (as a dependency) with Java 8. As an example, I'm trying to create a Gradle project that...

MultiDex issue - Execution failed for task ':app:dexDebug'

android,google-api,google-calendar,android-gradle,build.gradle
I face a problem while adding a line for Google Calendar API to build.gradle. Here is the error: UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]:65536 at com.android.dx.merge.DexMerger$6.updateIndex(DexMerger.java:502) at com.android.dx.merge.DexMerger$IdMerger.mergeSorted(DexMerger.java:277) at com.android.dx.merge.DexMerger.mergeMethodIds(DexMerger.java:491) at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:168) at...

What is the default for minifyEnabled for buildType not explicitly scripted?

android-studio,gradle,android-gradle,proguard,minify
I imported several eclipse projects to Android Studio (v1.1). In the original Eclipse environment, they use Proguard for release mode. In the Android Studio environment, this was translated to the following in the build.gradle script (by the import, not by me): buildTypes { release { minifyEnabled true proguardFiles 'proguard.cfg' }...

How to compile JAR for the SuperSLiM library?

android,xamarin,android-gradle,build.gradle,superslim
I'm an android newbie, and would like to create a jar file for this library: https://github.com/TonicArtos/SuperSLiM I've read some other online answers which say that the gradle build file has to be modified, which I tried to do, but not sure if I did it correctly: How to create a...

Use the package of a flavor in the manifest

java,android,gradle,android-gradle
Given the following flavors for an app: productFlavors { pro { applicationId = "com.example.my.pkg.pro" } free { applicationId = "com.example.my.pkg.free" } } And I need to declare the GCM permissions: <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /> <permission android:name="com.example.gcm.permission.C2D_MESSAGE" android:protectionLevel="signature" /> <uses-permission android:name="com.example.gcm.permission.C2D_MESSAGE" /> <application ...> <receiver...

Gradle: Execution failed for task ':*application-name-here*:compileDebugNdk', where can I see the adequate error messages?

android,intellij-idea,gradle,android-ndk,android-gradle
I am getting this when I am trying to compile and launch: Error:Gradle: Execution failed for task ':*application-name-here*:compileDebugNdk'. > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/path/to/android-ndk/ndk-build'' finished with non-zero exit value 2 OK cool, it is about compilation error, but where can I see compiler error messages? I set ndk up with:...

how to migrate project from android studio to android studio

android,android-studio,android-gradle
I have a project built in Android Studio(version 1.2). I want to migrate the project to Android Studio(version 1.2.1.1) in another laptop. What is the best way to do so? ...

Failed to resolve com.melnykov:floatingactionbutton:1.3.0 in gradle

android,android-studio,gradle,android-gradle,build.gradle
I apologize if I am missing something obvious, but I recently converted my project from Eclipse to Android Studio (and Gradle) and am trying to add support for Floating Action Buttons using Melnykov's library, but Gradle cannot resolve it. I thought it was a simple matter of adding compile 'com.melnykov:floatingactionbutton:1.3.0'...

Issue with gradle flavor with folder name for custom src folder

android,android-gradle,build.gradle
I am having a requirement where i am having 4 flavor and each of this flavor there are group of two flavor have common source code while they are different only by one specific parameter defined in buildConfigField. Issuse i am facing is that while i am creating build for...

Android gradle Copy from more that one directory into one .jar

java,android,android-studio,android-gradle
I want to copy from more than one directory int one .Jar file: So that all the .class files in both directories are bundles into one .jar file, is this possible? task makeJar(type: Copy) from('directory1') && (directory2) into('another directory') include('classes.jar') I can copy from one directory like this: task makeJar(type:...

Cannot find symbol import com.twitter.sdk.android.Twitter using Fabric

android,twitter,android-studio,android-gradle,twitter-fabric
Completely new to Twitter's Fabric Platform/SDK. I have been trying to integrate it into my existing build.gradle and it's been chaotic so far. When I try to install the "Log in with Twitter" feature via the Fabric plugin, it updates the build.gradle and then during sync throws the following error:...

Android Studio gradle build cannot add dependencies on old build gradle file

java,android,eclipse,android-studio,android-gradle
I have just imported the old gradle project from ADT to Android Studio. All SDK, Repository .. updated. How ever I can't add the dependencies to my project. It always says could not find. If i create a new project, All fine. Here is my gradle build file: buildscript {...

APK file creation in Android Studio

android,android-studio,apk,generator,android-gradle
I tried creating an apk file in android studio, On assembling the module and then running it isn't creating any output file in the build. Only 2 folders are there in build intermediates and generated.. Any help is appreciated..

ExecException when adding the new support design library

android,android-gradle
I'm trying to add the new Support Design library to my project: compile 'com.android.support:design:22.2.0' But as soon as I try to compile, I get the following error: Error:Execution failed for task ':app:dexDebug'. com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_40\bin\java.exe'' finished with non-zero exit value 3 I've already reached the 65k method...

apk is not signed. Please configure the signing information for the selected flavor using the Project Structure dialog

android,android-studio,android-gradle
I have looked at two SO threads for this and none have a selected Answer for this error message because no Answer candidate exactly addresses it. apk is not signed. Please configure the signing information for the selected flavor using the Project Structure dialog I've successfully uploaded both debug apks...

What's the difference between buildscript and allprojects in build.gradle?

gradle,android-gradle
On a multi-project gradle build, can someone tell me what exactly is the difference between the "allprojects" section and the "buildscript" one? Both has repositories and dependencies task. Is allprojects for my project ? What about buildscript? buildscript { repositories { ... } dependencies { ... } } and allprojects(subprojects)...

How can I add something to the productFlavors which I can read from java code

android,android-gradle,build.gradle,android-productflavors
I was trying to build multiple apks with different channel names, and I need to read the channel name in my java code. So I'm trying to work with productFlavors, currently what I'm trying to do is add the following code to my build.gradle productFlavors { GooglePlay { } Amazon...

Android tests build error: Multiple dex files define Landroid/support/test/BuildConfig

java,android,android-gradle,build.gradle,android-espresso
I'm trying to add Espresso 2 to my project (which also has lots of other dependencies), but I'm hitting this error when trying to run tests: UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException: Multiple dex files define Landroid/support/test/BuildConfig; at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596) at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554) at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535) ... The non-test build works fine. Does anybody have...

Error in gradle: Design Navigation Library include

android,android-gradle,navigation-drawer,androiddesignsupport
I have trying to use the Design Navigation Library from Android so I have to modify my gradle adding ... compile 'com.android.support:design:22.2.0' compile 'com.android.support:support-v4:22.2.0' I have added them and this is my actual gradle: apply plugin: 'com.android.application' android { compileSdkVersion 22 buildToolsVersion "22.0.1" defaultConfig { applicationId "demo31.navigation" minSdkVersion 15 targetSdkVersion...

Android plugin 1.3 error

android,android-studio,android-gradle,android-sdk-tools
This is error I get ,when updated my SDK and Build tool to Android M Android Build Tools Found incompatible Build Tools and Android plugin versions: * Module 'app' is using Android plugin 1.2.3 and Build Tools 23.0.0 rc1 Please use Android plugin 1.3 or newer, or an older Build...

How do I get this project structure in Android Studio (AS) 1.1.0 to work to produce two APKs?

android,android-gradle
EDIT#3--changing directory structures since advised wrong. Based on this link I followed from a SO question, I need my file structure to appear like this in Android Studio (AS) 1.1.0 in order to get both a free and for-pay version of my GPS (Google Play Store) app: +-- main ¦...

Warning about an Android Library project gradle dependencies

android,android-studio,gradle,android-gradle,build.gradle
I am building an Android Library project using Android Studio. The type of the module is 'com.android.library' in gradle.build file. This module has a number of dependencies: dependencies { compile 'com.squareup.retrofit:retrofit:1.9.0' compile 'com.squareup.okhttp:okhttp:2.3.0' } The module builds result in a .aar file. I want the user of the .aar file...

android studio cannot find the file specified

android,android-studio,android-gradle
Whenever I try to run my android application, I receive an error message in the run message log. I/O Error: D:\Apps\Application\app\build\intermediates\classes\debug\app.apk (The system cannot find the file specified) I don't believe this is a coding error because android studio is not telling me that there are errors within my java...

How to change the default artifactId of maven-metadata.xml when uploading to bintray

gradle,android-gradle,bintray,jcenter
In my project I've set a custom artifactId for maven POM: install { repositories.mavenInstaller { pom { project { artifactId = moduleProperties.getProperty("module.artifactId") ... } } } } where moduleProperties is a Properties class that loads a property file. With this set, the POM file has the correct artifactId ("core"). However,...

purpose of com.android.tools.build

android,android-gradle
I am a newbie to Android programming. I am using Android Studio 1.1.0 I have following query regarding building an app using gradle. What is the purpose of specifying buildscript dependencies 'com.android.tools.build:gradle:1.1.0' in build.gradle What does this build statement actually do. I have searched the forum but could not find...

Build failed after updating SDK tools and plays services libraries

android,gradle,android-gradle,build.gradle
Hi I've currently updated my SDK tools as well as the other components of my SDK except for the M-preview and the sample files which is currently I won't be using. Now problem is after updating the libraries and syncing the gradle it gives me this error: error: Attribute "track"...

Getting an OOM issue on the setContentView call in a java gradle android project

java,android,intellij-idea,out-of-memory,android-gradle
I'm using Intellij-idea and I had this project working without gradle, ran just fine and was functional. Migrated it to a gradle project (by just creating a new gradle android project and copying over the code) and now I'm getting this stack trace: (sorry it's so small...) Here is my...