I am trying to build my first project to Android and during build I am getting the following error.
I have been looking a lot at previous question but the fixes dont work or are not available in 2019 unity.
IMAGE FULL RES
Gradle.Build file
// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN
allprojects {
buildscript {
repositories {
google()
jcenter()
}
dependencies {
// If you are changing the Android Gradle Plugin version, make sure it is compatible with the Gradle version preinstalled with Unity
// See which Gradle version is preinstalled with Unity here https://docs.unity3d.com/Manual/android-gradle-overview.html
// See official Gradle and Android Gradle Plugin compatibility table here https://developer.android.com/studio/releases/gradle-plugin#updating-gradle
// To specify a custom Gradle version in Unity, go do "Preferences > External Tools", uncheck "Gradle Installed with Unity (recommended)" and specify a path to a custom Gradle version
classpath 'com.android.tools.build:gradle:3.4.0'
}
}
repositories {
google()
jcenter()
flatDir {
dirs "${project(':unityLibrary').projectDir}/libs"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Related
I am trying to add a epub reader library to a project I have already created. The library I am trying to add to my project as a moduel is the Folio Reader Library (https://github.com/FolioReader/FolioReader-Android). I have downloaded this library on my computer and have tried adding it through File -> New -> Import Module. However, during the process I received countless errors. My current one is this:
Gradle DSL method not found: 'versionName()'
Possible causes:
The project 'FolioReader-Android-master' 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 3.4.1 and sync project
The project 'FolioReader-Android-master' may be using a version of Gradle
that does not contain the method.
Open Gradle wrapper file
The build file may be missing a Gradle plugin.
Apply Gradle plugin
This file is the file where the dependencies are declared for the Library.
FolioReader-Android-master:
build.gradle file:
// Top-level build file where you can add configuration options common to
all sub-projects/modules.
buildscript {
apply from: 'versions.gradle'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
//moj
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.11"
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
}
}
allprojects {
configurations.all {
resolutionStrategy {
cacheChangingModulesFor 0, 'seconds'
}
}
repositories {
mavenLocal()
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
The error itself states that the problem arises because the project is using a version of the Gradle plug-in may not contain the method. I have updated the version to the newest one, however I still receive this error. Any suggestions on how I can solve this problem?
Problem solved by replacing
versionName 1
with
versionName "1.1"
in the Module level build.gradle file.
I just turned on an old computer and am trying to access some code. After updating all of my Android Studio, JDK, and Downloading the latest Gradle I am having trouble building the project. I get this error ;
ERROR: Could not find com.android.tools.build:gradle:5.4.1.
Searched in the following locations:
- https://jcenter.bintray.com/com/android/tools/build/gradle/5.4.1/gradle-5.4.1.pom
- https://jcenter.bintray.com/com/android/tools/build/gradle/5.4.1/gradle-5.4.1.jar
Required by:
project :
Add Google Maven repository and sync project
Open File
I have dont this and this
Below is the content of build.gradle file
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:5.4.1'
}
}
Below is the content of wrapper file
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
in my settings I have toggled between default and setting my path manually. I have also attemted to add google() and MavenCentral() to the repositories
I just ant to build and run my app but it is saying no! haha help
Don't confuse gradle with the Android Gradle plugin.
classpath 'com.android.tools.build:gradle:5.4.1'
It is the Android Gradle plugin and 5.4.1 doesn't exist.
Use the latest stable release:
classpath 'com.android.tools.build:gradle:3.4.1'
Check the release notes for other versions.
If you open URL https://jcenter.bintray.com/com/android/tools/build/gradle, there is no 5.4.1.
For gradle version meanings, please check What is real Android Studio Gradle Version?.
For your case, you need to add google() repo in your buildscript closure and modify the android-gradle-plugin version to be 3.4.1
buildscript {
repositories {
google()// <-- add this.
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
}
And, also, probably, you need to update your allprojects closure as below:
allprojects {
repositories {
google()// <-- add this.
jcenter()
}
}
Edit #1
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
This is the wrapper configuration telling which gradle version to use for your android gradle plugin. It is NOT the plugin version.
I am trying to build an android app in ionic 3, but when i execute 'ionic cordova build android' i have the error: Execution failed for task ':app:processDebugResources'. > Failed to execute aapt
I am using some plugins like firebase
I already tryed to make some changes in build.gradle like add: configurations.all; change the position of jcenter(), create a build-extra.gradle and remove the platform
But none of it works, please help
Here my build.gradle
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' } // Fabrics Maven repository from cordova-plugin-firebase
maven {
url "https://maven.google.com"
}
jcenter()
}
dependencies {
configurations.all {
resolutionStrategy.force 'com.android.support:support-v4:24.0.0'
}
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.google.gms:google-services:4.1.0' // google-services dependency from cordova-plugin-firebase
classpath 'io.fabric.tools:gradle:1.25.4' // fabric dependency from cordova-plugin-firebase
}
}
allprojects {
repositories {
google() // Google's Maven repository from cordova-plugin-firebase
maven {
url "https://maven.google.com"
}
jcenter()
}
//This replaces project.properties w.r.t. build settings
project.ext {
defaultBuildToolsVersion="25.0.2" //String
defaultMinSdkVersion=19 //Integer - Minimum requirement is Android 4.4
defaultTargetSdkVersion=26 //Integer - We ALWAYS target the latest by default
defaultCompileSdkVersion=26 //Integer - We ALWAYS compile with the latest by default
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Before i make some changes, i've got an error with support-android-v4
I am sure you ckecked on StackOverFlow some solutions about that, but we have not enought data to fix that. Related to other similar post, did you tried the following changes :
Just put following in build-extras.gradle
configurations.all {
resolutionStrategy {
force 'com.android.support:support-v4:27.1.0'
}
}
See more here : https://stackoverflow.com/a/49174659/11552516
Google just released a major update which requires a minimum sdkversion=28. Because of this you need to update the android cordova platform to 8.0.0. you can use the command line by removing the existing platform
cordova platform remove android
and adding the new one
cordova platform add android#8.0.0
Once the new platform is there then the easiest way to migrate is open the android platform in android studio. In the top menu bar there is a tab called and choose refactor-->Migrate to AndroidX. This should fix all the instances of class paths being changed from the newest google update.
One final thing is to add these next lines in the gradle.properities file of the android project
android.useAndroidX=true
android.enableJetifier=true
In Android Studio 3.0 Beta 1, I'm required to use Gradle 4.1-rc-1. AS offered to do the update for me (why not) but when the project tries to build, I get an error saying the pom and jar for gradle-4.1-rc-1. It's apparently not in the jcenter or google repos. On Google's AS release page, they mention this is a known bug and that a clean and sync should fix it, but it did not work for me.
Here is my build file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.1.3-2'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1-rc-1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Which repository holds the correct gradle files? Should they have downloaded to my machine already?
Maybe you should update your gradle/wrapper/gradle-wrapper.properties file of your project, instead of build.gradle.
Here is my content of gradle-wrapper.properties:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-rc-1-all.zip. Content of build.gradle : classpath 'com.android.tools.build:gradle:3.0.0-beta1'.
I got it working although I'm not exactly sure what did it. However, here are some things I did and some extra information if anyone else is running into this issue as well.
Project Settings (⌘;)
Gradle Version: 4.1
Android Plugin Version: 3.0.0-beta1
Android Plugin Repository: google(), jcenter
Default Library Repository: google(), jcenter, 'https://jitpack.io'
With these settings, upon trying to sync, I would be asked to update my Gradle to 4.1-rc-1. I pressed the "do it manually" option. Then I went to my project in the terminal and did what google suggested:
gradlew clean
gradlew assemble
I update the gradle plugin to the latest, and i'm getting this error:
Error:Could not find com.android.tools.build.gradle:3.0.0-alpha7:.
Searched in the following locations:
file:/C:/Users/dmin/Documents/android-studio/gradle/m2repository/com/android/tools/build/gradle/3.0.0-alpha7//3.0.0-alpha7-.pom
file:/C:/Users/dmin/Documents/android-studio/gradle/m2repository/com/android/tools/build/gradle/3.0.0-alpha7//3.0.0-alpha7-.jar
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0-alpha7//3.0.0-alpha7-.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0-alpha7//3.0.0-alpha7-.jar
https://maven.google.com/com/android/tools/build/gradle/3.0.0-alpha7//3.0.0-alpha7-.pom
https://maven.google.com/com/android/tools/build/gradle/3.0.0-alpha7//3.0.0-alpha7-.jar
Here's my build.gradle
buildscript {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
}
dependencies {
classpath 'com.android.tools.build.gradle:3.0.0-alpha7'
classpath 'com.google.gms:google-services:3.1.0'
}
}
allprojects {
repositories {
jcenter()
}
}
Where i'm getting wrong? since i modified my gradle.build according to the question Could not find com.android.tools.build:gradle:3.0.0-alpha1 in circle ci
thank you!!
-- Updated the build.gradle according to Mr Tim, but i'm still having the same error
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build.gradle:3.0.0-alpha7'
classpath 'com.google.gms:google-services:3.1.0'
}
}
allprojects {
repositories {
jcenter()
}
}
Follow the steps in the 3.0.0 plugin migration guide
Update gradle version
The new Android plugin requires Gradle version 4.1-milestone-1 or
higher. If you're opening an existing project using Android Studio 3.0
Preview 5 or later, follow the prompts to automatically update an
existing project to the compatible version of Gradle.
To update Gradle manually, update the URL in gradle-wrapper.properties
as follows:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-milestone-1-all.zip
and
Apply the plugin
If you're opening an existing project using Android
Studio 3.0 Preview 5 or later, follow the prompts to automatically
update your project to the latest version of the Android plugin. To
manually update your project, include the maven repo and change the
plugin version in your project-level build.gradle file as follows:
buildscript {
repositories {
...
// You need to add the following repository to download the
// new plugin.
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1' //Minimum supported Gradle version is 4.6
}
}
You try :
buildscript {
repositories {
...
// You need to add the following repository to download the
// new plugin.
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
Credits: https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html
If you're in Android Studio 3.1 or higher, you're likely encounter such type of issue prompting by a Build window.
Simply click on the Add Google Maven repository and sync project option at right side and initiate another gradle sync.
It'll make the necessary changes in both gradle-wrapper.properties as well as build.gradle files.
Update gradle plugin : in gradle.properties file
add this line
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
then apply ther plugin in build.gradle file :
buildscript {
repositories {
...
// You need to add the following repository to download the
// new plugin.
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
the distributionUrl property inside gradle-wrapper.properties should be:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
that works for me
open the file path(just as the log said):
file:/C:/Users/dmin/Documents/android-studio/gradle/m2repository/com/android/tools/build/gradle/
found this file
just change classpath 'com.android.tools.build.gradle:3.0.0-alpha7'
to classpath 'com.android.tools.build.gradle:* * * ' ; * * * is the exist gradle file;
this problem is because of gradle file do not found