build.gradle

How to create the fat jar with gradle kotlin script

寵の児 提交于 2019-11-28 22:18:28
问题 As titled, I'd like to know how to modify the gradle.build.kts in order to have a task to create a unique jar with all the dependencies (kotlin lib included) inside. I found this sample in Groovy: //create a single Jar with all dependencies task fatJar(type: Jar) { manifest { attributes 'Implementation-Title': 'Gradle Jar File Example', 'Implementation-Version': version, 'Main-Class': 'com.mkyong.DateUtils' } baseName = project.name + '-all' from { configurations.compile.collect { it

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

☆樱花仙子☆ 提交于 2019-11-28 21:53:41
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 below. Note that the maven-publish aspect of my build.gradle files appears to be correct because when

Could not find method leftShift() for arguments after updating studio 3.4

蓝咒 提交于 2019-11-28 21:03:26
After updating studio 3.4 and Gradle version to 5.1.1 I got the error on my task as Could not find method leftShift() My task: task incrementBetaVersion << { println("Incrementing Beta Version Number...") incrementVersionNumber('BetaVersionNumber') println("Incrementing Beta Version Number...") incrementVersionName('BetaVersionName') } I got the error for the left shift operator << in the line. How to resolve this error? To solve this error, change << with doLast like this. task incrementBetaVersion { doLast { println("Incrementing Beta Version Number...") incrementVersionNumber(

Could not find property 'xxxx' on com.android.build.gradle.AppExtension_Decorated

隐身守侯 提交于 2019-11-28 20:37:48
I got this error after I added these lines to my gradle file: buildTypes.each { it.buildConfigField 'String', 'OPEN_WEATHER_MAP_API_KEY', MyOpenWeatherMapApiKey } then the log show: Could not find property 'MyOpenWeatherMapApiKey' on com.android.build.gradle.AppExtension_Decorated@c3b784 The solutions on google that I searched cannot solve my problem. Please show me where I was wrong? Since you are using a String you have to use this syntax: buildConfigField "String" , "OPEN_WEATHER_MAP_API_KEY" , "\"XXXXX-XXXXX-XXX\"" The last parameter has to be a String Otherwise you can use something like

Maven profiles equivalent of Gradle

自闭症网瘾萝莉.ら 提交于 2019-11-28 20:32:54
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 instead of creating multiple build files? Is there a best practice changing build configuration based on the

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

眉间皱痕 提交于 2019-11-28 20:05:35
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) Also posting my app gradle apply plugin: 'com.android.application' android { compileSdkVersion 26

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

那年仲夏 提交于 2019-11-28 20:04:42
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 failed, 9 skipped :test FAILED :test (Thread[Daemon worker,5,main]) completed. Took 8 mins 39.684 secs.

How to add .aar dependency in library module?

早过忘川 提交于 2019-11-28 19:21:52
I am having one .aar file of one library module. I want to use it as a library or dependency in my other project's library module. How do I do it? I tried options provided at below links: http://kevinpelgrims.com/blog/2014/05/18/reference-a-local-aar-in-your-android-project/ It works only if I add .aar reference in my project's application module. But not working in library module. Thanks. Follow this setting and you will able to add .aar dependency to library module build.gradle (Project: ....) allprojects { repositories { jcenter() mavenCentral() flatDir { dirs 'libs' dirs project(':library

Android studio, configure gradle project takes forever

♀尐吖头ヾ 提交于 2019-11-28 19:11:54
After changing the gradle build file to use gradle build tool 0.8.+, classpath 'com.android.tools.build:gradle:0.8.+' my Android studio is stuck forever at "refreshing X Gradle project". I tried to restart AS, didn't work. I did even change gradle build tool back to 0.7.+, even downgrade my AS from 0.4.4 back to 0.4.2, still no hopes. Anyone experienced this before? pls help Tks. Update : now I tried deleting all old .iml files and .idea folder, and reimported, now it's stuck at "Building X Gradle project info", seems like forever. Building from commandline is perfectly fine. Update 2: Log

Android Studio - Failed to notify project evaluation listener error

喜欢而已 提交于 2019-11-28 18:30:52
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 { disable 'MissingTranslation' } } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']