build.gradle

Gradle Artifactory Plugin - How to publish artifacts from multiple modules in a project?

喜夏-厌秋 提交于 2019-11-27 14:06:57
问题 I have a project which has a SharedCode (Java) module and secondly an Android (Android library) module which depends on the SharedCode module. I want to publish a jar artifact from the SharedCode module and an aar artifact from the Android module. I can't figure out how to compose my build.gradle files so that both modules publish to Artifactory when the artifactoryPublish task is run. At the moment only the SharedCode module publishes its artifact to Artifactory. My build.gradle files are as

java.lang.IllegalAccessError: Method 'void android.support.v4.content

北城余情 提交于 2019-11-27 13:37:40
I updated playservice in my sdk and I got this error. And I am not able to access GCM Token. Before update sdk my project work perfectly. I waste my whole day in it but not found any solution. I tried this but gettting error in this dependencies com.google.android.gms:play-services-plus:9.0.0 Here is my logcat Caused by: java.lang.IllegalAccessError: Method 'void android.support.v4.content.ContextCompat.<init>()' is inaccessible to class 'com.google.android.gms.iid.zzd' (declaration of 'com.google.android.gms.iid.zzd' appears in /data/data/com.hwindiapp.passenger/files/instant-run/dex/slice

Error in gradle build after updating Android Studio with log4j

本秂侑毒 提交于 2019-11-27 13:09:33
I do get these errors after i updated Android Studio and the SDK: Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.log4j.chainsaw.ControlPanel$1) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on

Maven profiles equivalent of Gradle

风流意气都作罢 提交于 2019-11-27 12:59:36
问题 I'm trying to achieve a simple scenario in my spring boot project build: including / excluding dependencies and packaging war or jar depending on the environment. So for example, for the environment dev include devtools and package jar, for prod package war etc. I know it is not XML based configuration anymore and I can basically write if statements in my build.gradle but is there a recommended way of achieving this? Can I declare some common dependencies and refer them in a single file

invokedynamic requires --min-sdk-version >= 26

筅森魡賤 提交于 2019-11-27 12:55:27
问题 Today downloaded the studio 3.0 beta 2.0 version, after that tried to open an existing project in it and faced some difficulties, most of them I could solve with the help of Google and Stack Overflow, but this one I can not. Error:Execution failed for task ':app:transformClassesWithDexBuilderForDebug'. > com.android.build.api.transform.TransformException: org.gradle.tooling.BuildException: com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)

Gradle build null console object

拜拜、爱过 提交于 2019-11-27 12:18:09
I'm trying to get my gradle builds to prompt at the console for a password using examples from stack overflow When I have a statment such as: def password = System.console().readLine("Enter keystore password ") When I run I get the error Cannot invoke method readLine() on null object It seems console is coming out as null . What I've read this requires java 6 which if I go to a command prompt and type java -version I'm running Java(TM) SE Runtime Environment (build 1.6.0_27-b07). This issue is being tracked in Gradle's Github repo: Can't use System.console() with the Gradle Daemon . For some

Add resources, config files to your jar using gradle

六月ゝ 毕业季﹏ 提交于 2019-11-27 12:16:19
How do I add config files or any other resources into my jar using gradle? My project structure: src/main/java/com/perseus/.. --- Java packages (source files) src/main/java/config/*.xml --- Spring config files Expected jar structure: com/perseus/.. --- Java packages (class files) config/*.xml --- Spring config files Move the config files from src/main/java to src/main/resources . I came across this post searching how to add an extra directory for resources. I found a solution that may be useful to someone. Here is my final configuration to get that: sourceSets { main { resources { srcDirs "src

How to use JUnit 5 with Gradle?

假如想象 提交于 2019-11-27 11:55:25
I am trying to use JUnit 5 with Gradle after I succeeded in running a JUnit 4 test. Expected result: Tthe JUnit 4 test gave a nice 'passed' in the output and an html report in build/reports/tests . Actual result: The JUnit 5 test as below does not output anything besides (...) build succesful , while I know the test is not actually run since there is no test log output passed/skipped/failed, and putting a fail in the test keeps the build successful. Running gradle test --info yields Skipping task ':testClasses' as it has no actions. among a lot of I think mostly unrelevant output. Surprisingly

Why are my Gradle builds dying with exit-code 137?

ぐ巨炮叔叔 提交于 2019-11-27 11:26:20
问题 I've been trying to compile and test a large project to use Gradle. The test run fine until they die unexpectedly. I dug around and resources said that this is due to a memory issue. If I reduce the number of tests in the suite, it runs fine. I increased the memory by 4x increased the debugging level but I still don't follow what causes this. Here's the horribly cryptic stacktrace. The last line (scroll right) shows the memory settings that I've defined. ... ... ... 1125 tests completed, 30

Android Studio - Failed to notify project evaluation listener error

一笑奈何 提交于 2019-11-27 11:24:44
问题 Following is the build.gradle code in Android Studio apply plugin: 'com.android.application' android { compileSdkVersion 23 buildToolsVersion "23.0.2" defaultConfig { applicationId "com.sg.blahblah" minSdkVersion 15 targetSdkVersion 23 versionCode 1 versionName "1.0" } lintOptions { checkReleaseBuilds true abortOnError false xmlReport true htmlReport true } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' lintOptions