FAQ Database Discussion Community


Cannot find symbol class newLatLng

java,android,android-studio,gradle
I am following a tutorial on writing apps with Google Maps Android API v2. I encountered a problem when I tried to do the following: CameraUpdate update = new CameraUpdateFactory.newLatLng(LOCATION_HOME); It produces an error: cannot find symbol class newLatLng. When I type in CameraUpdateFactory. IDE suggests "newLatLng" but then it...

How to apply a community plugin to a dummy Gradle project?

gradle
How to apply a community plugin to a Gradle project which is created by ProjectBuilder? In my unit test I have this code which fails with "org.gradle.api.plugins.UnknownPluginException: Plugin with id 'net.researchgate.release' not found.": private Project createProject() { Project project = ProjectBuilder.builder().withName('some-name'). withProjectDir(Paths.get(System.getProperty('user.dir')).resolve('build').resolve('test').toFile()).build() project.buildscript { repositories { jcenter() } dependencies {...

How to exclude dependencies of other subproject in Gradle build?

java,eclipse,gradle,dependencies,dependency-management
I am developing a sub-project that is a part of the huge multi-project Gradle build. I need some Java classes from these other sub-projects, but I do not need any dependencies they drag in because some libraries I use require different versions of these. I initially configured the needed subprojects...

How to use Library from GitHub in android App

android,github,gradle,libraries
I downloaded this library to use in my app, however, I can't get Android Studio to do the gradle build now. Anytime I try, I get "error:configuration with name 'default' not found". I've tried several other StackOverflow answers, but I still can't compile. My dependencies (from build.gradle Module: app) dependencies...

Spring Boot Actuator Info Endpoint Version from Gradle File

gradle,spring-boot
I'd like the /info actuator endpoint from my Spring Boot (1.2.4.RELEASE) application to return the version as specified in the build.gradle file. In my build.gradle file I have a line as so: version = '0.0.1-SNAPSHOT' I am using yaml configuration file. Right now I have the version duplicated as so...

Is it possible to exclude specific build variant when using flavor Dimensions?

android,gradle
When using Gradle flavorDimensions, is it possible to exclude specific variants? For example - android { ... flavorDimensions "abi", "version" productFlavors { freeapp { flavorDimension "version" ... } x86 { flavorDimension "abi" ... } } the following build variants will be created: x86-freeapp-debug x86-freeapp-release arm-freeapp-debug arm-freeapp-release mips-freeapp-debug mips-freeapp-release x86-paidapp-debug x86-paidapp-release...

Problems compiling NDK project with Android Studio 1.3 preview

android,android-studio,gradle,stl,android-ndk
Decided to give the new NDK support in Android studio a shot but seem to be running into an issue: Error: 'std::function' has not been declared Had a few other linking issues with stl libraries before but those were fixed by adding stl "stlport_static" cFlags "-O2 --std=c++11 " to the...

scala minecraft forgemod 'gradle runClient' gives runtime exception

scala,gradle,akka,minecraft,minecraft-forge
I'm trying to use akka inside my scala based mod. The when testing using "gradle runClient" it gives errors, best I can tell its missing the akka library at runtime. I don't see how to add akka library though. If it helps my project is here: https://github.com/tesract/NilCraft Any advice would...

Gradle: how to include an existing, complete project as a subproject?

android,gradle,multi-project
I git clone a complete gradle project "CompleteGradleProjA" from github and include it into my local project as a submodule. By "complete gradle project" I mean that I can go into directory "CompleteGradleProjA" and issue command cd CompleteGradleProjA && gradle build to build it. My directory structure looks like this,...

How do I set task properties in a Gradle Plugin

gradle,sonarqube,sonar-runner,gradle-custom-plugin
I am creating a gradle plugin to apply the sonar-runner plugin and default many of the values such as the sonar host URL and the sonar JDBC URL. I cannot figure out how to set the properties though. When I set this up in build.gradle I use: apply plugin: 'sonar-runner'...

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"...

Gradle Assemble Debug is Successful But Does Not Work [duplicate]

android,command-line,gradle
This question already has an answer here: Why won't gradle run from within a jenkins job 2 answers After following instructions here: http://developer.android.com/tools/building/building-cmdline.html apparently you're supposed to chmod +x gradlew then ./gradlew assembleDebug which leads to the following output: /gradlew assembleDebug :app:preBuild UP-TO-DATE :app:preDebugBuild UP-TO-DATE :app:checkDebugManifest :app:preReleaseBuild UP-TO-DATE :app:prepareComAndroidSupportAppcompatV72200Library...

Gradle + bintray: Specifying Dependencies of dependencies correctly

java,maven,gradle,dependencies
I have the following scenario: I want to use a project of mine (hosted on bintray.com) in another project of mine. I set up a maven repository, uploaded artifacts and pom files and then was able to utilize the jar file(s) uploaded to the bintray maven repo just fine, with...

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException

android,android-studio,gradle,multidex
I am using Android studio 1.2.2. I've integrated maps 4 work sdk, after this the Build is failing, We are using google play services lib in our project (using only com.google.android.gms.tagmanager.*). Now after integrating googlemaps_sdk_m4b_lib, the build is not getting generated. before to this inte Tried looking for including only...

Android project won't build after updating SDK

android,android-studio,gradle
Okey I updated SDK and before that my project was building and now I have bunch of errors : /home/user/project/android-project/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.0.0/res/values-v14/values.xml Error:(17, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'. Error:Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material'. Error:Error retrieving parent for...

How can I specify the latest commit version in Gradle

android,git,github,gradle
I'm using Gradle in my Android project,and I have added some dependencies in build.gradle file.For some reasons,I want to point to the latest commit for one of my dependencies.For example: dependencies { ... compile 'com.github.ozodrukh:CircularReveal:[email protected]' } I'm specifying CircularReveal's version to be [email protected],and I know currently it has fixed some...

what is gradle missing to map hibernate?

java,hibernate,gradle
I have unittest to my java project. My code uses hibernate. When i run the test using junit - everything passes. When I run the test using gradle - I get a mapping error: Caused by: org.hibernate.MappingException: Unknown entity: linqmap.users.interfaces.model.UserRecord and the class: @Entity @Table(name = "users") public class UserRecord...

Visualizing gradle dependencies in Intellij

intellij-idea,gradle,intellij-14
Is there a way to visualize project dependencies for a gradle project in Intellij? For a maven project, if you right click in the pom.xml you get a Show dependencies option but there I don't see such an option for a gradle project. Does this feature exist for gradle project?...

gradle - copy file after its generation

java,gradle
I try to build jar and after that copy it to another folder. task createJar(type: Jar) { archiveName = "GradleJarProject.jar" manifest { attributes 'Implementation-Title': 'Gradle Jar File Example', 'Implementation-Version': version, 'Main-Class': 'me.test.Test' } baseName = project.name from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } } with jar...

Can't use RecyclerView in my Android library project

android,gradle,dependencies,recyclerview,android-library
I have an Android library project and want to include a class that extends RecyclerView.Adapter. My build.gradle file includes the following: apply plugin: 'com.android.library' dependencies { compile 'com.android.support:recyclerview-v7:21.0.+' } Despite this, I cannot import RecyclerView in any java file; it even does not show up in the code completions popup...

How to specify the JDK version in android studio?

java,android,gradle,directory-structure
so Android Studio is giving me a Gradle build error that looks like this: Error:(3, 22) compileSdkVersion android-22 requires compiling with JDK 7 Now it gives me these clickable prompts: Download JDK 7 Select a JDK from the File System Open build.gradle File And I have already downloaded and installed...

Roboblender use annotation databases with multiple modules

android,gradle,dependency-injection,roboguice,roboblender
I'm following the steps from the RoboBlender Wiki to use annotations database but I keep getting java.lang.IllegalStateException: Unable to use annotation database(s) because it cannot find AnnotationDatabaseImpl I am using Android Studio and Gradle. The project consists of multiple modules. app moduleA moduleB moduleC Here is what I added to...

Gradle : Stackoverflow Error

gradle,stack-overflow
I'm using Gradle in IDEA and got below output. * What went wrong: A problem occurred evaluating script. > java.lang.StackOverflowError (no error message) * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. ...

Android Build failed at ':app:dexDebug' with exception ( library and app project )

android,exception,gradle,build
I am using some third party libraries in my library project. The following is my library project build.gradle apply plugin: 'com.android.library' android { compileSdkVersion 21 buildToolsVersion "21.1.2" defaultConfig { minSdkVersion 14 targetSdkVersion 21 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } //dexOptions...

Using GradleBuild , how to specify individual task to execute from tasks list

gradle
I've two gradle files : build.gradle apply from :'other.gradle' task hiHelloWrapper(type: GradleBuild) { buildFile = 'other.gradle' tasks = ['hi','hello'] } other.gradle task hello<<{ println 'hello from other' } task hi<<{ println 'hi from other' } Now, when I execute >gradle hiHelloWrapper it results in both tasks hi and hello being...

Creating and referencing a library for Android project (using command line and gradle)

java,android,linux,opencv,gradle
I need to create an Android app that uses the OpenCV library, and I would like to do this using the command line (linux) only. Before I start I wanted to get a feel for creating projects that use libraries, but I am having trouble referencing a sample library I...

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...

Suppress Gradle Warning in Android Studio?

java,android,android-studio,gradle
I get the following warning in Android Studio: Warning:Dependency org.json:json:20140107 is ignored for release as it may be conflicting with the internal version provided by Android. In case of problem, please repackage with jarjar to change the class packages I cannot remove the dependency because I use it in a...

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...

Gradle Android - Test coverage on legacy test projects structure

android,gradle,jacoco
I am migrating a quite big and complex legacy project to Gradle. I have many libraries projects, where each project has its own test subprojects. The project structure looks as follows: - LibraryX -- LibraryXTestsOne -- LibraryXTestsTwo - LibraryY -- LibraryYTests .... Each library is configured as follows: The main...

How to create different build variants pointing to different Servers?

android,gradle
I am using gradle.build for auto building my app. I want to generate three different APK's each pointing to different Service URL's. How can I make use of buildVariants (productFlavors in gradle). But I'm not able to figure out where to set the three URL's in the Gradle. How can...

Gradle - Error:Failed to find: com.squareup.okhttp:okhttp:2.4.0

android,android-studio,gradle,okhttp
I just try to use OkHttp but I have the following issue when I sync my gradle file with Android Studio : Error:Failed to find: com.squareup.okhttp:okhttp:2.4.0 Here is the dependencies part of my build.gradle file : dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') compile 'com.android.support:appcompat-v7:22.1.1' compile 'com.google.android.gms:play-services-maps:6.5.87' compile 'com.squareup.okhttp:okhttp:2.4.0' }...

Proguard - also use proguard files from modules

android,android-studio,gradle,proguard,android-proguard
My projects build.gradle looks like following: android { compileSdkVersion 22 buildToolsVersion "22.0.1" defaultConfig { applicationId "..." minSdkVersion 15 targetSdkVersion 22 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile project(':androKnife') } And my androKnife module does have it's own...

Install gradle on Centos

jenkins,gradle
I'm trying to install gradle for building android app with the help of Jenkins. But I'm not able to find the link to download gradle for Centos. I tried to use binaries from https://gradle.org/downloads/, but when I unzipped I got gradle.bat file inside bin directory which tells me that this...

Gradle build failing : Task 'jar' not found in root project 'spotify-web-api-android'

gradle,gradlew
I am trying to use the 'spotify-web-api-android' library by compiling and building a jar. Instructions to generate the jar have been provided, but are failing for me. What I want : Build the jar file successfully What is the problem - I am not familiar to Gradle and am getting...

Gradle: Prevent execution of tasks defined in allProjects for root project

gradle,build,build-process
I have a flat multi-project configuration like this: projA projB projC build_scripts build_scripts contains build.gradle build.gradle looks like this: allprojects { ... task gitPull(type: Exec) { description 'Pulls git.' commandLine "git", "pull" } } project(':projA') { ... } project(':projB') { ... } project(':projC') { ... } When I run gradle...

package org.powermock.api.easymock does not exist using gradle

java,android,gradle,powermock,easymock
Using gradle with android. I am trying to get powermock to compile as a dependency. I have dumbed down my attempts to get this working and it is still not working. Below is my build.gradle and activity. I am just doing it this way to demonstrate the error and trying...

Automatically copy .so files from NDK library project?

android-studio,gradle,android-ndk
Using Android Studio 1.2.1.1 with Gradle 1.2.3. I have an NDK library project A that produces a number of .so files in its own libs folder. Though, I cannot see the reference to this folder anywhere in the build.gradle file. When I reference library A from my app MyApp I...

Run a hava program from gradle as a part of another task

gradle
I can run a java program as a separate gradle task using JavaExec type for the task: task (foo, type: JavaExec) { main = '...' ... } However, how do I run a Java program as a part of another task, say in a doLast? I can probably do something...

Gradle: Adding sources.jar file within /lib folder of published dist.zip along with all my other dependencies

java,maven,jar,gradle
I have a java project that I am building using gradle. I am releasing a dist.zip folder for my project and I want to add the sources.jar for my project to the /lib subfolder within dist.zip. I am able to create a sources.jar file along with my dist.zip file but...

Gradle : Cannot add task ‘:helloFromBuild1′ as a task with that name already exists

gradle
Gradle gives the below error in terminal. * What went wrong: A problem occurred evaluating script. > Cannot add task ':helloFromBuild1' as a task with that name already exists. * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log...

Gradle multi-project custom build.gradle file name

gradle,build,multi-project
I have a multi-project Gradle build, which is currently configured through a single build.gradle file. There are over 70 modules in this project, and the single (gigantic) build.gradle file has become cumbersome to use, so I'd like to split it into small per-module buildscript files. Now, I don't want to...

Set variable to Gadle build file

gradle
This is kind of a follow-up question to this one. I want to "know" from which branch may Android app was built during the execution of the Gradle build.gradle file and add the branch name to the versionName of my app. This is my naive approach: apply plugin: 'android' def...

does gradle uses a cacerts file other than the javavm's?

android-studio,gradle
I am now behind a firewall that resigns every page with a different certificate. Work related. So every https access is now signed with a self(workplace)-signed-certificate. As a result, a lot of software is broken. Android studio lets you store certificates and use those, but gradle still complains. Short of...

Android Studio and gradle

android,android-studio,gradle
I tried importing Xabber ( GitHub ) within Android Studio , I did the git init etc . Now I find that I can start the app for that problem Gradle , I've looked everywhere , but could not find anything that would work .. The problem is: Error:Execution failed...

NPE when calling MockitoAnnotations.initMocks() in AndroidTestCase

java,android,testing,gradle,mockito
Trying to use mockito in my AndroidTestCase. I added the dependencies to the build.gradle: final DEXMAKER_VERSION = '1.2' dependencies { ... androidTestCompile "com.google.dexmaker:dexmaker:${DEXMAKER_VERSION}" androidTestCompile "com.google.dexmaker:dexmaker-mockito:${DEXMAKER_VERSION}" androidTestCompile 'org.mockito:mockito-core:1.10.19' } The TestCase with the mockito initialization: public class UsersListPresenterTest extends AndroidTestCase { public void setUp() throws Exception { MockitoAnnotations.initMocks(this); } public void...

Groovy generated constructor missing during compile

groovy,gradle
I have a setup in which I call the generated constructor(@TupleConstructor) of a Groovy class(Product) from a java class(ProductService). The IDE shows the generated constructors and compilation used to work. But now, for unknown reasons, the compilation fails because the compiler doesnt find the parameterized constructors anymore: ProductService.java:31: error: constructor...

Duplicate entry for class in gradle

java,android,android-studio,gradle
I am trying to implement ken burns view in android studio in my app, i have importted the folder which contains its classes, but gradle gives me this error Error:Execution failed for task ':app:packageAllDebugClassesForMultiDex'. > java.util.zip.ZipException: duplicate entry: com/flaviofaria/kenburnsview/MathUtils.class Here is my build.gradle apply plugin: 'com.android.application' android { compileSdkVersion 21...

Incorrect liferay-plugins dependency

gradle,dependencies,liferay,liferay-6.2
In https://github.com/liferay/liferay-plugins/blob/6.2.x/build-plugins.gradle#L9 following dependency is defined: dependencies { classpath group: "com.liferay.portal", name: "portal-service", version: "7.0.0-SNAPSHOT" } How can a 6.2.x version have a dependency on 7.0.0 version? Is it a bug? When I peek to the history of the file, the dependency has always been there. I am not able...

'Provided' dependency in Gradle

java,gradle,dependency-management
I have build.gradle in fron of me and there are some dependencies declared as provided but in documentation I do not see this dependency scope. dependencies { compile("org.springframework.boot:spring-boot-starter-web:1.2.4.RELEASE") .... provided 'backport-util-concurrent:backport-util-concurrent:3.1' provided 'org.javolution:javolution:[email protected] .... } Is this provided by a plugin? If so how do I found out which plugin...

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....

Show list of dependencies using gralde command line?

android,android-studio,gradle
What is the command to show all project dependencies using gradle command line?

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 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' ...

Add project on outer level as dependency to module

android,intellij-idea,gradle
I have a project that looks something like this: mainProject/ mainModule proj1/ module1 proj2/ module2 and what I'm trying to do is add proj1 and proj2 as dependencies to mainProject. I've gotten it to the point where I can import classes from the projects and everything seems to work fine...

How to run single android unit test using gradle 2.4. Test filtering is not supported

java,android,unit-testing,android-studio,gradle
I'm using gradle to build my android project and am not able to run single unit test. I have several test classes and one of them is MockServerTest and I only want to run test methods in this class. I tried using gradle -Dtest.single=MockServerTest test but it turned out running...

Migrating from Ant to gradle build android studio

android,android-studio,gradle
I have an existing ANT build project build using Intelli J . I want to migrate it to Gradle build .What to do? I have Android studio also.

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...

Get the Git Working Branch in Gradle on Jenkins

git,jenkins,gradle
I want to have the current Git branch in the Version name of my Android app. I built in this snippet from here into my build.gradle: def getWorkingBranch() { // Triple double-quotes for the breaklines def workingBranch = """git --git-dir=${rootDir}/git --work-tree=${rootDir}/.. rev-parse --abbrev-ref HEAD""".execute().text.trim() print "Working branch: " + workingBranch...

Gradle - using flavors

android,gradle,android-productflavors
I have a project that uses Bluetooth Low Energy scanning in a single class. Since API 21, Android has deprecated a few of the methods I use, and wants me to replace them with new ones. I don't really want to cut off all the API 19s and 20s out...

Gradle How can i specify the cacheResolutionStrategy for the SNAPSHOT version in my buildscript block?

gradle
I am having problems with resolutionStrategy.cacheChangingModulesFor. My project build.gradle looks similar to this apply plugin: 'base' apply plugin: 'maven' apply plugin: 'maven-publish' apply from: "gradle/mixins/cachestrategy.gradle" configurations.all { resolutionStrategy.cacheDynamicVersionsFor 5, 'minutes' resolutionStrategy.cacheChangingModulesFor 0, 'seconds' } buildscript { repositories { maven { url artifactoryUrl } } dependencies { classpath (group: 'com.myorg', name:...

Gradle & Jacoco: Get jacoco reports for Test-type task other than “test”

java,gradle,jacoco
When I run gradlew test jacocoTestReport the task jacocoTestReport runs and I get a a test report. When I run gradlew integTest jacocoTestReport the task jacocoTestReport is skipped. Here's the relevant excerpts from my build.gradle: apply plugin: 'jacoco' jacocoTestReport { group = "Reporting" description = "Generate Jacoco coverage reports after...

UnitTest with gradle, when test Infrastructure is in some other project in src/test/java folder

unit-testing,junit,gradle,multi-project
There is two java projects A and B, the build-engine is gradle. That is a multi-project and A depends on B A: build.gradle ... dependencies { compile project (':B') } ... B has core code in src/main/java and test code in src/test/java. Also in src/test/java is some testing infrastructure classes...

Deploy closed source aar maven repo to github

android,git,maven,github,gradle
I am using the following guide to publish a closed source aar as maven repo on github: http://andydyer.org/blog/2014/10/05/hosting-android-dependencies-on-github/ The github repo I am publishing to: https://github.com/tabishfayyaz/test-sdk In my gradle.build file I have: repositories { maven { url "https://github.com/tabishfayyaz/test-sdk/blob/master" } } dependencies { compile 'com.adscendmedia.sdk:adscendmedia:1.0.1' } However Android studio results in...

How do I ensure code is generated before compiling when building?

gradle,antlr
I have a build.gradle with the following code: apply plugin: 'java' apply plugin: 'application' gradle.projectsEvaluated { tasks.withType(JavaCompile) { options.compilerArgs << "-Xlint:unchecked" } } ext.antlr = [ grammarpackage: "org.shirolang.interpreter", antlrSource: 'src/main/java/org/shirolang', destinationDir: "src/generated/java" ] sourceSets{ generated main{ compileClasspath += generated.output runtimeClasspath += generated.output } test{ compileClasspath += generated.output runtimeClasspath += generated.output...

Gradle Exec : Why it is not running in configuration phase?

gradle,exec,mkdir
Here is my: build.gradle task makeDirectoryStructure(type:Exec){ description 'Creates directory structure .' commandLine 'mkdir' args '-p' ,'top_dir/sub_dir_1/sub_dir_2' println "This line is printed in configuration phase." } Now, since I haven't used '<<' or< 'doFirst/doLast', I expect mkdir to be executed in configuration phase i.e. whenever the build script is compiled. For...

Android Studio work with module

java,android,android-studio,gradle
In my project I've got a main package and a module (app 2). For the module, I use standard application -> import to project -> change it as library and make dependencies (compile project(':app2')). Everything is ok but when I compile, it installs on my cell phone as two individual...

Paid and Free versions of android app

android,gradle,android-version
I am wondering what is the best way to have two different versions of an android app. I would like to have version of my app with ads and one without ads (the paid one). What is the easiest way to achieve this ? I have found something called version...

determine if it is jenkins environment inside gradle

jenkins,gradle,jenkins-plugins,build.gradle
I am just wondering is it possible that I can tell whether I am in a Jenkins environment inside gradle? I just want to do something like if (jenkins){ //do something }else{ //do other } ...

Cannot resolve symbol 'AndroidJUnit4'

android,gradle,dependencies,build.gradle,android-uiautomator
Obviously I need the correct import statment to solve this problem. According to the docs for AndroidJUnit4, this should be import android.support.test.runner.AndroidJUnit4; When I do that, Android Studio highlights runner in red and complains "Cannot resolve symbol 'runner'". Background I got to this point by following the tutorials on the...

Gradle multi-project conditional dependencry

android,android-studio,gradle
How would one create an Android Studio (Gradle) multi-project configuration such that projB depends on project(':projA') if projA is defined, but uses a file in libs/ otherwise? Since it may be asked, in this case projA is an SDK; projB is a test application designed to demonstrate the SDK. If...

Spring Data neo4j JUnit4 setup

intellij-idea,gradle,neo4j,junit4,spring-data-neo4j-4
I confess I am a total newbie at the Java way of doing things and I am totally lost trying to get a simple unit test running. I am building a data access library and want to unit test it. I am using Spring Data Neo4j 4.0.0.BUILD-SNAPSHOT because I need...

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...

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...

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...

Android Error Importing Library which references R resource

android,android-studio,gradle,android-library
I have an Android Library that I've uploaded to Artifactory and include in a separate application using compile 'com:mycompany:mylibrary:0.0.1' The gradle syncs properly and imports the library to my 'External Libraries', however when I run the application I get errors referencing code in the library: // Code in my android...

Android Studio Best way import module from other repository

android,git,gradle,repository
I have to import a project from a Github repository as a module inside an Android Studio project that it committed into another repository. The project I have to import from Github will be updated constantly so it means that I'll have to refresh every now and again for having...

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.+'...

duplicate an android studio project

android,gradle,duplicates,project,sync
Im using Android studio and Im trying to deplicate an existing project to make another new. i search in the web and also at the forum and i found this method : - copy the folder of the old project and rename it - change the package name in the...

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:...

Gradle dependencies for several projects

android,gradle,dependencies,dependency-management
I have some projects in directory Dir |____ Progect 1 |____ Progect 2 |____ Progect 3 In project 1 i need use class from project 2. How do I get the required dependencie on the project 1...

Using ant.replace in gradle

replace,ant,gradle
I want to use ant's replace task to replace token in one of the files like this: version.txt version.number=${versionNumber} build.gradle task writeVersion { ant.replace { file 'version.txt' token 'versionNumber' value '1.0.0' } } but it is giving me following error :- A problem occurred evaluating root project '1.01-Exercise-RunYourFirstTask'. > replace...

Using gradle 2.4 in Android Studio

android,android-studio,gradle
I'd like to use the latest version of gradle in Android Studio. How do I check which version is used, and how do I upgrade to the latest one (if it is supported)? I'd like to upgrade because I read that the latest version improves build times.

Phonegap: Command failed with exit code 8

android,cordova,gradle
I'm setting up an environment for Phonegap developing, and I'm getting some trouble to finally build and run an app for Android. When I try to execute build for Android, I got the following error: Running: C:\Users\Renan\workspace_html5\FIAP\Phonegap\phonegap-test\test\platfor ms\android\gradlew cdvBuildDebug -b C:\Users\Renan\workspace_html5\FIAP\Phonegap \phonegap-test\test\platforms\android\build.gradle -Dorg.gradle.daemon=true Unzipping C:\Users\Renan\.gradle\wrapper\dists\gradle-2.2.1-all\2m8005s69iu8v0oi...

Change version constant before compile

java,intellij-idea,gradle,compilation
I'm looking for a simple solution to find and replace a constant before compile. For example @Version@ replaced with 1.0.0 so the program has access to the correct version #s.

Gradle Jar structure is different than the real project structure

java,jar,gradle,build
I'm trying to build my project with gradle but for some reason the resources are put on a different level than their real level. Here's the build: apply plugin: 'java' version = '1.1' archivesBaseName = 'DesktopOmegle' repositories { //mavenCentral() maven { url 'http://oss.sonatype.org/content/repositories/snapshots/' url "http://repo1.maven.org/maven2" } } dependencies { compile...

Choosing specific ports on local development server for non-default modules

java,google-app-engine,android-studio,gradle,app-engine-modules
In my build.gradle file, I use the following config for my non-default (module2) AppEngine gradle module: appengine { downloadSdk = true httpAddress = "0.0.0.0" httpPort = 8081 appcfg { email = "[email protected]" oauth2 = true } } However, when I run my "Google AppEngine configuration", the module still starts on...

How to elegantly build selected parts of a project

gradle
I have a project where I ideally wanted to be able to write something like this: gradle build or gradle build -Pparts=part1,part5 Where the first command builds the whole project with a core part and all other parts. The second command builds the core part and selectively part1 and part5....

gradle execute task after build

gradle,build.gradle
I am using the build in gradle. My build.gradle file like this: project('a'){ apply plugin: 'java' apply plugin: 'eclipse' apply plugin: 'application' buildDir = 'build' [compileJava, compileTestJava]*.options*.encoding = 'UTF-8' repositories { mavenCentral() } dependencies { compile 'org.slf4j:slf4j-api:1.7.7' } } When I input the gradle build in the command, I want...

Use thymeleaf template for some pages and rest for some for building gradle project

rest,spring-mvc,gradle,spring-security,thymeleaf
I am new to this please someone tell me whether I can use Thymeleaf template for some pages and REST for some for building Gradle project? I created my login page retrieving through MySQL database using Thymeleaf template now for adding other information in my database I want to use...

Design Support Library v22.2 “UNEXPECTED-TOP-LEVEL EXCEPTION”

android,gradle,android-support-library,build.gradle,android-design-library
I decided to use some cool stuff Google just released in their support design library. Everythyng goes fine when I import the library and when I sync the project with Gradle files. But it gives me an error when I compile the project. I don't know if i have too...

Artifactory Publish Android Library with Resources

android,maven,gradle,android-library,artifactory
Problem: I am trying to create an Android Library which can be included in an application using: // Application's build.gradle compile 'com.mycompany:mylibrary:1.0.0' In my case, I am using Artifactory and I have gotten the above to work fine. The problem is when I try to run the application I a...

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...

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...

Exclude Package From Gradle Dependency

java,web-services,rest,gradle
I'm experiencing an issue where multiple versions of the same class are showing up in my classpath. The class in question is javax.ws.rs.core.UriBuilder. The version I want to use is brought in by javax.ws.rs:javax.ws.rs-api:2.0.1. However, we also use the Jira rest client library which has a dependency on the older...

Configure Scrypt in Gradle for x86 android devices

android,gradle,scrypt
In my application I need to use a Scrypt library but there's an issue: scrypt-1.4.0.jar which is taken from Maven Central refuses to work on x86 architectures. A hint to solution has been found in this thread: https://groups.google.com/forum/#!topic/bitcoinj/B0kOqUVIW24, specifically: Yes, the scrypt jar on Maven Central contains native code (lib/*.so)....

Adding Android AppWidget just for one Product Flavor

android,gradle,android-appwidget,android-productflavors
I have two gradle product flavors: for prod and for stage server. productFlavors { stage { // stage specific stuff } production { // production only } } Also I have an AppWidget must be able only for stage now. I think I should hide my AppWidgetProvider in manifest: <receiver...

Gradle. Detect dependencies problems

gradle
How to check all dependencies of my project which I declare and I do not declare. I have strong feeling that it exists dependencies with few different versions. I have tried https://discuss.gradle.org/t/is-there-a-gradle-equivalent-of-mvn-dependency-analyze/7532/13 but it was tedious to test everything one by one.

Gradle not using latest version of the support library?

android,android-studio,gradle,android-support-library,recyclerview
I've been using the android.support.v7.widget package -- specifically the RecyclerView class (among others but this is where the problem is). It was working fine until earlier today it randomly seems to default to an earlier version of the package now. I say that because: When I try calling myRecyclerView.addOnScrollListener(myScrollListener), myRecyclerView.getChildAdapterPosition(myView)...

Android XML: RuntimeException: Failed to resolve attribute at index 6

android,xml,exception,android-studio,gradle
Hello dear stackoverflower, In my project, i am using the new "android design library". The problem is, that there is a runtime exception which says(Im trying to create a FloatingButton): java.lang.RuntimeException: Failed to resolve attribute at index 6 at android.content.res.TypedArray.getColorStateList(TypedArray.java:426) at android.support.design.widget.FloatingActionButton.<init>(FloatingActionButton.java:91) at android.support.design.widget.FloatingActionButton.<init>(FloatingActionButton.java:79) at...