gradle error in android studio while runnig flutter app - android-studio

I'm trying to authenticate my login page activity with firebase. so, while doing that I got this Gradle error.
I refer to the below link but nothing works for me.
flutter: getting gradle error while running my flutter app for the first time
In project/android/app/build.Gradle, the GradleException is highlighted in red.
build.gradle file:
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.google.gms:google-services:4.3.3'
classpath 'com.android.tools.build:gradle:4.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
In Console, the error is:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:stripDebugDebugSymbols'.
> No version of NDK matched the requested version 21.0.6113669. Versions available locally: 20.1.5948944
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1m 40s
Exception: Gradle task assembleDebug failed with exit code 1
help me out of this problem.

You have to configure your NDK through Project settings -> SDK Location -> Android NDK location.
If you don't have an NDK, then you need to go to Tools -> SDK Manager -> SDK Tools Tab, then select NDK (side by side) and install it.

Related

A problem occurred configuring project ':game'. > java.lang.NullPointerException (no error message)

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

Upgrading libGdx and Gradle project results in build errors

I have an older libGdx project that uses version 1.9.1 and Gradle 2.4. I`ve tried upgrade to libGdx 1.9.11 and Gradle 6.5. But I get the following build error:
Gradle sync failed: Could not find org.jetbrains.trove4j:trove4j:20160824.
Searched in the following locations:
- https://repo.maven.apache.org/maven2/org/jetbrains/trove4j/trove4j/20160824/trove4j-20160824.pom
- https://oss.sonatype.org/content/repositories/snapshots/org/jetbrains/trove4j/trove4j/20160824/trove4j-20160824.pom
- https://dl.google.com/dl/android/maven2/org/jetbrains/trove4j/trove4j/20160824/trove4j-20160824.pom
Required by:
project : > com.android.tools.build:gradle:4.1.1 > com.android.tools.build:builder:4.1.1 > com.android.tools:sdk-common:27.1.1
How can I solve it?
Add jcenter() in your root build.gradle file
repositories {
jcenter() // <- Add this
mavenLocal()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
google()
}
Then sync your project with gradle file. Make sure gradle is not in offline mode and you've good network connection.

Android Studio error gradle sync issues after update into 3.3.2

Hello I have a problem I upgraded my android studio into android 3.3.2. When I opend my old project it was syncing and at the end it gives me errors like this:
ERROR: The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.0 and higher.
The following dependencies do not satisfy the required version:
root project 'BreatherApp' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.71
Affected Modules: app
ERROR: Failed to resolve: org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.30
Show in Project Structure dialog
Affected Modules: app
build.gradle
buildscript {
ext.kotlin_version = '1.3.11'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.11"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Please help me I have search things to do but its still not working....
The error log already tells you:
The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.0 and higher
but you have
root project 'BreatherApp' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.71
Then you just need to update your Kotlin version, which is one line inside build.gradle inside your 'BreatherApp' module, to a 1.3.0 or newer version.
The error log already tells you:
Failed to resolve: org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.30
There is no 1.3.30 of kotlin-stdlib-jdk7, but a list of 1.3.30-dev-xxxx and 1.3.30-eap-xx. Choose the version you need (maybe 1.3.11 as your root build.gradle said), edit the module build.gradle.
Update: Please clarify project build.gradle and module build.gradle

Could not find com.android.tools.build:gradle:3.1.3

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)

Android studio with api.ai lib

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
}

Resources