Generate Signed APK gives an error in Android Studio 3.4 - android-studio

Build APK and run application on external device work properly, but When I am trying to generate signed APK I got the error message
Could not find com.android.tools.lint:lint-gradle:26.4.
Here is my Project build.gradle
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
//mavenCentral()
}
}
some of articles suggest to change classpath version but I think 3.4.2 is the latest version of gradle.

By updating my android studio to 3.5, problem was fixed. I don't know the reason. this one was my last chance

You should put google() as the first repo inside buildscript{}, i.e.
buildscript {
repositories {
google() //// <--- here
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
}
}

Related

Updated my Android Studio from 3.4.2 to 4.0,but unable to sync project due to missing of SDK 29(I have downloaded)

Error:
Could not resolve all files for configuration ':app:androidApis'.
Failed to transform android.jar to match attributes {artifactType=android-mockable-jar,
org.gradle.libraryelements=jar, org.gradle.usage=java-runtime, returnDefaultValues=false}.
Execution failed for MockableJarTransform: C:\Users\DELL\AppData\Local\Android\Sdk\platforms\android-
29\android.jar.
Cannot create mockable android.jar
C:\Users\DELL\AppData\Local\Android\Sdk\platforms\android-29\android.jar (The system cannot find the file specified)
Build.gradle
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.0.0"
// 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
}
Distribution Url
https://services.gradle.org/distributions/gradle-6.1.1-all.zip
I have tried installing and Uninstalling SDK 29 and Tools ,but same error exists.
Please Help.

How to solve 'could not find method implemtatation()' error?

I'm working on an AndroidStudio Project, and I can't sync the project with de gradle. I have the following error :
ERROR: Could not find method implemtatation() for arguments [project ':mapwize'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
I tried to change the gradle version but it didn't work.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
maven {
url "https://jitpack.io"
}
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Check the build.gradle in your modules (not the top level file).
There is a typo in the dependencies block.
You are using implemtatation instead of implementation

Android build miss intellij

since today I cannot build my android project because of this error :
> Could not resolve all files for configuration ':classpath'.
> Could not find intellij-core.jar (com.android.tools.external.com-intellij:intellij-core:26.0.1).
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/external/com-intellij/intellij-core/26.0.1/intellij-core-26.0.1.jar
Android studio 3.2.1
com.android.tools.build:gradle:3.0.1
Do you have any clue ???
Thanks a lot
Vlad
I had the same problem with a cordova-android#7.1.1 project. I read this question Android Studio - Could not find intellij-core.jar and I solved by joining more than one answer.
Premise:
Android Studio 3.2.1
Cordova Android 7.1.1
Cordova Cli 8.1.2
Resolution:
File: platforms/android/build.gradle
...
buildscript {
repositories {
google()
maven {
url "https://maven.google.com"
}
jcenter()
}
dependencies {
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
...
File: platforms/android/app/build.gradle
...
buildscript {
repositories {
google()
maven {
url "https://maven.google.com"
}
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
// Allow plugins to declare Maven dependencies via build-extras.gradle.
allprojects {
repositories {
google()
maven {
url "https://maven.google.com"
}
jcenter()
}
}
...
File: platforms/android/CordovaLib/build.gradle
...
buildscript {
repositories {
google()
maven {
url "https://maven.google.com"
}
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
}
}
...
This solution is working to me, I hope I helped you
I have the same issues, and change to classpath 'com.android.tools.build:gradle:3.1.0' solve my issues. You can try it.
This answer is heavily based on the ionic article: https://ionic.zendesk.com/hc/en-us/articles/360005529314
This script can be added to the hooks so no need to fiddle with the platforms code manually.
Create a maven_swap.sh with the following:
#!/bin/bash
#remove jcenter
sed -i.bak '/jcenter()/d' platforms/android/CordovaLib/build.gradle
#append jcenter
sed -i.bak '/maven {/{
N
N
a\
jcenter()
}' platforms/android/CordovaLib/build.gradle
cat platforms/android/CordovaLib/build.gradle
rm platforms/android/CordovaLib/build.gradle.bak
note: sed -i.bak ensures linux & mac compatibility.
Make sure the file is executable chmod +x maven_swap.sh
Add in the config.xml the following:
<platform name="android">
<hook src="maven_swap.sh" type="before_compile" />
...
</platform>

Gradle synchrozination Error

I am new to Android, and working in studio2.2 beta version.
My build.gradle file has following content
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.gradle:2.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven {url 'http://repo1.maven.org/maven2'}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
But on synchronization , Its giving the following error
Error:Could not find com.android.tools.gradle:2.0.0:.
Searched in the following locations:
file:/D:/android-studio/gradle/m2repository/com/android/tools/gradle/2.0.0//2.0.0-.pom
file:/D:/android-studio/gradle/m2repository/com/android/tools/gradle/2.0.0//2.0.0-.jar
https://jcenter.bintray.com/com/android/tools/gradle/2.0.0//2.0.0-.pom
https://jcenter.bintray.com/com/android/tools/gradle/2.0.0//2.0.0-.jar
Required by:
:MyApplication:unspecified
Any help ?
try:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Current android gradle tool version is 2.2.0 for android studio 2.2. Also, you can now use stable release, no need for beta version
classpath 'com.android.tools.gradle:2.2.0'
Also you need gradle 2.14.1+ for this plugin.

Errors with gradle on Android Studio 0.4.6

Hello StackOverflow,
I have recently updated my Android Studio to the latest version (0.4.6), and I am encountering weird problems with it. When first creating my project, I got this error:
So I obviously went to my SDK Manager and updated my Build Tools to version 19.0.2. However, I still got this error message. I took a look into my build.gradle file and saw that I am missing the android paragraph, So I changed it from this:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.8.+'
}
}
allprojects {
repositories {
mavenCentral()
}
}
To this:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.8.+'
}
}
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion '19.0.2'
//Other Configuration
}
allprojects {
repositories {
mavenCentral()
}
}
But now I am getting this error message when trying to build (and the older Build Tools error):
I'm not sure what to do now.. How can I solve this?
As suggested by Scott keep your Root level build.gradle file like this
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.8.+'
}
}
allprojects {
repositories {
mavenCentral()
}
}
Content of this file will be included in each module level build.gradle file at the type of Gradle sync or compilation.
Check all build.gradle files inside your modules. They all should look similar to this
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion '19.0.2'
//Other Configuration
}
dependencies{
// Your all module dependencies here
}
Undo the changes you made to the top-level build file, and make those changes to the build files in your individual modules. In particular, putting an apply plugin: 'android' statement or android block in your top-level build file in that manner won't work. The error message you're seeing is happening because the build system is trying to build an Android app out of the root directory of your project, but none of the source files for such a project are there.

Resources