Is it possible to declare a variable in Gradle usable in Java?

Is it possible to declare a variable in Gradle usable in Java ? Basically I would like to declare some vars in the build.gradle and then getting it (obviously) at build time. Just like a pre-processor macros in C/C++… An example of declaration would be something like that … : android { debug { A_VAR_RETRIEVABLE_IN_JAVA … Read more

How to manually include external aar package using Gradle for Android

I’ve been experimenting with the new android build system and I’ve run into a small issue. I’ve compiled my own aar package of ActionBarSherlock which I’ve called ‘actionbarsherlock.aar’. What I’m trying to do is actually use this aar to build my final APK. If I include the whole ActionBarSherlock library as an android-library module to … Read more

Gradle DSL method not found: ‘runProguard’

I get an error after updating from my last project. Not a problem in my code but I’m having trouble with build.gradle. How can I fix it? build.gradle code here: apply plugin: ‘android’ android { compileSdkVersion 21 buildToolsVersion ‘20.0.0’ packagingOptions { exclude ‘META-INF/DEPENDENCIES’ exclude ‘META-INF/LICENSE’ exclude ‘META-INF/LICENSE.txt’ exclude ‘META-INF/license.txt’ exclude ‘META-INF/NOTICE’ exclude ‘META-INF/NOTICE.txt’ exclude ‘META-INF/notice.txt’ … Read more

Android Studio Error “Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8”

I downloaded the newest Android Studio, and I wanted to run the Android Jetpack Compose Project, but when I ran it, I got the error: > Failed to apply plugin ‘com.android.internal.application’. > Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8. You can try some of the following options: – … Read more

How to create a release signed apk file using Gradle?

I would like to have my Gradle build to create a release signed apk file using Gradle. I’m not sure if the code is correct or if I’m missing a parameter when doing gradle build? This is some of the code in my gradle file: android { … signingConfigs { release { storeFile file(“release.keystore”) storePassword … Read more

Automatically accept all SDK licences

Since gradle android plugins 2.2-alpha4: Gradle will attempt to download missing SDK packages that a project depends on Which is amazingly cool and was know to be a JakeWharton project. But, to download the SDK library you need to: accept the license agreements or gradle tells you: You have not accepted the license agreements of … Read more

Invoke-customs are only supported starting with android 0 –min-api 26 [closed]

Closed. This question needs debugging details. It is not currently accepting answers. Want to improve this question? Update the question so it’s on-topic for Stack Overflow. Closed 3 years ago. Improve this question before i’m use build version gradle 26 but after change buildtoolsversion to 27 like as this image I am using android studio … Read more

What is the difference between compileSdkVersion and targetSdkVersion?

I have looked at the documentation for building with Gradle, but I’m still not sure what the difference between compileSdkVersion and targetSdkVersion is. All it says is: The compileSdkVersion property specifies the compilation target. Well, what is the “compilation target”? I see two possible ways to interpret this: compileSdkVersion is the version of the compiler … Read more

Android Studio: Add jar as library?

I’m trying to use the new Android Studio but I can’t seem to get it working correctly. I’m using the Gson library to serialize/deserialize JSON-objects. But the library somehow isn’t included in the build. I had created a new project with just a MainActivity. Copied gson-2.2.3.jar in the /libs folder and added it as a … Read more