build.gradle

Android studio 3.2.1 ArtifactResolveException: Could not resolve all artifacts for configuration ':classpath'

江枫思渺然 提交于 2019-12-03 14:40:18
After I update Android Studio to 3.2.1 and gradle version in my project I am getting following build error. I have already checked lots of questions related this question but no luck. Project dependency Build.gradle buildscript { repositories { google() mavenCentral() maven { url 'https://maven.google.com' } gradlePluginPortal() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.2.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { google() maven { url "https://jitpack.io" }

How I can display Log files,System.out.println(), In Android test?

﹥>﹥吖頭↗ 提交于 2019-12-03 14:38:18
I did search a lot but unfortunately couldn't get it to work. Based on my search I found that I need to add following code into build.gradle file. However, Gradle seems doesn't recognize it and always says Geadle DSL method not found: test() test { testLogging.showStandardStreams = true testLogging.events("passed", "skipped", "failed", "standardOut", "standardError") afterTest { desc, result -> println "Executing test ${desc.name} [${desc.className}] with result: ${result.resultType}" } } Update I can confirm above code or better than that following code is working fine if you create a test

difference between compile vs compile tree vs compile Files?

三世轮回 提交于 2019-12-03 13:26:39
I was trying to integrate my project in android studio. but i am little confused when adding dependencies. I don't know which one is works good.I have tried Compile fileTree and compile files.Its not working for me . I found some methods.can any one tell me which one is appropriate for adding library (jar file only like admob). compile fileTree(dir: 'libs', include: '*.jar') compile 'com.android.support:appcompat-v7:+' compile project(":libraries:libraryname") compile files('libs/libraryname.jar') can any one tell me which one is appropriate for adding library (jar file only like admob). If

Android gradle task Google Appengine

断了今生、忘了曾经 提交于 2019-12-03 13:13:03
问题 I'm trying to write a gradle task for my android application that starts the google appengine developer server, runs a test, and then closes the server. What I've tried so far looks like this: task runAppEngine (dependsOn: ":backend:appengineRun") <<{ //run test //stop development server } The appengineRun task runs, but whatever I put in the doLast section of the gradle task never seems to get executed. For example if I put in a println statement it is never printed to the console. I'm also

Downloading Dependences From Private Amazon S3 Repository with Gradle

蓝咒 提交于 2019-12-03 12:48:11
I am looking to add Groovy support to an existing java project so that I can seemlessly compile mixed Java and Groovy code using invokedynamic so that I can get Java-like execution speed without needing to waste excessive amounts of time with verbose Java syntax After reading that the gmaven plugin no longer supports compilation -and that the groovy eclipse compiler plugin doesn't yet support invokedynamic , I asked myself, why would I want to continue using Maven if it compiles Groovy code that is needlessly slow? Consequently, I decided I would try scrapping maven for Gradle so that I could

How to read a json file into build.gradle and use the values the strings in build.gradle file

六眼飞鱼酱① 提交于 2019-12-03 12:45:02
for example, read the json file in build.gradle and use the json values as strings in the file { "type":"xyz", "properties": { "foo": { "type": "pqr" }, "bar": { "type": "abc" }, "baz": { "type": "lmo" } } } I need to call properties.bar.type and abc should be replaced there. I need to convert these values to string and use in build.gradle file Crazyjavahacking From Gradle you can execute any Groovy code and Groovy already has build-in JSON parsers. E.g. you can use a task that will print your value into stdout: task parseJson { doLast { def jsonFile = file('path/to/json') def parsedJson = new

React Native Android Release Build Failing - Gradle

两盒软妹~` 提交于 2019-12-03 12:40:30
问题 I've got a rather complicated project some of which is older code from the past year or so which in React Native time is forever. The regular debug build is working fine but the release build has errors. I've cobbled together answers from other places to make it as far as I have but I don't know how to get past this last bit. I keep getting a bundling error where aapt will fail because it doesn't bundle the resources properly. Example of error code: > Task :app:bundleReleaseJsAndAssets

Can't update to Android Studio gradle 1.4 plugin

自作多情 提交于 2019-12-03 11:52:57
问题 In my build.gradle I have: buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:1.4.+' } } However I'm getting: Error:Could not find com.android.tools.build:gradle:1.4.+. Searched in the following locations: file:/C:/AndroidStudio/gradle/m2repository/com/android/tools/build/gradle/1.4.1/gradle-1.4.1.pom file:/C:/AndroidStudio/gradle/m2repository/com/android/tools/build/gradle/1.4.1/gradle-1.4.1.jar https://repo1.maven.org/maven2/com/android

Better to use task dependencies or task.doLast in Gradle?

给你一囗甜甜゛ 提交于 2019-12-03 11:43:10
After building my final output file with Gradle I want to do 2 things. Update a local version.properties file and copy the final output final to some specific directory for archiving. Let's assume I already have 2 methods implemented that do exactly what I just described, updateVersionProperties() and archiveOutputFile() . I'm know wondering what's the best way to do this... Alternative A: assembleRelease.doLast { updateVersionProperties() archiveOutputFile() } Alternative B: task myBuildTask(dependsOn: assembleRelease) << { updateVersionProperties() archiveOutputFile() } And here I would call

How to create gradle task which always runs?

北城余情 提交于 2019-12-03 11:23:15
I'm likely overlooking something pretty core/obvious, but how can I create a task that will always be executed for every task/target? I can do something like: task someTask << { println "I sometimes run" } println "I always run" But it would be much more desirable to have the always running part in a task. The closest I've come is: task someTask << { println "I sometimes run" } println "I always run" void helloThing() { println "I always run too. Hello?" } helloThing() So, using a method is an 'ok' solution, but I was hoping there'd be a way to specifically designate/re-use a task. Hopefully