I am on Android Studio 1.3 which I believe requires gradle version 1.2 and up. Some of my team can't update yet and so need to use a lower gradle version. Is there an easy way to do that in the same build script? Something like this:
buildscript {
repositories {
mavenCentral()
}
dependencies {
if (Android Studio Version <= 1.2 )
{
classpath 'com.android.tools.build:gradle:1.1.0'
}
else
{
classpath 'com.android.tools.build:gradle:1.2.3'
}
}
}
Related
Working on creating an android studio plugin using IntelliJ .
Following the guide https://plugins.jetbrains.com/docs/intellij/gradle-build-system.html using the Gradle
and the android studio plugin guide https://plugins.jetbrains.com/docs/intellij/android-studio.html#configuring-the-plugin-pluginxml-file
After created the project using the wizard and added the section runIde.
I am getting an error.
Expression 'runIde' cannot be invoked as a function. The function 'invoke()' is not found.
here is the build.gradel.kts.
plugins {
id("java")
id("org.jetbrains.kotlin.jvm") version "1.6.20"
id("org.jetbrains.intellij") version "1.5.2"
}
group = "com.example"
version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
}
// Configure Gradle IntelliJ Plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin
intellij {
version.set("212.5712.43")
type.set("IC") // Target IDE Platform
plugins.set(listOf("android"))
}
runIde {
// Absolute path to installed target 3.5 Android Studio to use as
// IDE Development Instance (the "Contents" directory is macOS specific):
ideDir.set(file("/Applications/Android Studio.app/Contents"))
}
tasks {
// Set the JVM compatibility versions
withType<JavaCompile> {
sourceCompatibility = "11"
targetCompatibility = "11"
}
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.jvmTarget = "11"
}
patchPluginXml {
sinceBuild.set("212")
untilBuild.set("222.*")
}
signPlugin {
certificateChain.set(System.getenv("CERTIFICATE_CHAIN"))
privateKey.set(System.getenv("PRIVATE_KEY"))
password.set(System.getenv("PRIVATE_KEY_PASSWORD"))
}
publishPlugin {
token.set(System.getenv("PUBLISH_TOKEN"))
}
}
OS.
macOS Monterey version 12.4.
The IntelliJ info.
IntelliJ IDEA 2022.1.1 (Community Edition).
Build #IC-221.5591.52, built on May 11, 2022.
Android Studio info.
Android Studio Chipmunk|2021.2.1.
Build#AI-212.5712.43.2112.8512546, Build on April 29, 2022.
Your runIde needs to be in the tasks block:
tasks {
runIde {
// Absolute path to installed target 3.5 Android Studio to use as
// IDE Development Instance (the "Contents" directory is macOS specific):
ideDir.set(file("/Applications/Android Studio.app/Contents"))
}
}
I'm building apk from an android project exported from Cocos Creator V2.4.3 but getting the below error with Gradle
A problem occurred configuring project ':game'.
> java.lang.NullPointerException (no error message)
I've deleted all android SDK, NDK and re-installed Android Studio, then re-update SDK, NDK, Build Tool.
But the error still occurs.
Some configurations:
Android SDK = 23, 26, 28, 30
SDK Build Tool = 30.0.3
NDK = 19.2.5345600
Gradle version: 4.10.3
Gradle plugin version: 3.2.0
JDK: jdk1.8.0_281
The build.gradle looks like this
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
flatDir {
dirs 'libs'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Anyone has any idea about what should be done to fix this?
I had the same issue, I solved this by specifying 3.6.3 as Android Gradle plugin version and 5.6.4 as Gradle version.
You can do this by clicking File--> project structure--> project then type the versions I mentioned above then click on apply.
wait for the new versions to be downloaded and rebuild your project.
The problem was with setting the NDK Path in Cocos Creator.
I've changed
C:\Users\SomeUserName\AppData\Local\Android\Sdk\ndk
into
C:\Users\SomeUserName\AppData\Local\Android\Sdk\ndk\19.2.5345600
And things worked
I am using Android Studio 3.0.1 and I have updated the Gradle plugin from 4.1 to 4.4 and also tried to upgrade the android plugin Gradle from 3.0.1 to 3.1.3. The problem is AS cannot update the android plugin and gives me this error.
Error:Could not find com.android.tools.build:gradle:3.1.3.
Searched in the following locations:
file:/F:/android studio/gradle/m2repository/com/android/tools/build/gradle/3.1.3/gradle-3.1.3.pom
file:/F:/android studio/gradle/m2repository/com/android/tools/build/gradle/3.1.3/gradle-3.1.3.jar
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.1.3/gradle-3.1.3.pom
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.1.3/gradle-3.1.3.jar
https://maven.google.com/com/android/tools/build/gradle/3.1.3/gradle-3.1.3.pom
https://maven.google.com/com/android/tools/build/gradle/3.1.3/gradle-3.1.3.jar
https://jcenter.bintray.com/com/android/tools/build/gradle/3.1.3/gradle-3.1.3.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/3.1.3/gradle-3.1.3.jar
Based on the same questions I've added maven repo in Project level build.gradle in addition to google() used for AS 3.0 and higher but the problem hasn't been solved.
buildscript {
repositories {
google()
maven {
url "https://maven.google.com"
}
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
maven {
url "https://maven.google.com"
}
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
try alter and verify that in the "gradle-wrapper.properties" file to amend the gradle dist to a much later version for example
distributionUrl=https://services.gradle.org/distributions/gradle-4.4-all.zip
and also update the android support lib version to latest version as well for eg 27.1.1
Make sure you have "Enable embedded Maven repository" checked (in Prefrences / Settings menu)
I trying to use api.ai in a android project. So I download the Android Studio 2.3.3 create a new blank project to use android 5.0 o higher so I go here and put the dependencies
compile 'ai.api:sdk:2.0.7#aar'
// api.ai SDK dependencies
compile 'com.android.support:appcompat-v7:23.2.1'
But only to put the dependencies I got the error:
Error:(9, 0) Gradle DSL method not found: 'compile()' Possible
causes:The project 'ChefBot' may be using a version of the
Android Gradle plug-in that does not contain the method (e.g.
'testCompile' was added in 1.1.0). Upgrade
plugin to version 2.3.3 and sync projectThe project
'ChefBot' may be using a version of Gradle that does not contain the
method. Open Gradle wrapper
fileThe build file may be missing a Gradle plugin. Apply Gradle plugin
How can I fix this?
this is my build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
apply plugin: 'com.android.application' // put this and don`t work
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
compile 'ai.api:sdk:2.0.7#aar'
compile 'com.android.support:appcompat-v7:23.2.1'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I have a project recently want to update to Gradle 2.3 to setup Instant App. But after update the top level build.gradle (and the gradle-wrapper.properties setting to gradle-3.3-all.zip)
buildscript {
repositories {
jcenter()
maven {
url 'https://plugins.gradle.org/m2/'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0' // was 2.2.3
classpath 'net.ltgt.gradle:gradle-apt-plugin:0.6'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}
}
I constantly got error :
Error:Could not find com.android.databinding:library:1.3.1.
Required by:
project :app
Roll back to Gradle 2.2.3 fix the issue.
Anyone has idea how to fix this issue?