I tried compiling android but it gives me the following error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Could not resolve all files for configuration ':app:_internal_aapt2_binary'.
> Could not resolve com.android.tools.build:aapt2:3.6.3-6040484.
Required by:
project :app
> No cached version of com.android.tools.build:aapt2:3.6.3-6040484 available for offline mode.
> No cached version of com.android.tools.build:aapt2:3.6.3-6040484 available for offline mode.
* 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
I saw this web page https://discuss.gradle.org/t/cached-version-error/35754
It says I should increase kotlin version but when I went into the build.gradle of my app, I did not see any kotlin in it. This is the build.gradle of my app
// 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.6.3'
// 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
}
I don't think your issue is related to kotlin version. Looks like either you don't have a proper internet connection and your project its failing to download build tools 3.6.3 or you have "offline mode" enabled for gradle plugin.
If you are sure you have a proper internet connection, check if you have offline mode enabled in
Android Studio File -> Settings -> Build, Execution, Deployment -> Gradle
Or the quickest by just typing offline mode in the Android studio actions.
Hit shift + cmnd + a in Mac or shift + cntrl + a in windows.
Then type "offline mode"
Disable it
Sync gradle and run your proyect again.
This should solve the issue.
Related
I keep facing this issue.
I tried
1)
./gradlew clean -> npm i -> expo i
2) add this line to build.graddle(:app)
multiDexEnabled true
3) add this line to build.graddle(project)
maven {
url "$rootDir/../node_modules/expo-camera/android/maven"
}
But nothing works.
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:mergeDebugAssets'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
> Could not find com.google.android:cameraview:1.0.0.
Searched in the following locations:
- file:/Users/hayat/.m2/repository/com/google/android/cameraview/1.0.0/cameraview-1.0.0.pom
- https://dl.google.com/dl/android/maven2/com/google/android/cameraview/1.0.0/cameraview-1.0.0.pom
- https://repo.maven.apache.org/maven2/com/google/android/cameraview/1.0.0/cameraview-1.0.0.pom
- https://devrepo.kakao.com/nexus/content/groups/public/com/google/android/cameraview/1.0.0/cameraview-1.0.0.pom
Required by:
project :app > project :expo > project :expo-camera
> Could not find com.github.CanHub:Android-Image-Cropper:1.1.1.
Searched in the following locations:
- file:/Users/hayat/.m2/repository/com/github/CanHub/Android-Image-Cropper/1.1.1/Android-Image-Cropper-1.1.1.pom
- https://dl.google.com/dl/android/maven2/com/github/CanHub/Android-Image-Cropper/1.1.1/Android-Image-Cropper-1.1.1.pom
- https://repo.maven.apache.org/maven2/com/github/CanHub/Android-Image-Cropper/1.1.1/Android-Image-Cropper-1.1.1.pom
- https://devrepo.kakao.com/nexus/content/groups/public/com/github/CanHub/Android-Image-Cropper/1.1.1/Android-Image-Cropper-1.1.1.pom
Required by:
project :app > project :expo > project :expo-image-picker
* 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
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.3.3/userguide/command_line_interface.html#sec:command_line_warnings
How to resolve this issue? please help me.
Encountered the same issue and solved it by adding the following code block to my android\build.gradle file.
allprojects {
repositories {
// * Your other repositories here *
maven {
// expo-camera bundles a custom com.google.android:cameraview
url "$rootDir/../node_modules/expo-camera/android/maven"
}
}
}
NOTE I believe the instructions given here are kinda misleading. You must add the whole code block. I was only adding the code block below to no success. It's only after adding the whole block above that I was able to successfully build my project
maven {
// expo-camera bundles a custom com.google.android:cameraview
url "$rootDir/../node_modules/expo-camera/android/maven"
}
I checked out and built the project at https://github.com/kosiara/artoolkit-android-studio-example
I have Android Studio 4.0.2 on Windows 10.
The build error I get is:
Executing tasks: [:app:assembleDebug] in project D:\Downloads\artoolkit-android-studio-example-master\artoolkit-android-studio-example-master
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> A problem occurred configuring project ':base'.
> Could not resolve all dependencies for configuration ':base:_debugCompile'.
> Could not find com.android.support:appcompat-v7:23.1.1.
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/appcompat-v7/23.1.1/appcompat-v7-23.1.1.pom
https://jcenter.bintray.com/com/android/support/appcompat-v7/23.1.1/appcompat-v7-23.1.1.jar
Required by:
artoolkit-android-studio-example-master:base:unspecified
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 1.346 secs
I'm afraid I don't understand what is wrong.
I'm not sure what needs to be set to version 23.1.1. I looked in my Android SDK manager under SDK Tools, Android SDK Build-Tools and there is no option for 23.1.1. (Is that even where I should be looking?) I see 23.0.1, 23.0.2 (Installed), 23.0.3. Also the Android SDK Platform 23 is installed.
Do I need to add a custom Site to get the missing 23.1.1 option? I have no idea how to do that or what site it would be, if that's what's required.
I suspect there's likely something not set up correctly about my SDK or Android Studio, but I don't know what to check next.
I see this related question but that question has no answer.
I'd like some help getting this example to build.
That version of that module (appcompat-v7) is not in the JCenter repository.
You have to add google maven using the old way when you're using an old version of Gradle, you are not allowed to use google() on Gradle v1.5.
build.gradle (project level)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I have this error can you tell me what's the solution for it?
Launching lib\main.dart on sdk gphone x86 in debug mode...
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project 'android'.
Could not resolve all artifacts for configuration ':classpath'.
Could not download builder.jar (com.android.tools.build:builder:3.5.0)
Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/builder/3.5.0/builder-3.5.0.jar'.
Premature end of Content-Length delimited message body (expected: 8174407; received: 4456416
Could not download bundletool.jar (com.android.tools.build:bundletool:0.9.0)
Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/bundletool/0.9.0/bundletool-0.9.0.jar'.
Premature end of Content-Length delimited message body (expected: 5248142; received: 4456416
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 21m 37s
Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
Whether the first time or not. When you click run on your application you get an X gradle build error If you have any of the following lines in your error even a single line then try this solution
Launching lib\main.dart on sdk gphone x86 in debug mode...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not download builder.jar (com.android.tools.build:builder:3.5.0)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/builder/3.5.0/builder-3.5.0.jar'.
> Premature end of Content-Length delimited message body (expected: 8174407; received: 4456416
> Could not download bundletool.jar (com.android.tools.build:bundletool:0.9.0)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/bundletool/0.9.0/bundletool-0.9.0.jar'.
> Premature end of Content-Length delimited message body (expected: 5248142; received: 4456416
SOLUTION
Go this location:- .flutter/packages/flutter_tools/gradle/flutter.gradle
**
Backup the file in another place before making edits to it
Search for something called buildscript;
It should come up like that (or similar, don't worry you have a backup file)
and overwrite this code
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
}
}
With this
buildscript {
repositories {
maven {
url 'https://dl.google.com/dl/android/maven2'
}
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
}
}
Still, your problem is not solved? If it was solved DON'T try the next one if not then try it. (And even if this didn't work then put the backup file in its place and see if it's working)
Then in your android folder go to build.gradle (in your project files go to
android/build.gradle) and change the buildscript to this (Don't worry about the code not being 100% like this. Just add the specified line in the shown location and that's it)
buildscript {
repositories {
google()
mavenCentral() //add this line
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1' // Doesn't matter what you have here
}
}
Just make Flutter clean in android studio or VScode
If you already have mavenCentral() added inside buildscripts{...} and allprojects{...}
inside build.gradle file,
then add jcenter() after each mavenCentral().
or, vice-versa
If you got AndroidX incompatibilities in a plugin as well then just focus on following versions:
change your compileSdkVersion 30 in app\build.gradel
Try to change this accordingly
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
}
Try to change gradle version in gradle->wrapper->gradle-wrapper.properties
distributionUrl=https://services.gradle.org/distributions/gradle-6.6.1-all.zip
I solved the problem with <uses-permission android:name="android.permission.INTERNET" /> in androidManifest.xml
I solved the problem by deleting the .gradle folder in C:user/
Linux environment using jenkins android gradle project to build an error
* What went wrong:
A problem occurred configuring project ':app'.
> Could not download glide.jar (com.github.bumptech.glide:glide:3.7.0)
> Could not get resource 'https://jcenter.bintray.com/com/github/bumptech/glide/glide/3.7.0/glide-3.7.0.jar'.
> Could not GET 'https://jcenter.bintray.com/com/github/bumptech/glide/glide/3.7.0/glide-3.7.0.jar'.
> repo.jfrog.org: unknown error
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
I tried to use the wget way to download the link will prompt an error, then I use the sudo way to download the link successfully. So, how can I make jenkins gradle also use the sudo download, or use other solutions
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.1'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'me.tatarka:gradle-retrolambda:3.2.5'
classpath 'me.tatarka.retrolambda.projectlombok:lombok.ast:0.2.3.a2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
// Exclude the version that the android plugin depends on.
configurations.classpath.exclude group: 'com.android.tools.external.lombok'
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Please help me, thanks.
You can try upload your local library (in user/.gradle/caches) to Jenkins server, It 's work for me.
I don't think that run the build with super user rights is a good solution, because it's not seems to be possible to resolve dependencies.
Just a suggestion how to solve it: Gradle has it's own local cache for dependencies and doesn't need to download them on every build. So you may use the same Gradle distribution, which is used by Jenkins, and once build your application manually with su rights, to resolve all dependencies and cache them.
Just to note, by default dependencies with dynamic versions are cached for 24 hours only, as it's said in the official docs, but you can change it as:
configurations.all {
resolutionStrategy.cacheDynamicVersionsFor 10, 'minutes'
resolutionStrategy.cacheChangingModulesFor 4, 'hours'
}
I am using Gradle 2.13 and trying to build android apk in readhat and system does not have internet access.
I am trying to build android apk offline. But it is throwing some exception and not able to figure out what went wrong.
Main build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
Error:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'PROJECT'.
> Could not resolve all dependencies for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:2.1.0.
Required by:
:PROJECT:unspecified
> No cached version of com.android.tools.build:gradle:2.1.0 available for offline mode.
> No cached version of com.android.tools.build:gradle:2.1.0 available for offline mode.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 0.831 secs
Version :
gradle -version
Gradle 2.13
Is there any tutorial available to build an offline apk in redhat/linux machine?
Edit: Update the question.
It happens because the gradle plugin for android 2.13 doesn't exist.
The latest stable version is 2.1.0. Use:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
}
}
Don't confuse gradle distribution and the android plugin for gradle.
You can define the gradle distribution used by a project in the file
gradle/wrapper/gradle-wrapper.properties
For example:
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip